Show recovery instead of verification if this is the last session and recovery is set up

* Show recovery instead of verification if this is the last session and recovery is set up

* Rename `recoveryKeyState` to `recoveryState`

* Remove duplicates on session security state changes.

* Fix missing "Save recovery key" button

* Fix unit tests

* Rename `isLastDevice` to `isOnlyDeviceLeft`

* Address PR comments
This commit is contained in:
Stefan Ceriu
2024-02-16 11:38:49 +02:00
committed by GitHub
parent e0c9f43026
commit db05540cc5
23 changed files with 255 additions and 208 deletions
@@ -2363,11 +2363,11 @@ class RoomTimelineProviderMock: RoomTimelineProviderProtocol {
}
class SecureBackupControllerMock: SecureBackupControllerProtocol {
var recoveryKeyState: CurrentValuePublisher<SecureBackupRecoveryKeyState, Never> {
get { return underlyingRecoveryKeyState }
set(value) { underlyingRecoveryKeyState = value }
var recoveryState: CurrentValuePublisher<SecureBackupRecoveryState, Never> {
get { return underlyingRecoveryState }
set(value) { underlyingRecoveryState = value }
}
var underlyingRecoveryKeyState: CurrentValuePublisher<SecureBackupRecoveryKeyState, Never>!
var underlyingRecoveryState: CurrentValuePublisher<SecureBackupRecoveryState, Never>!
var keyBackupState: CurrentValuePublisher<SecureBackupKeyBackupState, Never> {
get { return underlyingKeyBackupState }
set(value) { underlyingKeyBackupState = value }
@@ -2446,23 +2446,6 @@ class SecureBackupControllerMock: SecureBackupControllerProtocol {
return confirmRecoveryKeyReturnValue
}
}
//MARK: - isLastSession
var isLastSessionCallsCount = 0
var isLastSessionCalled: Bool {
return isLastSessionCallsCount > 0
}
var isLastSessionReturnValue: Result<Bool, SecureBackupControllerError>!
var isLastSessionClosure: (() async -> Result<Bool, SecureBackupControllerError>)?
func isLastSession() async -> Result<Bool, SecureBackupControllerError> {
isLastSessionCallsCount += 1
if let isLastSessionClosure = isLastSessionClosure {
return await isLastSessionClosure()
} else {
return isLastSessionReturnValue
}
}
//MARK: - waitForKeyBackupUpload
var waitForKeyBackupUploadCallsCount = 0