This commit is contained in:
Niels Andriesse 2019-11-19 16:18:29 +11:00
parent 4fd2faffe4
commit 5e80e0d13a
2 changed files with 14 additions and 2 deletions

View file

@ -1,6 +1,7 @@
final class ScanQRCodeWrapperVC : UIViewController {
var delegate: (UIViewController & OWSQRScannerDelegate)? = nil
var isPresentedModally = false
private let message: String
private let scanQRCodeVC = OWSQRCodeScanningViewController()
@ -22,6 +23,10 @@ final class ScanQRCodeWrapperVC : UIViewController {
}
override func viewDidLoad() {
// Navigation bar
if isPresentedModally {
navigationItem.leftBarButtonItem = UIBarButtonItem(barButtonSystemItem: .stop, target: self, action: #selector(objc_dismiss))
}
// Background color
view.backgroundColor = Theme.backgroundColor
// Scan QR code VC
@ -61,4 +66,9 @@ final class ScanQRCodeWrapperVC : UIViewController {
self?.scanQRCodeVC.startCapture()
}
}
// MARK: Interaction
@objc private func objc_dismiss() {
presentingViewController?.dismiss(animated: true, completion: nil)
}
}

View file

@ -224,10 +224,12 @@ final class SeedVC : OnboardingBaseViewController, DeviceLinkingModalDelegate, O
ows_ask(forCameraPermissions: { [weak self] hasCameraAccess in
guard let self = self else { return }
if hasCameraAccess {
let message = NSLocalizedString("something something something", comment: "")
let message = NSLocalizedString("Link to an existing device by going into its in-app settings and clicking \"Link Device\".", comment: "")
let scanQRCodeWrapperVC = ScanQRCodeWrapperVC(message: message)
scanQRCodeWrapperVC.delegate = self
self.present(scanQRCodeWrapperVC, animated: true, completion: nil)
scanQRCodeWrapperVC.isPresentedModally = true
let navigationVC = OWSNavigationController(rootViewController: scanQRCodeWrapperVC)
self.present(navigationVC, animated: true, completion: nil)
} else {
// Do nothing
}