Skip to content

Commit

Permalink
ask explicitly before creating new profiles from chatlist-qr-scanner …
Browse files Browse the repository at this point in the history
…(there is another confirmation later, but that is already on another screen and ppl may be wondering how to go back)
  • Loading branch information
r10s committed Jun 2, 2024
1 parent ffa984d commit a55bd00
Showing 1 changed file with 15 additions and 4 deletions.
19 changes: 15 additions & 4 deletions deltachat-ios/Controller/QrPageController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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 }
Expand Down

0 comments on commit a55bd00

Please sign in to comment.