diff --git a/Navigation.tsx b/Navigation.tsx index a26a32f12..009ed9ed4 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/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.", diff --git a/UnlockWith.tsx b/screen/UnlockWith.tsx similarity index 84% rename from UnlockWith.tsx rename to screen/UnlockWith.tsx index b276e1e00..3d8b90649 100644 --- a/UnlockWith.tsx +++ b/screen/UnlockWith.tsx @@ -1,15 +1,18 @@ 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 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(); @@ -129,7 +135,7 @@ const UnlockWith: React.FC = () => { return ( @@ -142,6 +148,8 @@ const UnlockWith: React.FC = () => { ); + case AuthType.BiometricsUnavailable: + return {loc.settings.biometrics_no_longer_available}; default: return null; } @@ -151,7 +159,7 @@ const UnlockWith: React.FC = () => { return ( - + {renderUnlockOptions()} @@ -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,