Simplify manual unlock check (#3824)

This commit is contained in:
David Perez 2024-08-26 09:07:23 -05:00 committed by GitHub
parent 9dbb40f33b
commit 38e693f92c
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -61,22 +61,20 @@ class VaultUnlockViewModel @Inject constructor(
) )
val vaultUnlockType = activeAccount.vaultUnlockType val vaultUnlockType = activeAccount.vaultUnlockType
val hasNoMasterPassword = !activeAccount.hasMasterPassword val hasNoMasterPassword = !activeAccount.hasMasterPassword
val hideInput = hasNoMasterPassword && vaultUnlockType == VaultUnlockType.MASTER_PASSWORD if (!activeAccount.hasManualUnlockMechanism) {
val isBiometricsEnabled = activeAccount.isBiometricsEnabled
if (hasNoMasterPassword && vaultUnlockType != VaultUnlockType.PIN && !isBiometricsEnabled) {
// There is no valid way to unlock this app. // There is no valid way to unlock this app.
authRepository.logout() authRepository.logout()
} }
VaultUnlockState( VaultUnlockState(
accountSummaries = accountSummaries, accountSummaries = accountSummaries,
avatarColorString = activeAccountSummary.avatarColorHex, avatarColorString = activeAccountSummary.avatarColorHex,
hideInput = hideInput, hideInput = hasNoMasterPassword && vaultUnlockType == VaultUnlockType.MASTER_PASSWORD,
initials = activeAccountSummary.initials, initials = activeAccountSummary.initials,
email = activeAccountSummary.email, email = activeAccountSummary.email,
dialog = null, dialog = null,
environmentUrl = environmentRepo.environment.label, environmentUrl = environmentRepo.environment.label,
input = "", input = "",
isBiometricEnabled = isBiometricsEnabled, isBiometricEnabled = activeAccount.isBiometricsEnabled,
isBiometricsValid = isBiometricsValid, isBiometricsValid = isBiometricsValid,
showAccountMenu = VaultUnlockArgs(savedStateHandle).unlockType == UnlockType.STANDARD, showAccountMenu = VaultUnlockArgs(savedStateHandle).unlockType == UnlockType.STANDARD,
showBiometricInvalidatedMessage = false, showBiometricInvalidatedMessage = false,