mirror of
https://gitlab.opencode.de/bwi/bundesmessenger/clients/bundesmessenger-ios.git
synced 2026-04-21 09:02:44 +02:00
Add cancellable property to secureBackup/recovery coordinators
This commit is contained in:
@@ -31,6 +31,7 @@ final class SecureBackupSetupCoordinator: SecureBackupSetupCoordinatorType {
|
||||
private let keyBackup: MXKeyBackup?
|
||||
private let checkKeyBackup: Bool
|
||||
private let allowOverwrite: Bool
|
||||
private let cancellable: Bool
|
||||
|
||||
// MARK: Public
|
||||
|
||||
@@ -46,12 +47,14 @@ final class SecureBackupSetupCoordinator: SecureBackupSetupCoordinatorType {
|
||||
/// - session: The MXSession.
|
||||
/// - checkKeyBackup: Indicate false to ignore existing key backup.
|
||||
/// - navigationRouter: Use existing navigation router to plug this flow or let nil to use new one.
|
||||
init(session: MXSession, checkKeyBackup: Bool = true, allowOverwrite: Bool = false, navigationRouter: NavigationRouterType? = nil) {
|
||||
/// - cancellable: Whether secure backup can be cancelled
|
||||
init(session: MXSession, checkKeyBackup: Bool = true, allowOverwrite: Bool = false, navigationRouter: NavigationRouterType? = nil, cancellable: Bool) {
|
||||
self.session = session
|
||||
self.recoveryService = session.crypto.recoveryService
|
||||
self.keyBackup = session.crypto.backup
|
||||
self.checkKeyBackup = checkKeyBackup
|
||||
self.allowOverwrite = allowOverwrite
|
||||
self.cancellable = cancellable
|
||||
|
||||
if let navigationRouter = navigationRouter {
|
||||
self.navigationRouter = navigationRouter
|
||||
@@ -73,7 +76,9 @@ final class SecureBackupSetupCoordinator: SecureBackupSetupCoordinatorType {
|
||||
}
|
||||
|
||||
func toPresentable() -> UIViewController {
|
||||
return self.navigationRouter.toPresentable()
|
||||
return self.navigationRouter
|
||||
.toPresentable()
|
||||
.vc_setModalFullScreen(!self.cancellable)
|
||||
}
|
||||
|
||||
// MARK: - Private methods
|
||||
@@ -81,13 +86,13 @@ final class SecureBackupSetupCoordinator: SecureBackupSetupCoordinatorType {
|
||||
private func createIntro() -> SecureBackupSetupIntroViewController {
|
||||
// TODO: Use a coordinator
|
||||
let viewModel = SecureBackupSetupIntroViewModel(keyBackup: self.keyBackup, checkKeyBackup: self.checkKeyBackup)
|
||||
let introViewController = SecureBackupSetupIntroViewController.instantiate(with: viewModel)
|
||||
let introViewController = SecureBackupSetupIntroViewController.instantiate(with: viewModel, cancellable: self.cancellable)
|
||||
introViewController.delegate = self
|
||||
return introViewController
|
||||
}
|
||||
|
||||
private func showSetupKey(passphraseOnly: Bool, passphrase: String? = nil) {
|
||||
let coordinator = SecretsSetupRecoveryKeyCoordinator(recoveryService: self.recoveryService, passphrase: passphrase, passphraseOnly: passphraseOnly, allowOverwrite: allowOverwrite)
|
||||
let coordinator = SecretsSetupRecoveryKeyCoordinator(recoveryService: self.recoveryService, passphrase: passphrase, passphraseOnly: passphraseOnly, allowOverwrite: allowOverwrite, cancellable: self.cancellable)
|
||||
coordinator.delegate = self
|
||||
coordinator.start()
|
||||
|
||||
@@ -98,7 +103,7 @@ final class SecureBackupSetupCoordinator: SecureBackupSetupCoordinatorType {
|
||||
}
|
||||
|
||||
private func showSetupPassphrase() {
|
||||
let coordinator = SecretsSetupRecoveryPassphraseCoordinator(passphraseInput: .new)
|
||||
let coordinator = SecretsSetupRecoveryPassphraseCoordinator(passphraseInput: .new, cancellable: self.cancellable)
|
||||
coordinator.delegate = self
|
||||
coordinator.start()
|
||||
|
||||
@@ -109,7 +114,7 @@ final class SecureBackupSetupCoordinator: SecureBackupSetupCoordinatorType {
|
||||
}
|
||||
|
||||
private func showSetupPassphraseConfirmation(with passphrase: String) {
|
||||
let coordinator = SecretsSetupRecoveryPassphraseCoordinator(passphraseInput: .confirm(passphrase))
|
||||
let coordinator = SecretsSetupRecoveryPassphraseCoordinator(passphraseInput: .confirm(passphrase), cancellable: self.cancellable)
|
||||
coordinator.delegate = self
|
||||
coordinator.start()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user