Secure backup tweaks (#2277)

* Use a custom SDK build that might fix incomplete recovery state false positives. Enable chat backup by default

* Get rid of the chat backup feature flag

* Fix force unwrap warning

* Fix long line warning

* Prevent the recovery key confirmation banner popping up before the verification state is fetched. Stop showing secure backup user avatar and menu badges while the session is not verified.

* Switch back to the release version of the SDK

* Fix inconsistent session verification states, improve/simplify how to deal with it

* Fix unit tests

* Cleanup and hopefully simplify home screen banner presentations
This commit is contained in:
Stefan Ceriu
2023-12-21 17:08:29 +02:00
committed by GitHub
parent d148827eae
commit 0ae71f740d
18 changed files with 67 additions and 82 deletions
@@ -44,8 +44,9 @@ class SettingsScreenViewModel: SettingsScreenViewModelType, SettingsScreenViewMo
.weakAssign(to: \.state.userDisplayName, on: self)
.store(in: &cancellables)
appSettings.$chatBackupEnabled
.weakAssign(to: \.state.chatBackupEnabled, on: self)
userSession.sessionVerificationState
.receive(on: DispatchQueue.main)
.weakAssign(to: \.state.isSessionVerified, on: self)
.store(in: &cancellables)
userSession.clientProxy.secureBackupController.recoveryKeyState
@@ -53,33 +54,14 @@ class SettingsScreenViewModel: SettingsScreenViewModelType, SettingsScreenViewMo
.sink { [weak self] state in
guard let self else { return }
self.state.showSecureBackupBadge = (state == .incomplete || state == .disabled) && appSettings.chatBackupEnabled
self.state.showSecureBackupBadge = (state == .incomplete || state == .disabled)
}
.store(in: &cancellables)
Task {
await userSession.clientProxy.loadUserAvatarURL()
await userSession.clientProxy.loadUserDisplayName()
if let sessionVerificationController = userSession.sessionVerificationController,
case let .success(isVerified) = await sessionVerificationController.isVerified() {
state.isSessionVerified = isVerified
}
}
userSession.callbacks
.receive(on: DispatchQueue.main)
.sink { [weak self] callback in
switch callback {
case .sessionVerificationNeeded:
self?.state.isSessionVerified = false
case .didVerifySession:
self?.state.isSessionVerified = true
default:
break
}
}
.store(in: &cancellables)
}
override func process(viewAction: SettingsScreenViewAction) {