Simplify and rename the hasManualUnlockMechanism helper (#1322)

This commit is contained in:
David Perez 2024-04-30 15:51:14 -05:00 committed by Álison Fernandes
parent 5a9e9e4af0
commit b739be712a
2 changed files with 7 additions and 6 deletions

View file

@ -72,12 +72,13 @@ data class UserState(
val hasMasterPassword: Boolean get() = trustedDevice?.hasMasterPassword != false
/**
* Indicates that the user does or does not have a means to unlock the vault.
* Indicates that the user does or does not have a means to manually unlock the vault.
*/
val hasUnlockMechanism: Boolean
get() = hasMasterPassword ||
isBiometricsEnabled ||
vaultUnlockType == VaultUnlockType.PIN
val hasManualUnlockMechanism: Boolean
get() = when (vaultUnlockType) {
VaultUnlockType.MASTER_PASSWORD -> hasMasterPassword || isBiometricsEnabled
VaultUnlockType.PIN -> true
}
}
/**

View file

@ -62,7 +62,7 @@ class RootNavViewModel @Inject constructor(
val updatedRootNavState = when {
userState?.activeAccount?.trustedDevice?.isDeviceTrusted == false &&
!userState.activeAccount.isVaultUnlocked &&
!userState.activeAccount.hasUnlockMechanism -> RootNavState.TrustedDevice
!userState.activeAccount.hasManualUnlockMechanism -> RootNavState.TrustedDevice
userState?.activeAccount?.needsMasterPassword == true -> RootNavState.SetPassword