fix applock does not work after unlocking note from vault

This commit is contained in:
ammarahm-ed
2022-08-08 12:57:42 +05:00
parent 75e6471998
commit 673f4b4392
2 changed files with 10 additions and 10 deletions

View File

@@ -59,6 +59,9 @@ async function getCredentials(title?: string, description?: string) {
});
//@ts-ignore
await FingerprintScanner.authenticate(options);
setTimeout(() => {
useSettingStore.getState().setRequestBiometrics(false);
}, 1000);
FingerprintScanner.release();
return await Keychain.getInternetCredentials('nn_vault');
} catch (e) {

View File

@@ -324,14 +324,11 @@ export const useAppEvents = () => {
}
if (SettingsService.get().appLockMode === 'background') {
if (useSettingStore.getState().requestBiometrics) {
console.log('requesting biometrics');
useSettingStore.getState().setRequestBiometrics(false);
return;
}
}
refValues.current.prevState = 'active';
await reconnectSSE();
await checkIntentState();
MMKV.removeItem('appState');
@@ -345,25 +342,25 @@ export const useAppEvents = () => {
} catch (e) {}
}
} else {
refValues.current.prevState = 'background';
let id = useEditorStore.getState().currentEditingNote;
let note = id && db.notes.note(id).data;
if (note?.locked && SettingsService.get().appLockMode === 'background') {
eSendEvent(eClearEditor);
}
await storeAppState();
if (
SettingsService.get().appLockMode === 'background' &&
!useSettingStore.getState().requestBiometrics &&
!useUserStore.getState().verifyUser
) {
useUserStore.getState().setVerifyUser(true);
}
if (
SettingsService.get().privacyScreen ||
SettingsService.get().appLockMode === 'background'
) {
!useSettingStore.getState().requestBiometrics ? enabled(true) : null;
}
if (
SettingsService.get().appLockMode === 'background' &&
!useSettingStore.getState().requestBiometrics
) {
useUserStore.getState().setVerifyUser(true);
}
}
};