FIX: Biometrics listener release for some Android devices.

This commit is contained in:
Marcos Rodriguez Vélez 2020-09-24 08:50:51 -04:00 committed by Overtorment
parent 08bfecd8ce
commit 6f1f0326e4

View File

@ -59,12 +59,12 @@ export default class Biometric {
static async unlockWithBiometrics() {
const isDeviceBiometricCapable = await Biometric.isDeviceBiometricCapable();
if (isDeviceBiometricCapable) {
try {
const isConfirmed = await FingerprintScanner.authenticate({ description: 'Please confirm your identity.', fallbackEnabled: true });
return isConfirmed;
} catch (_e) {
return false;
}
return new Promise(resolve => {
FingerprintScanner.authenticate({ description: 'Please confirm your identity.', fallbackEnabled: true })
.then(() => resolve(true))
.catch(() => resolve(false))
.finally(() => FingerprintScanner.release());
});
}
return false;
}