|
@@ -14,21 +14,22 @@ class WelcomeViewController: UIViewController, ProgressAlertHandler {
|
|
|
|
|
|
private lazy var welcomeView: WelcomeContentView = {
|
|
private lazy var welcomeView: WelcomeContentView = {
|
|
let view = WelcomeContentView()
|
|
let view = WelcomeContentView()
|
|
- view.onLogin = { [unowned self] in
|
|
|
|
- let accountSetupController = AccountSetupController(dcContext: self.dcContext, editView: false)
|
|
|
|
|
|
+ view.onLogin = { [weak self] in
|
|
|
|
+ guard let strongSelf = self else { return }
|
|
|
|
+ let accountSetupController = AccountSetupController(dcContext: strongSelf.dcContext, editView: false)
|
|
accountSetupController.onLoginSuccess = {
|
|
accountSetupController.onLoginSuccess = {
|
|
- [unowned self] in
|
|
|
|
|
|
+ [weak self] in
|
|
if let appDelegate = UIApplication.shared.delegate as? AppDelegate {
|
|
if let appDelegate = UIApplication.shared.delegate as? AppDelegate {
|
|
appDelegate.appCoordinator.presentTabBarController()
|
|
appDelegate.appCoordinator.presentTabBarController()
|
|
}
|
|
}
|
|
}
|
|
}
|
|
- self.navigationController?.pushViewController(accountSetupController, animated: true)
|
|
|
|
|
|
+ strongSelf.navigationController?.pushViewController(accountSetupController, animated: true)
|
|
}
|
|
}
|
|
- view.onScanQRCode = { [unowned self] in
|
|
|
|
|
|
+ view.onScanQRCode = { [weak self] in
|
|
let qrReader = QrCodeReaderController()
|
|
let qrReader = QrCodeReaderController()
|
|
qrReader.delegate = self
|
|
qrReader.delegate = self
|
|
- self.qrCodeReader = qrReader
|
|
|
|
- self.navigationController?.pushViewController(qrReader, animated: true)
|
|
|
|
|
|
+ self?.qrCodeReader = qrReader
|
|
|
|
+ self?.navigationController?.pushViewController(qrReader, animated: true)
|
|
}
|
|
}
|
|
view.translatesAutoresizingMaskIntoConstraints = false
|
|
view.translatesAutoresizingMaskIntoConstraints = false
|
|
return view
|
|
return view
|
|
@@ -41,14 +42,14 @@ class WelcomeViewController: UIViewController, ProgressAlertHandler {
|
|
self.dcContext = dcContext
|
|
self.dcContext = dcContext
|
|
super.init(nibName: nil, bundle: nil)
|
|
super.init(nibName: nil, bundle: nil)
|
|
self.navigationItem.title = String.localized("welcome_desktop")
|
|
self.navigationItem.title = String.localized("welcome_desktop")
|
|
- onProgressSuccess = { [unowned self] in
|
|
|
|
|
|
+ onProgressSuccess = { [weak self] in
|
|
let profileInfoController = ProfileInfoViewController(context: dcContext)
|
|
let profileInfoController = ProfileInfoViewController(context: dcContext)
|
|
profileInfoController.onClose = {
|
|
profileInfoController.onClose = {
|
|
if let appDelegate = UIApplication.shared.delegate as? AppDelegate {
|
|
if let appDelegate = UIApplication.shared.delegate as? AppDelegate {
|
|
appDelegate.appCoordinator.presentTabBarController()
|
|
appDelegate.appCoordinator.presentTabBarController()
|
|
}
|
|
}
|
|
}
|
|
}
|
|
- self.navigationController?.setViewControllers([profileInfoController], animated: true)
|
|
|
|
|
|
+ self?.navigationController?.setViewControllers([profileInfoController], animated: true)
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
@@ -147,17 +148,17 @@ extension WelcomeViewController: QrCodeReaderDelegate {
|
|
let okAction = UIAlertAction(
|
|
let okAction = UIAlertAction(
|
|
title: String.localized("ok"),
|
|
title: String.localized("ok"),
|
|
style: .default,
|
|
style: .default,
|
|
- handler: { [unowned self] _ in
|
|
|
|
- self.dismissQRReader()
|
|
|
|
- self.createAccountFromQRCode(qrCode: qrCode)
|
|
|
|
|
|
+ handler: { [weak self] _ in
|
|
|
|
+ self?.dismissQRReader()
|
|
|
|
+ self?.createAccountFromQRCode(qrCode: qrCode)
|
|
}
|
|
}
|
|
)
|
|
)
|
|
|
|
|
|
let qrCancelAction = UIAlertAction(
|
|
let qrCancelAction = UIAlertAction(
|
|
title: String.localized("cancel"),
|
|
title: String.localized("cancel"),
|
|
style: .cancel,
|
|
style: .cancel,
|
|
- handler: { [unowned self] _ in
|
|
|
|
- self.dismissQRReader()
|
|
|
|
|
|
+ handler: { [weak self] _ in
|
|
|
|
+ self?.dismissQRReader()
|
|
}
|
|
}
|
|
)
|
|
)
|
|
|
|
|
|
@@ -172,8 +173,8 @@ extension WelcomeViewController: QrCodeReaderDelegate {
|
|
let okAction = UIAlertAction(
|
|
let okAction = UIAlertAction(
|
|
title: String.localized("ok"),
|
|
title: String.localized("ok"),
|
|
style: .default,
|
|
style: .default,
|
|
- handler: { [unowned self] _ in
|
|
|
|
- self.qrCodeReader?.startSession()
|
|
|
|
|
|
+ handler: { [weak self] _ in
|
|
|
|
+ self?.qrCodeReader?.startSession()
|
|
}
|
|
}
|
|
)
|
|
)
|
|
alert.addAction(okAction)
|
|
alert.addAction(okAction)
|