Mobile: Fixed biometics prompt on new devices

This commit is contained in:
Laurent Cozic committed 2023-01-05 13:30:09 +00:00
1 parent 1edb345e85
commit 9eff7e6060
1 file changed
+11 -14
@@ -8,29 +8,26 @@ export interface SensorInfo {
}
export default async (): Promise<SensorInfo> => {
const enabled = Setting.value('security.biometricsEnabled');
let hasChanged = false;
let supportedSensors = '';
if (enabled) {
try {
const result = await FingerprintScanner.isSensorAvailable();
supportedSensors = result;
try {
const result = await FingerprintScanner.isSensorAvailable();
supportedSensors = result;
if (result) {
if (result !== Setting.value('security.biometricsSupportedSensors')) {
hasChanged = true;
Setting.setValue('security.biometricsSupportedSensors', result);
}
if (result) {
if (result !== Setting.value('security.biometricsSupportedSensors')) {
hasChanged = true;
Setting.setValue('security.biometricsSupportedSensors', result);
}
} catch (error) {
console.warn('Could not check for biometrics sensor:', error);
Setting.setValue('security.biometricsSupportedSensors', '');
}
} catch (error) {
console.warn('Could not check for biometrics sensor:', error);
Setting.setValue('security.biometricsSupportedSensors', '');
}
return {
enabled,
enabled: Setting.value('security.biometricsEnabled'),
sensorsHaveChanged: hasChanged,
supportedSensors,
};