diff --git a/app/utils/localAuthentication.js b/app/utils/localAuthentication.js index eb0a21f71..a0a151603 100644 --- a/app/utils/localAuthentication.js +++ b/app/utils/localAuthentication.js @@ -57,16 +57,26 @@ export const localAuthenticate = async(server) => { // Make sure splash screen has been hidden RNBootSplash.hide(); - const isEnrolled = await LocalAuthentication.isEnrolledAsync(); - const isSupported = await LocalAuthentication.supportedAuthenticationTypesAsync(); + // if biometry is enabled on the app + if (serverRecord?.biometry) { + const isEnrolled = await LocalAuthentication.isEnrolledAsync(); + const isSupported = await LocalAuthentication.supportedAuthenticationTypesAsync(); - // if biometry is enabled and enrolled on OS - if (isEnrolled && isSupported) { - // opens biometry prompt - const authResult = await LocalAuthentication.authenticateAsync({ disableDeviceFallback: true }); - if (authResult?.success) { - await resetAttempts(); - await saveLastLocalAuthenticationSession(server, serverRecord); + // if biometry is enabled and enrolled on OS + if (isEnrolled && isSupported?.length) { + // opens biometry prompt + let authResult; + try { + authResult = await LocalAuthentication.authenticateAsync({ disableDeviceFallback: true }); + } catch (e) { + // Do nothing + } + if (authResult?.success) { + await resetAttempts(); + await saveLastLocalAuthenticationSession(server, serverRecord); + } else { + await localPasscode(); + } } else { await localPasscode(); } diff --git a/app/views/ScreenLockConfigView.js b/app/views/ScreenLockConfigView.js index 9bed4dedd..2fff37e37 100644 --- a/app/views/ScreenLockConfigView.js +++ b/app/views/ScreenLockConfigView.js @@ -83,7 +83,7 @@ class ScreenLockConfigView extends React.Component { this.setState({ autoLock: this.serverRecord?.autoLock, autoLockTime: this.serverRecord?.autoLockTime || 1800, - biometry: this.serverRecord?.biometry || true + biometry: this.serverRecord.biometry === null ? true : this.serverRecord.biometry }); } catch (error) { // Do nothing @@ -100,7 +100,7 @@ class ScreenLockConfigView extends React.Component { await this.serverRecord?.update((record) => { record.autoLock = autoLock; record.autoLockTime = autoLockTime; - record.biometry = biometry; + record.biometry = biometry === null ? true : biometry; }); }); }