Make NotifierManager.onUserNotification and NotifierManager.onNotificationClicked public on iOS API#131
Merged
mirzemehdi merged 2 commits intomirzemehdi:mainfrom Mar 20, 2025
Merged
Conversation
mirzemehdi
reviewed
Mar 20, 2025
kmpnotifier/src/iosMain/kotlin/com/mmk/kmpnotifier/firebase/FirebasePushNotifierImpl.kt
Show resolved
Hide resolved
…Impl This runs the initialization logic setting delegates immediately if already called from the main thread, instead of asynchronously
NotifierManager.onUserNotification and NotifierManager.onNotificationClicked public on iOS API
Owner
|
People coming to this PR: If you set your own notification delegate on ios side, you will need to call both on NotifierManager.onUserNotification(notificationContent)
NotifierManager.onNotificationClicked(notificationContent)
and on You can check NotificationDelegate implementation in the library: https://github.com/mirzemehdi/KMPNotifier/blob/b2774fcbb80d00adff9572966ffc9cd80fd67581/kmpnotifier/src/iosMain/kotlin/com/mmk/kmpnotifier/notification/IosNotifier.kt#L152C5-L156C20 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
To be merged after #130
Opens two iOS-related methods,
onUserNotificationandonNotificationClickedto the public. This is needed if the user wants to set their ownNotificationDelegateinstead of the library's own implementation, which is currently the only place where these methods are called from.Also puts the initialization code in
FirebasePushNotifierImplback into the blocking path, because if it's asynchronous, iOS system events likeuserNotificationCenter(.., didReceive response: UNNotificationResponse, ..)are delivered before the library sets these delegates and they'll be missed.Overall, as
NotifierManager.initialize()now sets the library's delegates instantly, and the methods called by the delegate are also accessible, it still allows the user to set their own delegate to replace what the library configures immediately after callingNotifierManager.initialize(), and it will work as expected.