Merge pull request #6162 from BlueWallet/dispatch

FIX: dispatch UI for biometrics was firing regardless
This commit is contained in:
GLaDOS 2024-02-20 23:30:20 +00:00 committed by GitHub
commit d3fc52f01c
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

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();
}
}