Skip to content

Commit f344a12

Browse files
Don't display security banner for unknown RecoveryState (#3579)
* Don't display security banner for unknown `RecoveryState` * Don't display 'set up recovery' if its status is unknown. Add more screenshot tests. * Update screenshots --------- Co-authored-by: ElementBot <[email protected]>
1 parent 729334b commit f344a12

File tree

32 files changed

+76
-39
lines changed

32 files changed

+76
-39
lines changed

features/roomlist/impl/src/main/kotlin/io/element/android/features/roomlist/impl/RoomListPresenter.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -186,9 +186,9 @@ class RoomListPresenter @Inject constructor(
186186
currentSecurityBannerDismissed -> SecurityBannerState.None
187187
syncState == SyncState.Running -> {
188188
when (recoveryState) {
189-
RecoveryState.UNKNOWN,
190189
RecoveryState.DISABLED -> SecurityBannerState.SetUpRecovery
191190
RecoveryState.INCOMPLETE -> SecurityBannerState.RecoveryKeyConfirmation
191+
RecoveryState.UNKNOWN,
192192
RecoveryState.WAITING_FOR_SYNC,
193193
RecoveryState.ENABLED -> SecurityBannerState.None
194194
}

features/roomlist/impl/src/test/kotlin/io/element/android/features/roomlist/impl/RoomListPresenterTest.kt

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -236,7 +236,9 @@ class RoomListPresenterTest {
236236

237237
@Test
238238
fun `present - handle DismissRecoveryKeyPrompt`() = runTest {
239-
val encryptionService = FakeEncryptionService()
239+
val encryptionService = FakeEncryptionService().apply {
240+
recoveryStateStateFlow.emit(RecoveryState.DISABLED)
241+
}
240242
val roomListService = FakeRoomListService().apply {
241243
postAllRoomsLoadingState(RoomList.LoadingState.Loaded(1))
242244
}

features/securebackup/impl/src/main/kotlin/io/element/android/features/securebackup/impl/root/SecureBackupRootStateProvider.kt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,11 @@ open class SecureBackupRootStateProvider : PreviewParameterProvider<SecureBackup
2020
aSecureBackupRootState(backupState = BackupState.UNKNOWN, doesBackupExistOnServer = AsyncData.Success(true)),
2121
aSecureBackupRootState(backupState = BackupState.UNKNOWN, doesBackupExistOnServer = AsyncData.Success(false)),
2222
aSecureBackupRootState(backupState = BackupState.UNKNOWN, doesBackupExistOnServer = AsyncData.Failure(Exception("An error"))),
23+
aSecureBackupRootState(backupState = BackupState.WAITING_FOR_SYNC),
24+
aSecureBackupRootState(backupState = BackupState.CREATING),
25+
aSecureBackupRootState(backupState = BackupState.RESUMING),
26+
aSecureBackupRootState(backupState = BackupState.DOWNLOADING),
27+
aSecureBackupRootState(backupState = BackupState.DISABLING),
2328
aSecureBackupRootState(backupState = BackupState.ENABLED),
2429
aSecureBackupRootState(recoveryState = RecoveryState.UNKNOWN),
2530
aSecureBackupRootState(recoveryState = RecoveryState.ENABLED),

features/securebackup/impl/src/main/kotlin/io/element/android/features/securebackup/impl/root/SecureBackupRootView.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -143,8 +143,8 @@ fun SecureBackupRootView(
143143

144144
// Setup recovery
145145
when (state.recoveryState) {
146-
RecoveryState.WAITING_FOR_SYNC -> Unit
147146
RecoveryState.UNKNOWN,
147+
RecoveryState.WAITING_FOR_SYNC -> Unit
148148
RecoveryState.DISABLED -> {
149149
PreferenceText(
150150
title = stringResource(id = R.string.screen_chat_backup_recovery_action_setup),
Lines changed: 2 additions & 2 deletions
Loading
Lines changed: 3 additions & 0 deletions
Loading
Lines changed: 3 additions & 0 deletions
Loading
Lines changed: 3 additions & 0 deletions
Loading
Lines changed: 3 additions & 0 deletions
Loading
Lines changed: 2 additions & 2 deletions
Loading

0 commit comments

Comments
 (0)