mirror of
https://github.com/bitwarden/android.git
synced 2026-05-13 15:21:11 -05:00
Simplify and rename the hasManualUnlockMechanism helper (#1322)
This commit is contained in:
@@ -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
|
||||
|
||||
|
||||
Reference in New Issue
Block a user