Explorar o código

retry to aquire a notification token if the app has none yet and the device gets internet connectivity

cyberta %!s(int64=3) %!d(string=hai) anos
pai
achega
8b19962e59
Modificáronse 1 ficheiros con 7 adicións e 1 borrados
  1. 7 1
      deltachat-ios/AppDelegate.swift

+ 7 - 1
deltachat-ios/AppDelegate.swift

@@ -117,7 +117,13 @@ class AppDelegate: UIResponder, UIApplicationDelegate, UNUserNotificationCenterD
             // Reachability::reachabilityChanged uses DispatchQueue.main.async only
             logger.info("network: reachable", reachability.connection.description)
             DispatchQueue.global(qos: .background).async { [weak self] in
-                self?.dcAccounts.maybeNetwork()
+                guard let self = self else { return }
+                self.dcAccounts.maybeNetwork()
+                if self.notifyToken == nil &&
+                    self.dcAccounts.getSelected().isConfigured() &&
+                    !UserDefaults.standard.bool(forKey: "notifications_disabled") {
+                        self.registerForNotifications()
+                }
             }
         }