瀏覽代碼

add missing warning about enabling 'Fetch only from Delta Chat folder'

B. Petersen 2 年之前
父節點
當前提交
0e65b1eeb6
共有 1 個文件被更改,包括 18 次插入3 次删除
  1. 18 3
      deltachat-ios/Controller/Settings/AdvancedViewController.swift

+ 18 - 3
deltachat-ios/Controller/Settings/AdvancedViewController.swift

@@ -95,9 +95,24 @@ internal final class AdvancedViewController: UITableViewController, ProgressAler
             textLabel: String.localized("pref_only_fetch_mvbox_title"),
             on: dcContext.getConfigBool("only_fetch_mvbox"),
             action: { cell in
-                self.dcAccounts.stopIo()
-                self.dcContext.setConfigBool("only_fetch_mvbox", cell.isOn)
-                self.dcAccounts.startIo()
+                if cell.isOn {
+                    let alert = UIAlertController(title: String.localized("pref_only_fetch_mvbox_title"),
+                        message: String.localized("pref_imap_folder_warn_disable_defaults"),
+                        preferredStyle: .safeActionSheet)
+                    alert.addAction(UIAlertAction(title: String.localized("perm_continue"), style: .destructive, handler: { _ in
+                        self.dcAccounts.stopIo()
+                        self.dcContext.setConfigBool("only_fetch_mvbox", true)
+                        self.dcAccounts.startIo()
+                    }))
+                    alert.addAction(UIAlertAction(title: String.localized("cancel"), style: .cancel, handler: { _ in
+                        cell.uiSwitch.setOn(false, animated: true)
+                    }))
+                    self.navigationController?.present(alert, animated: true, completion: nil)
+                } else {
+                    self.dcAccounts.stopIo()
+                    self.dcContext.setConfigBool("only_fetch_mvbox", false)
+                    self.dcAccounts.startIo()
+                }
         })
     }()