Преглед изворни кода

allow cancelling login process

B. Petersen пре 5 година
родитељ
комит
265aaf2df1
1 измењених фајлова са 3 додато и 10 уклоњено
  1. 3 10
      deltachat-ios/Controller/AccountSetupController.swift

+ 3 - 10
deltachat-ios/Controller/AccountSetupController.swift

@@ -38,7 +38,9 @@ class AccountSetupController: UITableViewController {
         progressView.centerYAnchor.constraint(equalTo: alert.view.centerYAnchor, constant: 0).isActive = true
         progressView.heightAnchor.constraint(equalToConstant: 65).isActive = true
         progressView.widthAnchor.constraint(equalToConstant: 65).isActive = true
-        alert.addAction(UIAlertAction(title: String.localized("cancel"), style: .cancel, handler: loginCancelled(_:)))
+        alert.addAction(UIAlertAction(title: String.localized("cancel"), style: .cancel, handler: { _ in
+            self.dcContext.stopOngoingProcess()
+        }))
         return alert
     }()
 
@@ -73,15 +75,6 @@ class AccountSetupController: UITableViewController {
         }
     }
 
-    private func loginCancelled(_ action: UIAlertAction) {
-        DcConfig.addr = nil
-        DcConfig.mailPw = nil
-        DispatchQueue.global(qos: .background).async {
-            dc_stop_ongoing_process(mailboxPointer)        // this function freezes UI so execute in background thread
-        }
-    }
-
-
     // account setup
 
     private lazy var emailCell: TextFieldCell = {