Kaynağa Gözat

add shared Notification delegate to allow foreground banner notifications

kskandis 1 yıl önce
ebeveyn
işleme
83035a90b4

+ 2 - 1
FreeAPS/Sources/Application/AppDelegate.swift

@@ -7,7 +7,8 @@ class AppDelegate: NSObject, UIApplicationDelegate, ObservableObject, UNUserNoti
         _ application: UIApplication,
         didFinishLaunchingWithOptions _: [UIApplication.LaunchOptionsKey: Any]?
     ) -> Bool {
-        UNUserNotificationCenter.current().delegate = self
+        UNUserNotificationCenter.current().delegate = BaseUserNotificationsManager.shared
+
         application.registerForRemoteNotifications()
         return true
     }

+ 2 - 0
FreeAPS/Sources/Services/UserNotifications/UserNotificationsManager.swift

@@ -591,6 +591,8 @@ extension BaseUserNotificationsManager: BolusFailureObserver {
 }
 
 extension BaseUserNotificationsManager: UNUserNotificationCenterDelegate {
+    static let shared = BaseUserNotificationsManager(resolver: FreeAPSApp.resolver)
+
     func userNotificationCenter(
         _: UNUserNotificationCenter,
         willPresent _: UNNotification,