FIX: dispatch UI for biometrics was firing regardless

This commit is contained in:
Marcos Rodriguez Velez 2024-02-20 18:10:46 -04:00
parent 6e10c3c7d2
commit a76a27106a
No known key found for this signature in database
GPG key ID: 6030B2F48CCE86D7

View file

@ -132,15 +132,14 @@ const UnlockWith: React.FC = () => {
const startUnlock = async () => {
if (unlockOnComponentMount) {
const storageIsEncrypted = await isStorageEncrypted();
dispatch({ type: SET_IS_STORAGE_ENCRYPTED_ENABLED, payload: storageIsEncrypted });
const isBiometricUseCapableAndEnabled = await Biometric.isBiometricUseCapableAndEnabled();
const rawType = isBiometricUseCapableAndEnabled ? await Biometric.biometricType() : undefined;
dispatch({ type: SET_BIOMETRIC_TYPE, payload: rawType });
if (!rawType || storageIsEncrypted) {
dispatch({ type: SET_IS_STORAGE_ENCRYPTED_ENABLED, payload: storageIsEncrypted });
unlockWithKey();
} else {
dispatch({ type: SET_BIOMETRIC_TYPE, payload: rawType });
unlockWithBiometrics();
}
}