|
@@ -220,13 +220,34 @@ internal final class SettingsViewController: QuickTableViewController {
|
|
}
|
|
}
|
|
|
|
|
|
private func sendAsm(_: Row) {
|
|
private func sendAsm(_: Row) {
|
|
- let alert = UIAlertController(title: String.localized("autocrypt_send_asm_explain_before"), message: nil, preferredStyle: .actionSheet)
|
|
|
|
- alert.addAction(UIAlertAction(title: String.localized("autocrypt_send_asm_title"), style: .default, handler: { _ in
|
|
|
|
- //dcContext.intiateKeyTransfer()
|
|
|
|
- self.dismiss(animated: true, completion: nil)
|
|
|
|
|
|
+ let askAlert = UIAlertController(title: String.localized("autocrypt_send_asm_explain_before"), message: nil, preferredStyle: .actionSheet)
|
|
|
|
+ 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.intiateKeyTransfer()
|
|
|
|
+ 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)
|
|
|
|
+ }
|
|
|
|
+ }
|
|
}))
|
|
}))
|
|
- alert.addAction(UIAlertAction(title: String.localized("cancel"), style: .cancel, handler: nil))
|
|
|
|
- present(alert, animated: true, completion: nil)
|
|
|
|
|
|
+ askAlert.addAction(UIAlertAction(title: String.localized("cancel"), style: .cancel, handler: nil))
|
|
|
|
+ present(askAlert, animated: true, completion: nil)
|
|
}
|
|
}
|
|
|
|
|
|
private func configure(_: Row) {
|
|
private func configure(_: Row) {
|