Security settings: Improve the state of the secure backup section to be exhaustive

This commit is contained in:
manuroe
2021-06-16 13:38:23 +02:00
parent 90355a14f2
commit c23e1c7553
3 changed files with 85 additions and 114 deletions

View File

@@ -16,22 +16,30 @@
import UIKit
/// SettingsSecureBackup view state
/// State of the Secure Backup section in securtiy settings.
///
/// - checkingBackup: Load current backup on the homeserver
/// - checkError: Fail to load current backup data
/// - noKeyBackup: There is no backup on the homeserver
/// - keyBackup: There is a valid backup on the homeserver. All keys have been backed up to it
/// - keyBackupAndRunning: There is a valid backup on the homeserver. Keys are being sent to it
/// - keyBackupNotTrusted: There is a backup on the homeserver but it is not trusted
/// It is a mixed of the state of the Secure Backup(4S) and the state of the Key Backup.
///
/// - loading: Load current state
/// - noSecureBackup: The account has no secure backup
/// - secureBackup: The account has a secure backup
enum SettingsSecureBackupViewState {
case checkingBackup
case noSecureBackup
case noSecureBackupButKeyBackup(MXKeyBackupVersion, MXKeyBackupVersionTrust)
case noKeyBackup
case keyBackup(MXKeyBackupVersion, MXKeyBackupVersionTrust)
case keyBackupAndRunning(MXKeyBackupVersion, MXKeyBackupVersionTrust, Progress)
case keyBackupNotTrusted(MXKeyBackupVersion, MXKeyBackupVersionTrust)
case loading
case noSecureBackup(KeyBackupState)
case secureBackup(KeyBackupState)
/// Internal key backup state. It is independent from the secure backup state.
///
/// - noKeyBackup: There is no backup on the homeserver
/// - keyBackup: There is a valid backup on the homeserver. All keys have been backed up to it
/// - keyBackupAndRunning: There is a valid backup on the homeserver. Keys are being sent to it
/// - keyBackupNotTrusted: There is a backup on the homeserver but it is not trusted
enum KeyBackupState {
case noKeyBackup
case keyBackup(MXKeyBackupVersion, MXKeyBackupVersionTrust)
case keyBackupAndRunning(MXKeyBackupVersion, MXKeyBackupVersionTrust, Progress)
case keyBackupNotTrusted(MXKeyBackupVersion, MXKeyBackupVersionTrust)
}
}
/// State representing a network request made by the module