From a55bd00d1eeb64d233daa4be4f25913e7da0ed11 Mon Sep 17 00:00:00 2001 From: "B. Petersen" Date: Sun, 2 Jun 2024 14:38:44 +0200 Subject: [PATCH] ask explicitly before creating new profiles from chatlist-qr-scanner (there is another confirmation later, but that is already on another screen and ppl may be wondering how to go back) --- .../Controller/QrPageController.swift | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/deltachat-ios/Controller/QrPageController.swift b/deltachat-ios/Controller/QrPageController.swift index 6b7a65c5a..0ef2e456d 100644 --- a/deltachat-ios/Controller/QrPageController.swift +++ b/deltachat-ios/Controller/QrPageController.swift @@ -281,11 +281,22 @@ extension QrPageController: QrCodeReaderDelegate { })) present(alert, animated: true, completion: nil) - case DC_QR_ACCOUNT, DC_QR_LOGIN, DC_QR_BACKUP: - if let appDelegate = UIApplication.shared.delegate as? AppDelegate { - _ = dcAccounts.add() + case DC_QR_ACCOUNT, DC_QR_LOGIN: + let msg = String.localizedStringWithFormat(String.localized(state == DC_QR_ACCOUNT ? "qraccount_ask_create_and_login_another" : "qrlogin_ask_login_another"), qrParsed.text1 ?? "") + let alert = UIAlertController(title: msg, message: nil, preferredStyle: .alert) + alert.addAction(UIAlertAction(title: String.localized("cancel"), style: .cancel, handler: nil)) + alert.addAction(UIAlertAction(title: String.localized("ok"), style: .default, handler: { _ in + guard let appDelegate = UIApplication.shared.delegate as? AppDelegate else { return } + _ = self.dcAccounts.add() appDelegate.reloadDcContext(accountCode: code) - } + })) + present(alert, animated: true, completion: nil) + + case DC_QR_BACKUP: + // alert is shown in WelcomeViewController + guard let appDelegate = UIApplication.shared.delegate as? AppDelegate else { return } + _ = dcAccounts.add() + appDelegate.reloadDcContext(accountCode: code) case DC_QR_WEBRTC_INSTANCE: guard let domain = qrParsed.text1 else { return }