Ensure trusted device is displayed before set password or reset password screens (#1250)

This commit is contained in:
David Perez 2024-04-10 12:58:06 -05:00 committed by Álison Fernandes
parent f01a67ea9c
commit 0bddd70d2a
2 changed files with 4 additions and 4 deletions

View file

@ -61,13 +61,13 @@ class RootNavViewModel @Inject constructor(
val userState = action.userState
val specialCircumstance = action.specialCircumstance
val updatedRootNavState = when {
userState?.activeAccount?.trustedDevice?.isDeviceTrusted == false &&
!userState.activeAccount.isVaultUnlocked -> RootNavState.TrustedDevice
userState?.activeAccount?.needsMasterPassword == true -> RootNavState.SetPassword
userState?.activeAccount?.needsPasswordReset == true -> RootNavState.ResetPassword
userState?.activeAccount?.trustedDevice?.isDeviceTrusted == false &&
!userState.activeAccount.isVaultUnlocked -> RootNavState.TrustedDevice
userState == null ||
!userState.activeAccount.isLoggedIn ||
userState.hasPendingAccountAddition -> RootNavState.Auth

View file

@ -19,7 +19,7 @@ import org.junit.jupiter.api.Test
class RootNavViewModelTest : BaseViewModelTest() {
private val mutableUserStateFlow = MutableStateFlow<UserState?>(null)
private val authRepository = mockk<AuthRepository>() {
private val authRepository = mockk<AuthRepository> {
every { userStateFlow } returns mutableUserStateFlow
every { updateLastActiveTime() } just runs
}