B. Petersen 5 лет назад
Родитель
Сommit
f9f7b22e8e
1 измененных файлов с 15 добавлено и 11 удалено
  1. 15 11
      deltachat-ios/Controller/SettingsController.swift

+ 15 - 11
deltachat-ios/Controller/SettingsController.swift

@@ -191,18 +191,22 @@ internal final class SettingsViewController: QuickTableViewController {
     }
 
     private func createBackup(_: Row) {
-        // if let documents = FileManager.default.containerURL(forSecurityApplicationGroupIdentifier: "group.delta.chat.ios")?.path {
-
-        let documents = NSSearchPathForDirectoriesInDomains(.documentDirectory, .userDomainMask, true)
-        if !documents.isEmpty {
-            logger.info("create backup in \(documents)")
-            hudHandler.showHud(String.localized("one_moment"))
-            DispatchQueue.main.async {
-                dc_imex(mailboxPointer, DC_IMEX_EXPORT_BACKUP, documents[0], nil)
+        let alert = UIAlertController(title: String.localized("pref_backup_export_explain"), message: nil, preferredStyle: .actionSheet)
+        alert.addAction(UIAlertAction(title: String.localized("pref_backup_export_start_button"), style: .default, handler: { _ in
+            self.dismiss(animated: true, completion: nil)
+            let documents = NSSearchPathForDirectoriesInDomains(.documentDirectory, .userDomainMask, true)
+            if !documents.isEmpty {
+                logger.info("create backup in \(documents)")
+                self.hudHandler.showHud(String.localized("one_moment"))
+                DispatchQueue.main.async {
+                    dc_imex(mailboxPointer, DC_IMEX_EXPORT_BACKUP, documents[0], nil)
+                }
+            } else {
+                logger.error("document directory not found")
             }
-        } else {
-            logger.error("document directory not found")
-        }
+        }))
+        alert.addAction(UIAlertAction(title: String.localized("cancel"), style: .cancel, handler: nil))
+        present(alert, animated: true, completion: nil)
     }
 
     private func configure(_: Row) {