diff --git a/build.gradle.kts b/build.gradle.kts index dca60bd2..05939b6c 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -15,7 +15,7 @@ plugins { allprojects { group = "robustrade" - version = "1.14.0" + version = "1.14.2" } subprojects { diff --git a/core/library/src/iosMain/kotlin/ro/cosminmihu/ktor/monitor/ui/notification/NotificationDelegate.kt b/core/library/src/iosMain/kotlin/ro/cosminmihu/ktor/monitor/ui/notification/NotificationDelegate.kt deleted file mode 100644 index 9500799f..00000000 --- a/core/library/src/iosMain/kotlin/ro/cosminmihu/ktor/monitor/ui/notification/NotificationDelegate.kt +++ /dev/null @@ -1,40 +0,0 @@ -package ro.cosminmihu.ktor.monitor.ui.notification - -import platform.UserNotifications.UNNotification -import platform.UserNotifications.UNNotificationPresentationOptionAlert -import platform.UserNotifications.UNNotificationPresentationOptionBadge -import platform.UserNotifications.UNNotificationPresentationOptionSound -import platform.UserNotifications.UNNotificationPresentationOptions -import platform.UserNotifications.UNNotificationResponse -import platform.UserNotifications.UNUserNotificationCenter -import platform.UserNotifications.UNUserNotificationCenterDelegateProtocol -import platform.darwin.NSObject - -internal class NotificationDelegate( - private val appNotificationDelegate: UNUserNotificationCenterDelegateProtocol? = null -) : NSObject(), UNUserNotificationCenterDelegateProtocol { - - override fun userNotificationCenter( - center: UNUserNotificationCenter, - willPresentNotification: UNNotification, - withCompletionHandler: (UNNotificationPresentationOptions) -> Unit - ) { - val options = UNNotificationPresentationOptionAlert or - UNNotificationPresentationOptionSound or - UNNotificationPresentationOptionBadge - - appNotificationDelegate - ?.userNotificationCenter(center, willPresentNotification, withCompletionHandler) - ?: withCompletionHandler(options) - } - - override fun userNotificationCenter( - center: UNUserNotificationCenter, - didReceiveNotificationResponse: UNNotificationResponse, - withCompletionHandler: () -> Unit - ) { - appNotificationDelegate - ?.userNotificationCenter(center, didReceiveNotificationResponse, withCompletionHandler) - ?: withCompletionHandler() - } -} diff --git a/core/library/src/iosMain/kotlin/ro/cosminmihu/ktor/monitor/ui/notification/NotificationManager.kt b/core/library/src/iosMain/kotlin/ro/cosminmihu/ktor/monitor/ui/notification/NotificationManager.kt index d8b52359..ae6ad52b 100644 --- a/core/library/src/iosMain/kotlin/ro/cosminmihu/ktor/monitor/ui/notification/NotificationManager.kt +++ b/core/library/src/iosMain/kotlin/ro/cosminmihu/ktor/monitor/ui/notification/NotificationManager.kt @@ -13,9 +13,12 @@ import kotlin.coroutines.resume internal actual class NotificationManager { - private val notificationCenter = UNUserNotificationCenter.currentNotificationCenter().apply { - setDelegate(NotificationDelegate(appNotificationDelegate = delegate())) - } + // The library deliberately does not touch UNUserNotificationCenter.delegate. That property is + // the host app's, it is weak (so anything installed here has to be kept alive), and taking it + // over displaces whatever the app or its SDKs installed — which silently breaks push handling, + // deep links included. The notification below is still delivered to Notification Center; it is + // simply not presented as a banner while the app is in the foreground. + private val notificationCenter = UNUserNotificationCenter.currentNotificationCenter() actual suspend fun clear() { notificationCenter.removePendingNotificationRequestsWithIdentifiers(listOf(NOTIFICATION_ID.toString()))