From b3279cdef735d4ff74fd6b489c56cf8dc27e2e66 Mon Sep 17 00:00:00 2001 From: Marcos Rodriguez Velez Date: Sun, 10 Mar 2024 20:23:58 -0400 Subject: [PATCH 1/2] ADD: Re-enable biometrics to unlock --- UnlockWith.tsx | 13 +++++++++++-- loc/en.json | 1 + 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/UnlockWith.tsx b/UnlockWith.tsx index b276e1e00..f9f1926d4 100644 --- a/UnlockWith.tsx +++ b/UnlockWith.tsx @@ -5,11 +5,14 @@ import Biometric, { BiometricType } from './class/biometrics'; import { BlueStorageContext } from './blue_modules/storage-context'; import triggerHapticFeedback, { HapticFeedbackTypes } from './blue_modules/hapticFeedback'; import SafeArea from './components/SafeArea'; +import { BlueTextCentered } from './BlueComponents'; +import loc from './loc'; enum AuthType { Encrypted, Biometrics, None, + BiometricsUnavailable, } type State = { @@ -95,6 +98,7 @@ const UnlockWith: React.FC = () => { const storageIsEncrypted = await isStorageEncrypted(); const isBiometricUseCapableAndEnabled = await Biometric.isBiometricUseCapableAndEnabled(); const biometricType = isBiometricUseCapableAndEnabled ? await Biometric.biometricType() : undefined; + const biometricsUseEnabled = await Biometric.isBiometricUseEnabled(); if (storageIsEncrypted) { dispatch({ type: SET_AUTH, payload: { type: AuthType.Encrypted, detail: undefined } }); @@ -102,6 +106,8 @@ const UnlockWith: React.FC = () => { } else if (isBiometricUseCapableAndEnabled) { dispatch({ type: SET_AUTH, payload: { type: AuthType.Biometrics, detail: biometricType } }); unlockWithBiometrics(); + } else if (biometricsUseEnabled && biometricType === undefined) { + dispatch({ type: SET_AUTH, payload: { type: AuthType.BiometricsUnavailable, detail: undefined } }); } else { dispatch({ type: SET_AUTH, payload: { type: AuthType.None, detail: undefined } }); unlockWithKey(); @@ -142,6 +148,8 @@ const UnlockWith: React.FC = () => { ); + case AuthType.BiometricsUnavailable: + return {loc.settings.biometrics_no_longer_available}; default: return null; } @@ -171,10 +179,11 @@ const styles = StyleSheet.create({ biometricRow: { justifyContent: 'center', flexDirection: 'row', - width: 64, - height: 64, + minWidth: 64, + minHeight: 64, alignSelf: 'center', marginBottom: 20, + paddingHorizontal: 20, }, icon: { width: 64, diff --git a/loc/en.json b/loc/en.json index 94ced7c91..8dbfd4d0a 100644 --- a/loc/en.json +++ b/loc/en.json @@ -230,6 +230,7 @@ "about_sm_twitter": "Follow us on Twitter", "advanced_options": "Advanced Options", "biometrics": "Biometrics", + "biometrics_no_longer_available": "Your device settings have changed and no longer match the selected security settings in the app. Please re-enable biometrics or passcode, then restart the app to apply these changes.", "biom_10times": "You have attempted to enter your password 10 times. Would you like to reset your storage? This will remove all wallets and decrypt your storage.", "biom_conf_identity": "Please confirm your identity.", "biom_no_passcode": "Your device does not have a passcode. In order to proceed, please configure a passcode in the Settings app.", From f74a4320f3e45ed5ef3e918996279212f837cf3d Mon Sep 17 00:00:00 2001 From: Marcos Rodriguez Velez Date: Sun, 10 Mar 2024 20:29:37 -0400 Subject: [PATCH 2/2] REF: Move file to screen folder --- Navigation.tsx | 2 +- UnlockWith.tsx => screen/UnlockWith.tsx | 16 ++++++++-------- 2 files changed, 9 insertions(+), 9 deletions(-) rename UnlockWith.tsx => screen/UnlockWith.tsx (91%) diff --git a/Navigation.tsx b/Navigation.tsx index 512c59c51..219c3ae5e 100644 --- a/Navigation.tsx +++ b/Navigation.tsx @@ -66,7 +66,7 @@ import PsbtMultisigQRCode from './screen/send/psbtMultisigQRCode'; import PsbtWithHardwareWallet from './screen/send/psbtWithHardwareWallet'; import Success from './screen/send/success'; -import UnlockWith from './UnlockWith'; +import UnlockWith from './screen/UnlockWith'; import { isDesktop, isHandset, isTablet } from './blue_modules/environment'; import navigationStyle from './components/navigationStyle'; import { useTheme } from './components/themes'; diff --git a/UnlockWith.tsx b/screen/UnlockWith.tsx similarity index 91% rename from UnlockWith.tsx rename to screen/UnlockWith.tsx index f9f1926d4..3d8b90649 100644 --- a/UnlockWith.tsx +++ b/screen/UnlockWith.tsx @@ -1,12 +1,12 @@ import React, { useCallback, useContext, useEffect, useReducer, useRef } from 'react'; import { View, Image, TouchableOpacity, ActivityIndicator, useColorScheme, NativeModules, StyleSheet } from 'react-native'; import { Icon } from 'react-native-elements'; -import Biometric, { BiometricType } from './class/biometrics'; -import { BlueStorageContext } from './blue_modules/storage-context'; -import triggerHapticFeedback, { HapticFeedbackTypes } from './blue_modules/hapticFeedback'; -import SafeArea from './components/SafeArea'; -import { BlueTextCentered } from './BlueComponents'; -import loc from './loc'; +import Biometric, { BiometricType } from '../class/biometrics'; +import { BlueStorageContext } from '../blue_modules/storage-context'; +import triggerHapticFeedback, { HapticFeedbackTypes } from '../blue_modules/hapticFeedback'; +import SafeArea from '../components/SafeArea'; +import { BlueTextCentered } from '../BlueComponents'; +import loc from '../loc'; enum AuthType { Encrypted, @@ -135,7 +135,7 @@ const UnlockWith: React.FC = () => { return ( @@ -159,7 +159,7 @@ const UnlockWith: React.FC = () => { return ( - + {renderUnlockOptions()}