Skip to content

Commit 0b2f246

Browse files
authored
fix: safe biometry state (#613)
* fix: safe biometry state management * fix: changes * fix: changes
1 parent f4279de commit 0b2f246

File tree

4 files changed

+15
-4
lines changed

4 files changed

+15
-4
lines changed

src/screens/PinScreen.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ import {
2626
resetOnLockScreen,
2727
onExceptionCaptured,
2828
} from '../actions';
29-
import { PIN_SIZE } from '../constants';
29+
import { PIN_SIZE, SAFE_BIOMETRY_MODE_FEATURE_TOGGLE } from '../constants';
3030
import { COLORS } from '../styles/themes';
3131
import { STORE } from '../store';
3232
import baseStyle from '../styles/init';
@@ -43,7 +43,7 @@ const log = logger('PIN_SCREEN');
4343
const mapStateToProps = (state) => ({
4444
loadHistoryActive: state.loadHistoryStatus.active,
4545
wallet: state.wallet,
46-
safeBiometryEnabled: state.safeBiometryEnabled,
46+
safeBiometryEnabled: state.featureToggles[SAFE_BIOMETRY_MODE_FEATURE_TOGGLE],
4747
});
4848

4949
const mapDispatchToProps = (dispatch) => ({

src/screens/Security.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,11 @@ import { HathorList, ListItem, ListMenu } from '../components/HathorList';
2323
import { lockScreen, onExceptionCaptured } from '../actions';
2424
import { COLORS } from '../styles/themes';
2525
import { STORE } from '../store';
26+
import { SAFE_BIOMETRY_MODE_FEATURE_TOGGLE } from '../constants';
2627

2728
const mapStateToProps = (state) => ({
2829
wallet: state.wallet,
29-
safeBiometryEnabled: state.safeBiometryEnabled,
30+
safeBiometryEnabled: state.featureToggles[SAFE_BIOMETRY_MODE_FEATURE_TOGGLE],
3031
});
3132

3233
const mapDispatchToProps = (dispatch) => ({

src/store.js

+10
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,12 @@ export const walletKeys = [
2525
REGISTERED_NANO_CONTRACTS_KEY,
2626
];
2727

28+
export const cleanOnWalletReset = [
29+
PIN_BACKUP_KEY,
30+
IS_BIOMETRY_ENABLED_KEY,
31+
IS_OLD_BIOMETRY_ENABLED_KEY,
32+
];
33+
2834
/* eslint-disable class-methods-use-this */
2935
/**
3036
* The hybrid store will use the mobile native AsyncStorage to persist data and
@@ -280,6 +286,10 @@ class AsyncStorageStore {
280286
}
281287
// This will delete any wallet data of the legacy storage
282288
await this.clearItems(true);
289+
AsyncStorage.multiRemove(cleanOnWalletReset);
290+
for (const key of cleanOnWalletReset) {
291+
delete this.hathorMemoryStorage[key];
292+
}
283293
}
284294

285295
/**

src/utils.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ export const getTokenLabel = (token) => `${token.name} (${token.symbol})`;
9696
*
9797
* @param {string} currentPassword
9898
* @param {bool} safeBiometryEnabled
99-
* @return {string} The actual pin/password for the application.
99+
* @return {Promise<string>} The actual pin/password for the application.
100100
*/
101101
export async function biometricsMigration(currentPassword, safeBiometryEnabled) {
102102
const oldBiometry = STORE.getItem(IS_OLD_BIOMETRY_ENABLED_KEY);

0 commit comments

Comments
 (0)