mirror of
https://gitlab.opencode.de/bwi/bundesmessenger/clients/bundesmessenger-ios.git
synced 2026-05-01 05:36:57 +02:00
merged element 1.8.10
This commit is contained in:
@@ -31,14 +31,14 @@ final class SecureBackupSetupCoordinator: SecureBackupSetupCoordinatorType {
|
||||
private let recoveryService: MXRecoveryService
|
||||
private let keyBackup: MXKeyBackup?
|
||||
private let checkKeyBackup: Bool
|
||||
private let homeserverEncryptionConfiguration: HomeserverEncryptionConfiguration
|
||||
private let allowOverwrite: Bool
|
||||
private let cancellable: Bool
|
||||
|
||||
private var isBackupSetupMethodKeySupported: Bool {
|
||||
guard let homeserverWellknown = self.session.homeserverWellknown else {
|
||||
return false
|
||||
}
|
||||
return homeserverWellknown.isBackupMethodKeySupported()
|
||||
let homeserverEncryptionConfiguration = self.session.vc_homeserverConfiguration().encryption
|
||||
return homeserverEncryptionConfiguration.secureBackupSetupMethods.contains(.key)
|
||||
}
|
||||
private let allowOverwrite: Bool
|
||||
|
||||
// MARK: Public
|
||||
|
||||
@@ -54,14 +54,16 @@ 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.homeserverEncryptionConfiguration = session.vc_homeserverConfiguration().encryption
|
||||
self.allowOverwrite = allowOverwrite
|
||||
|
||||
self.cancellable = cancellable
|
||||
|
||||
if let navigationRouter = navigationRouter {
|
||||
self.navigationRouter = navigationRouter
|
||||
} else {
|
||||
@@ -82,33 +84,25 @@ final class SecureBackupSetupCoordinator: SecureBackupSetupCoordinatorType {
|
||||
}
|
||||
|
||||
func toPresentable() -> UIViewController {
|
||||
let controller = self.navigationRouter.toPresentable()
|
||||
|
||||
// If the flow is not cancellable, run it fullscreen
|
||||
if let session = AppDelegate.theDelegate().mxSessions.first as? MXSession {
|
||||
if session.homeserverWellknown.backupRequired() {
|
||||
if #available(iOS 13.0, *) {
|
||||
controller.modalPresentationStyle = .fullScreen
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return controller
|
||||
return self.navigationRouter
|
||||
.toPresentable()
|
||||
.vc_setModalFullScreen(!self.cancellable)
|
||||
}
|
||||
|
||||
// MARK: - Private methods
|
||||
|
||||
private func createIntro() -> SecureBackupSetupIntroViewController {
|
||||
// TODO: Use a coordinator
|
||||
let viewModel = SecureBackupSetupIntroViewModel(keyBackup: self.keyBackup, checkKeyBackup: self.checkKeyBackup, wellKnown: self.session.homeserverWellknown)
|
||||
let introViewController = SecureBackupSetupIntroViewController.instantiate(with: viewModel)
|
||||
´ let viewModel = SecureBackupSetupIntroViewModel(keyBackup: self.keyBackup,
|
||||
checkKeyBackup: self.checkKeyBackup,
|
||||
homeserverEncryptionConfiguration: self.homeserverEncryptionConfiguration)
|
||||
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()
|
||||
|
||||
@@ -119,7 +113,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()
|
||||
|
||||
@@ -130,7 +124,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