Bladeren bron

show device msg for didReceiveRemoteNotification

B. Petersen 4 jaren geleden
bovenliggende
commit
e3899f30e0
1 gewijzigde bestanden met toevoegingen van 11 en 5 verwijderingen
  1. 11 5
      deltachat-ios/AppDelegate.swift

+ 11 - 5
deltachat-ios/AppDelegate.swift

@@ -70,13 +70,14 @@ class AppDelegate: UIResponder, UIApplicationDelegate, UNUserNotificationCenterD
         logger.info("Notifications: remoteNotification: \(String(describing: notificationOption))")
 
         let msg = DcMsg(viewType: DC_MSG_TEXT)
-        msg.text = "remoteNotification: \(String(describing: notificationOption))"
+        msg.text = "I. remoteNotification: \(String(describing: notificationOption))"
         dcContext.addDeviceMessage(label: nil, msg: msg)
 
         if dcContext.isConfigured() && !UserDefaults.standard.bool(forKey: "notifications_disabled") {
             registerForNotifications()
         }
 
+
         return true
     }
 
@@ -336,16 +337,21 @@ class AppDelegate: UIResponder, UIApplicationDelegate, UNUserNotificationCenterD
     }
 
     func application(
-      _ application: UIApplication,
-      didFailToRegisterForRemoteNotificationsWithError error: Error) {
-      print("Notifications: Failed to register: \(error)")
+        _ application: UIApplication,
+        didFailToRegisterForRemoteNotificationsWithError error: Error) {
+        print("Notifications: Failed to register: \(error)")
     }
     
-     func application(
+    func application(
         _ application: UIApplication,
         didReceiveRemoteNotification userInfo: [AnyHashable: Any]) {
         // TODO: got notification from apple, check for new messages
         print("Notifications: didReceiveRemoteNotification", userInfo)
+
+        let msg = DcMsg(viewType: DC_MSG_TEXT)
+        msg.text = "II. didReceiveRemoteNotification: \(String(describing: userInfo))"
+        dcContext.addDeviceMessage(label: nil, msg: msg)
+        
     }
     
     private func userNotificationCenter(_: UNUserNotificationCenter, willPresent _: UNNotification, withCompletionHandler completionHandler: @escaping (UNNotificationPresentationOptions) -> Void) {