Ver Fonte

do not register for notifications if notifications are disabled by the user

B. Petersen há 4 anos atrás
pai
commit
030872a4ca

+ 1 - 1
deltachat-ios/AppDelegate.swift

@@ -69,7 +69,7 @@ class AppDelegate: UIResponder, UIApplicationDelegate, UNUserNotificationCenterD
         let notificationOption = launchOptions?[.remoteNotification]
         logger.info("remoteNotification: \(String(describing: notificationOption))")
 
-        if dcContext.isConfigured() {
+        if dcContext.isConfigured() && !UserDefaults.standard.bool(forKey: "notifications_disabled") {
             registerForNotifications()
         }
 

+ 5 - 1
deltachat-ios/Controller/AccountSetupController.swift

@@ -776,7 +776,11 @@ class AccountSetupController: UITableViewController, ProgressAlertHandler {
     private func handleLoginSuccess() {
         // used when login hud successfully went through
         let appDelegate = UIApplication.shared.delegate as! AppDelegate
-        appDelegate.registerForNotifications()
+
+        if !UserDefaults.standard.bool(forKey: "notifications_disabled") {
+            appDelegate.registerForNotifications()
+        }
+
         initSelectionCells();
         if let onLoginSuccess = self.onLoginSuccess {
             onLoginSuccess()