Kaynağa Gözat

remove initiateKeyTransfer()'s wait dialog; the funtion is no longer blocking (#1685)

bjoern 2 yıl önce
ebeveyn
işleme
707e7f153d
1 değiştirilmiş dosya ile 13 ekleme ve 21 silme
  1. 13 21
      deltachat-ios/Controller/SettingsController.swift

+ 13 - 21
deltachat-ios/Controller/SettingsController.swift

@@ -419,29 +419,21 @@ internal final class SettingsViewController: UITableViewController, ProgressAler
     private func sendAutocryptSetupMessage() {
         let askAlert = UIAlertController(title: String.localized("autocrypt_send_asm_explain_before"), message: nil, preferredStyle: .safeActionSheet)
         askAlert.addAction(UIAlertAction(title: String.localized("autocrypt_send_asm_title"), style: .default, handler: { _ in
-            let waitAlert = UIAlertController(title: String.localized("one_moment"), message: nil, preferredStyle: .alert)
-            waitAlert.addAction(UIAlertAction(title: String.localized("cancel"), style: .default, handler: { _ in self.dcContext.stopOngoingProcess() }))
-            self.present(waitAlert, animated: true, completion: nil)
-            DispatchQueue.global(qos: .background).async {
                 let sc = self.dcContext.initiateKeyTransfer()
-                DispatchQueue.main.async {
-                    waitAlert.dismiss(animated: true, completion: nil)
-                    guard var sc = sc else {
-                        return
-                    }
-                    if sc.count == 44 {
-                        // format setup code to the typical 3 x 3 numbers
-                        sc = sc.substring(0, 4) + "  -  " + sc.substring(5, 9) + "  -  " + sc.substring(10, 14) + "  -\n\n" +
-                            sc.substring(15, 19) + "  -  " + sc.substring(20, 24) + "  -  " + sc.substring(25, 29) + "  -\n\n" +
-                            sc.substring(30, 34) + "  -  " + sc.substring(35, 39) + "  -  " + sc.substring(40, 44)
-                    }
-
-                    let text = String.localizedStringWithFormat(String.localized("autocrypt_send_asm_explain_after"), sc)
-                    let showAlert = UIAlertController(title: text, message: nil, preferredStyle: .alert)
-                    showAlert.addAction(UIAlertAction(title: String.localized("ok"), style: .default, handler: nil))
-                    self.present(showAlert, animated: true, completion: nil)
+                guard var sc = sc else {
+                    return
                 }
-            }
+                if sc.count == 44 {
+                    // format setup code to the typical 3 x 3 numbers
+                    sc = sc.substring(0, 4) + "  -  " + sc.substring(5, 9) + "  -  " + sc.substring(10, 14) + "  -\n\n" +
+                        sc.substring(15, 19) + "  -  " + sc.substring(20, 24) + "  -  " + sc.substring(25, 29) + "  -\n\n" +
+                        sc.substring(30, 34) + "  -  " + sc.substring(35, 39) + "  -  " + sc.substring(40, 44)
+                }
+
+                let text = String.localizedStringWithFormat(String.localized("autocrypt_send_asm_explain_after"), sc)
+                let showAlert = UIAlertController(title: text, message: nil, preferredStyle: .alert)
+                showAlert.addAction(UIAlertAction(title: String.localized("ok"), style: .default, handler: nil))
+                self.present(showAlert, animated: true, completion: nil)
         }))
         askAlert.addAction(UIAlertAction(title: String.localized("cancel"), style: .cancel, handler: nil))
         present(askAlert, animated: true, completion: nil)