mirror of
https://github.com/Novaloop-AG/element-x-ios.git
synced 2026-11-04 01:20:12 +00:00
Encryption Flow Coordinators. (#3471)
* Manage the secure backup screens with flow coordinators.
* Add UI tests for the EncryptionSettingsFlowCoordinator.
* Realise that the settings flow can't reset anymore and remove the sub-flow 🤦♂️
* Add UI tests for the EncryptionResetFlowCoordinator.
This commit is contained in:
@@ -0,0 +1,48 @@
|
||||
//
|
||||
// Copyright 2024 New Vector Ltd.
|
||||
//
|
||||
// SPDX-License-Identifier: AGPL-3.0-only
|
||||
// Please see LICENSE in the repository root for full details.
|
||||
//
|
||||
|
||||
import Combine
|
||||
import Foundation
|
||||
|
||||
extension SecureBackupControllerMock {
|
||||
struct Configuration {
|
||||
var recoveryState: SecureBackupRecoveryState = .enabled
|
||||
var keyBackupState: SecureBackupKeyBackupState = .enabled
|
||||
}
|
||||
|
||||
convenience init(_ configuration: Configuration) {
|
||||
self.init()
|
||||
|
||||
let recoveryStateSubject = CurrentValueSubject<SecureBackupRecoveryState, Never>(configuration.recoveryState)
|
||||
underlyingRecoveryState = .init(recoveryStateSubject)
|
||||
|
||||
let keyBackupStateSubject = CurrentValueSubject<SecureBackupKeyBackupState, Never>(configuration.keyBackupState)
|
||||
underlyingKeyBackupState = .init(keyBackupStateSubject)
|
||||
|
||||
disableClosure = {
|
||||
recoveryStateSubject.send(.disabled)
|
||||
keyBackupStateSubject.send(.unknown)
|
||||
return .success(())
|
||||
}
|
||||
|
||||
enableClosure = {
|
||||
recoveryStateSubject.send(.disabled)
|
||||
keyBackupStateSubject.send(.enabled)
|
||||
return .success(())
|
||||
}
|
||||
|
||||
generateRecoveryKeyClosure = {
|
||||
recoveryStateSubject.send(.enabled)
|
||||
return .success("a1B2 C3d4 E5F6 g7H8 i9J0 K1l2 M3n4 O5p6 Q7R8 s9T0 U1v2 W3X4")
|
||||
}
|
||||
|
||||
confirmRecoveryKeyClosure = { _ in
|
||||
recoveryStateSubject.send(.enabled)
|
||||
return .success(())
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user