diff --git a/src/screens/PinScreen.js b/src/screens/PinScreen.js index ceed971a5..76a6546ba 100644 --- a/src/screens/PinScreen.js +++ b/src/screens/PinScreen.js @@ -26,7 +26,7 @@ import { resetOnLockScreen, onExceptionCaptured, } from '../actions'; -import { PIN_SIZE } from '../constants'; +import { PIN_SIZE, SAFE_BIOMETRY_MODE_FEATURE_TOGGLE } from '../constants'; import { COLORS } from '../styles/themes'; import { STORE } from '../store'; import baseStyle from '../styles/init'; @@ -43,7 +43,7 @@ const log = logger('PIN_SCREEN'); const mapStateToProps = (state) => ({ loadHistoryActive: state.loadHistoryStatus.active, wallet: state.wallet, - safeBiometryEnabled: state.safeBiometryEnabled, + safeBiometryEnabled: state.featureToggles[SAFE_BIOMETRY_MODE_FEATURE_TOGGLE], }); const mapDispatchToProps = (dispatch) => ({ diff --git a/src/screens/Security.js b/src/screens/Security.js index 55c46a9e0..c2e38c505 100644 --- a/src/screens/Security.js +++ b/src/screens/Security.js @@ -23,10 +23,11 @@ import { HathorList, ListItem, ListMenu } from '../components/HathorList'; import { lockScreen, onExceptionCaptured } from '../actions'; import { COLORS } from '../styles/themes'; import { STORE } from '../store'; +import { SAFE_BIOMETRY_MODE_FEATURE_TOGGLE } from '../constants'; const mapStateToProps = (state) => ({ wallet: state.wallet, - safeBiometryEnabled: state.safeBiometryEnabled, + safeBiometryEnabled: state.featureToggles[SAFE_BIOMETRY_MODE_FEATURE_TOGGLE], }); const mapDispatchToProps = (dispatch) => ({ diff --git a/src/store.js b/src/store.js index 4935b464d..e04ef712d 100644 --- a/src/store.js +++ b/src/store.js @@ -25,6 +25,12 @@ export const walletKeys = [ REGISTERED_NANO_CONTRACTS_KEY, ]; +export const cleanOnWalletReset = [ + PIN_BACKUP_KEY, + IS_BIOMETRY_ENABLED_KEY, + IS_OLD_BIOMETRY_ENABLED_KEY, +]; + /* eslint-disable class-methods-use-this */ /** * The hybrid store will use the mobile native AsyncStorage to persist data and @@ -280,6 +286,10 @@ class AsyncStorageStore { } // This will delete any wallet data of the legacy storage await this.clearItems(true); + AsyncStorage.multiRemove(cleanOnWalletReset); + for (const key of cleanOnWalletReset) { + delete this.hathorMemoryStorage[key]; + } } /** diff --git a/src/utils.js b/src/utils.js index 3a776a6e0..7e1447d1e 100644 --- a/src/utils.js +++ b/src/utils.js @@ -96,7 +96,7 @@ export const getTokenLabel = (token) => `${token.name} (${token.symbol})`; * * @param {string} currentPassword * @param {bool} safeBiometryEnabled - * @return {string} The actual pin/password for the application. + * @return {Promise} The actual pin/password for the application. */ export async function biometricsMigration(currentPassword, safeBiometryEnabled) { const oldBiometry = STORE.getItem(IS_OLD_BIOMETRY_ENABLED_KEY);