mirror of
https://github.com/Novaloop-AG/element-x-ios.git
synced 2026-11-02 21:33:26 +00:00
Key backup Rust API adoption (#1952)
* Adopt Rust side secure backup APIs (incomplete, based on poljar/backup-pr) * Implement the home screen recovery key confirmation banner. * Update with the latest Rust changes. The loading button for .unknown was incorrect. It should be treated as disabled. --------- Co-authored-by: Doug <douglase@element.io>
This commit is contained in:
+4
-4
@@ -55,8 +55,8 @@ class SecureBackupScreenViewModel: SecureBackupScreenViewModelType, SecureBackup
|
||||
actionsSubject.send(.recoveryKey)
|
||||
case .keyBackup:
|
||||
switch secureBackupController.keyBackupState.value {
|
||||
case .disabled:
|
||||
enableKeyBackup()
|
||||
case .disabled, .unknown:
|
||||
enableBackup()
|
||||
case .enabled:
|
||||
actionsSubject.send(.keyBackup)
|
||||
default:
|
||||
@@ -67,11 +67,11 @@ class SecureBackupScreenViewModel: SecureBackupScreenViewModelType, SecureBackup
|
||||
|
||||
// MARK: - Private
|
||||
|
||||
private func enableKeyBackup() {
|
||||
private func enableBackup() {
|
||||
Task {
|
||||
let loadingIndicatorIdentifier = "SecureBackupScreenLoading"
|
||||
userIndicatorController?.submitIndicator(.init(id: loadingIndicatorIdentifier, type: .modal, title: L10n.commonLoading, persistent: true))
|
||||
switch await secureBackupController.enableBackup() {
|
||||
switch await secureBackupController.enable() {
|
||||
case .success:
|
||||
break
|
||||
case .failure(let error):
|
||||
|
||||
+1
-3
@@ -77,12 +77,10 @@ struct SecureBackupScreen: View {
|
||||
ListRow(label: .plain(title: L10n.screenChatBackupKeyBackupActionDisable, role: .destructive), kind: .navigationLink {
|
||||
context.send(viewAction: .keyBackup)
|
||||
})
|
||||
case .disabled, .enabling:
|
||||
case .disabled, .enabling, .unknown:
|
||||
ListRow(label: .plain(title: L10n.screenChatBackupKeyBackupActionEnable), kind: .navigationLink {
|
||||
context.send(viewAction: .keyBackup)
|
||||
})
|
||||
default:
|
||||
ListRow(label: .plain(title: L10n.commonLoading), details: .isWaiting(true), kind: .label)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user