Skip to content

Commit

Permalink
Fix key listener
Browse files Browse the repository at this point in the history
  • Loading branch information
alfogrillo committed Nov 28, 2023
1 parent 92efd5f commit 51ddc74
Showing 1 changed file with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,7 @@ class SecureBackupController: SecureBackupControllerProtocol {
return .success(key)
}

var keyUploadErrored = false
let recoveryKey = try await encryption.enableRecovery(waitForBackupsToUpload: false, progressListener: SecureBackupEnableRecoveryProgressListener { [weak self] state in
guard let self else { return }

Expand All @@ -105,12 +106,11 @@ class SecureBackupController: SecureBackupControllerProtocol {
case .done:
recoveryKeyStateSubject.send(.enabled)
case .roomKeyUploadError:
#warning("AG: fix me")
return
keyUploadErrored = true
}
})

return .success(recoveryKey)
return keyUploadErrored ? .failure(.failedGeneratingRecoveryKey) : .success(recoveryKey)
} catch {
return .failure(.failedGeneratingRecoveryKey)
}
Expand Down

0 comments on commit 51ddc74

Please sign in to comment.