diff --git a/Session/Meta/Translations/en.lproj/Localizable.strings b/Session/Meta/Translations/en.lproj/Localizable.strings index fafe02bc9..77a6a7650 100644 --- a/Session/Meta/Translations/en.lproj/Localizable.strings +++ b/Session/Meta/Translations/en.lproj/Localizable.strings @@ -564,4 +564,5 @@ "accessibility_library_button" = "Photo library"; "accessibility_camera_button" = "Camera"; "accessibility_main_button_collapse" = "Collapse attachment options"; +"invalid_recovery_phrase" = "Invalid Recovery Phrase"; diff --git a/Session/Onboarding/LinkDeviceVC.swift b/Session/Onboarding/LinkDeviceVC.swift index f88f00659..e346bc325 100644 --- a/Session/Onboarding/LinkDeviceVC.swift +++ b/Session/Onboarding/LinkDeviceVC.swift @@ -122,6 +122,14 @@ final class LinkDeviceVC : BaseVC, UIPageViewControllerDataSource, UIPageViewCon } func continueWithSeed(_ seed: Data) { + if (seed.count != 16) { + let alert = UIAlertController(title: NSLocalizedString("invalid_recovery_phrase", comment: ""), message: NSLocalizedString("Please check the Recovery Phrase and try again.", comment: ""), preferredStyle: .alert) + alert.addAction(UIAlertAction(title: NSLocalizedString("OK", comment: ""), style: .default, handler: { _ in + self.scanQRCodeWrapperVC.startCapture() + })) + presentAlert(alert) + return + } let (ed25519KeyPair, x25519KeyPair) = KeyPairUtilities.generate(from: seed) Onboarding.Flow.link.preregister(with: seed, ed25519KeyPair: ed25519KeyPair, x25519KeyPair: x25519KeyPair) TSAccountManager.sharedInstance().didRegister() diff --git a/Session/Shared/ScanQRCodeWrapperVC.swift b/Session/Shared/ScanQRCodeWrapperVC.swift index 57b0eefd8..e3a8c07e2 100644 --- a/Session/Shared/ScanQRCodeWrapperVC.swift +++ b/Session/Shared/ScanQRCodeWrapperVC.swift @@ -71,4 +71,10 @@ final class ScanQRCodeWrapperVC : BaseVC { @objc private func close() { presentingViewController?.dismiss(animated: true, completion: nil) } + + public func startCapture() { + DispatchQueue.main.async { [weak self] in + self?.scanQRCodeVC.startCapture() + } + } }