mirror of
https://github.com/bitwarden/android.git
synced 2024-11-21 17:05:44 +03:00
Simplify and rename the hasManualUnlockMechanism helper (#1322)
This commit is contained in:
parent
5a9e9e4af0
commit
b739be712a
2 changed files with 7 additions and 6 deletions
|
@ -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
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
Loading…
Reference in a new issue