فهرست منبع

always add a closed account so that we can opt-in account encryption (exception for now: QR-based account creation)

cyberta 3 سال پیش
والد
کامیت
aa2026e4dd

+ 1 - 1
deltachat-ios/AppDelegate.swift

@@ -77,7 +77,7 @@ class AppDelegate: UIResponder, UIApplicationDelegate, UNUserNotificationCenterD
             }
         }
 
-        if dcAccounts.getAll().isEmpty, dcAccounts.add() == 0 {
+        if dcAccounts.getAll().isEmpty, dcAccounts.addClosedAccount() == 0 {
            fatalError("Could not initialize a new account.")
         }
 

+ 2 - 2
deltachat-ios/Controller/SettingsController.swift

@@ -556,7 +556,7 @@ internal final class SettingsViewController: UITableViewController, ProgressAler
         menu.addAction(UIAlertAction(title: String.localized("add_account"), style: .default, handler: { [weak self] _ in
             guard let self = self else { return }
             prefs.setValue(selectedAccountId, forKey: Constants.Keys.lastSelectedAccountKey)
-            _ = self.dcAccounts.add()
+            _ = self.dcAccounts.addClosedAccount()
             appDelegate.reloadDcContext()
         }))
 
@@ -574,7 +574,7 @@ internal final class SettingsViewController: UITableViewController, ProgressAler
                     _ = self.dcAccounts.remove(id: selectedAccountId)
                     INInteraction.delete(with: "\(selectedAccountId)", completion: nil)
                     if self.dcAccounts.getAll().isEmpty {
-                        _ = self.dcAccounts.add()
+                        _ = self.dcAccounts.addClosedAccount()
                     } else {
                         let lastSelectedAccountId = prefs.integer(forKey: Constants.Keys.lastSelectedAccountKey)
                         if lastSelectedAccountId != 0 {

+ 2 - 1
deltachat-ios/Controller/WelcomeViewController.swift

@@ -128,6 +128,7 @@ class WelcomeViewController: UIViewController, ProgressAlertHandler {
         if dcAccounts.getSelected().isConfigured() {
             UserDefaults.standard.setValue(dcAccounts.getSelected().id, forKey: Constants.Keys.lastSelectedAccountKey)
 
+            //FIXME: what do we want to do with QR-Code created accounts? For now: adding an unencrypted account
             // ensure we're configuring on an empty new account
             _ = dcAccounts.add()
         }
@@ -171,7 +172,7 @@ class WelcomeViewController: UIViewController, ProgressAlertHandler {
         if !selectedAccount.isConfigured() {
             _ = dcAccounts.remove(id: selectedAccount.id)
             if self.dcAccounts.getAll().isEmpty {
-                _ = self.dcAccounts.add()
+                _ = self.dcAccounts.addClosedAccount()
             }
         }