瀏覽代碼

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

B. Petersen 4 年之前
父節點
當前提交
030872a4ca
共有 2 個文件被更改,包括 6 次插入2 次删除
  1. 1 1
      deltachat-ios/AppDelegate.swift
  2. 5 1
      deltachat-ios/Controller/AccountSetupController.swift

+ 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()