Skip to content

Commit 77412e8

Browse files
committed
fix: UserNotificationsDelegate deinit bug fix
1 parent 2d2cb04 commit 77412e8

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

Sources/UserNotificationsClient/Live.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,8 @@ import Foundation
99
import UserNotifications
1010

1111
extension UserNotificationClient {
12-
12+
private static let notificationDelegate = UserNotificationClient.UserNotificationsDelegate()
13+
1314
/// Transforms the UNUserNotificationCenter APIs into the async UserNotificationClient interface
1415
///
1516
/// ❗️ IMPORTANT ❗️
@@ -20,7 +21,6 @@ extension UserNotificationClient {
2021
/// before the `didFinishLaunching` method returns. This way the app can react to the push notifications even when opened from a suspended state.
2122
/// - Returns: Working implementation of the UserNotificationClient
2223
public static func live() -> Self {
23-
let notificationDelegate = UserNotificationClient.UserNotificationsDelegate()
2424
let userNotificationCenter = UNUserNotificationCenter.current()
2525
userNotificationCenter.delegate = notificationDelegate
2626
let delegate = AsyncStream { continuation in
@@ -52,7 +52,7 @@ extension UserNotificationClient {
5252
var continuation: AsyncStream<UserNotificationClient.DelegateEvent>.Continuation?
5353

5454
deinit {
55-
print("🍏 DEINIT")
55+
print("📬❗️ UserNotificationsDelegate deinitialized. You will no longer receive notification events.")
5656
}
5757

5858
public func userNotificationCenter(

0 commit comments

Comments
 (0)