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 //@ts-ignore
await FingerprintScanner.authenticate(options); await FingerprintScanner.authenticate(options);
setTimeout(() => {
useSettingStore.getState().setRequestBiometrics(false);
}, 1000);
FingerprintScanner.release(); FingerprintScanner.release();
return await Keychain.getInternetCredentials('nn_vault'); return await Keychain.getInternetCredentials('nn_vault');
} catch (e) { } catch (e) {

View File

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