File tree Expand file tree Collapse file tree 2 files changed +5
-2
lines changed
kmpnotifier/src/iosMain/kotlin/com/mmk/kmpnotifier Expand file tree Collapse file tree 2 files changed +5
-2
lines changed Original file line number Diff line number Diff line change @@ -29,7 +29,8 @@ public fun NotifierManager.onApplicationDidReceiveRemoteNotification(userInfo: M
2929
3030internal fun NotifierManager.onUserNotification (notificationContent : UNNotificationContent ) {
3131 val userInfo = notificationContent.userInfo
32- if (notificationContent.isPushNotification()) NotifierManagerImpl .onPushNotification(
32+ val hasNotification = notificationContent.title != null || notificationContent.body != null
33+ if (notificationContent.isPushNotification() && hasNotification) NotifierManagerImpl .onPushNotification(
3334 title = notificationContent.title,
3435 body = notificationContent.body
3536 )
Original file line number Diff line number Diff line change @@ -17,11 +17,13 @@ import kotlin.coroutines.suspendCoroutine
1717@OptIn(ExperimentalForeignApi ::class )
1818internal class FirebasePushNotifierImpl : PushNotifier {
1919
20+ private val firebaseMessageDelegate by lazy { FirebaseMessageDelegate () }
21+
2022 init {
2123 MainScope ().launch {
2224 println (" FirebasePushNotifier is initialized" )
25+ FIRMessaging .messaging().delegate = firebaseMessageDelegate
2326 UIApplication .sharedApplication.registerForRemoteNotifications()
24- FIRMessaging .messaging().delegate = FirebaseMessageDelegate ()
2527 }
2628
2729 }
You can’t perform that action at this time.
0 commit comments