-
-
Notifications
You must be signed in to change notification settings - Fork 8
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
iOS-FCM-Foreground-not-working-fixes #47
base: main
Are you sure you want to change the base?
iOS-FCM-Foreground-not-working-fixes #47
Conversation
@alamin-karno, Please look into this. |
@@ -124,17 +124,27 @@ public class SwiftFlutterCrispChatPlugin: NSObject, FlutterPlugin, UIApplication | |||
completionHandler([.alert, .sound]) | |||
} | |||
} else { | |||
completionHandler([]) | |||
// Notify Flutter or rethrow to allow other handlers to process the notification | |||
channel?.invokeMethod("onNotificationReceived", arguments: notification.request.content.userInfo) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you explain this onNotificationReceived
channel? from where this is receiving in this package? Because I didn't create this channel.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The onNotificationReceived
channel is part of the FlutterMethodChannel
created in the register(with:)
method of your iOS plugin, with the name "flutter_crisp_chat"
. This method channel enables communication between the native iOS code and the Dart side of your Flutter app. When a non-Crisp notification is received or tapped, the iOS plugin uses channel?.invokeMethod
to invoke a method (onNotificationReceived
in this case) on the Dart side, passing the notification data for further handling in Flutter. If you haven't explicitly implemented handling for this method on the Dart side, it must be added to process these events.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Okay, I need to test if it is working fine then I will add this changes on next update!!
public func userNotificationCenter(_ center: UNUserNotificationCenter, | ||
didReceive response: UNNotificationResponse, | ||
withCompletionHandler completionHandler: @escaping () -> Void) { | ||
let notification = response.notification | ||
if CrispSDK.isCrispPushNotification(notification) { | ||
CrispSDK.handlePushNotification(notification) | ||
} else { | ||
// Notify Flutter about the interaction or rethrow for further processing | ||
channel?.invokeMethod("onNotificationTapped", arguments: response.notification.request.content.userInfo) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you explain this onNotificationTapped
channel? from where this is receiving in this package? Because I didn't create this channel.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same for onNotificationTapped
fixes #39