Skip to content

A fully open source & end-to-end encrypted note taking alternative to Evernote.

fix app lock not showing password input

ammarahm-ed94694a14b6e6
diff --git a/apps/mobile/App.js b/apps/mobile/App.js
index 9cdcf483c..84dc5cf94 100644
--- a/apps/mobile/App.js
+++ b/apps/mobile/App.js
@@ -122,6 +122,7 @@ const App = () => {
setVerifyUser(true);
}
await loadDatabase();
+ useUserStore.getState().setUser(await db.user.getUser());
if (SettingsService.get().telemetry) {
Tracker.record('50bf361f-dba0-41f1-9570-93906249a6d3');
}
diff --git a/apps/mobile/AppRootEvents.js b/apps/mobile/AppRootEvents.js
index bb801f615..76adf6574 100644
--- a/apps/mobile/AppRootEvents.js
+++ b/apps/mobile/AppRootEvents.js
@@ -337,6 +337,7 @@ export const AppRootEvents = React.memo(
const setCurrentUser = async login => {
try {
let user = await db.user.getUser();
+ console.log(user,'called user set current');
if ((await MMKV.getItem('loginSessionHasExpired')) === 'expired') {
setUser(user);
return;
diff --git a/apps/mobile/src/components/AppLoader/index.js b/apps/mobile/src/components/AppLoader/index.js
index b215f1c16..7c54e7b22 100644
--- a/apps/mobile/src/components/AppLoader/index.js
+++ b/apps/mobile/src/components/AppLoader/index.js
@@ -15,7 +15,8 @@ import {DDS} from '../../services/DeviceDetection';
import {
eSendEvent,
eSubscribeEvent,
- eUnSubscribeEvent
+ eUnSubscribeEvent,
+ ToastEvent
} from '../../services/EventManager';
import {editing} from '../../utils';
import {db} from '../../utils/DB';
@@ -112,8 +113,8 @@ const AppLoader = ({onLoad}) => {
let askForBackup = await MMKV.getItem('askForBackup');
if (
- (settingsStore.settings.reminder === 'off' ||
- !settingsStore.settings.reminder)
+ settingsStore.settings.reminder === 'off' ||
+ !settingsStore.settings.reminder
) {
askForBackup = JSON.parse(askForBackup);
@@ -148,6 +149,13 @@ const AppLoader = ({onLoad}) => {
}, [verifyUser]);
const onUnlockBiometrics = async () => {
+ if (!(await BiometricService.isBiometryAvailable())) {
+ ToastEvent.show({
+ heading: 'Biometrics unavailable',
+ message: 'Try unlocking the app with your account password'
+ });
+ return;
+ }
let verified = await BiometricService.validateUser(
'Unlock to access your notes',
''
@@ -206,6 +214,7 @@ const AppLoader = ({onLoad}) => {
To keep your notes secure, please enter password of the
account you are logged in to.
</Paragraph>
+ <Seperator half />
<Input
secureTextEntry
placeholder="Enter account password"
diff --git a/apps/mobile/src/views/Settings/index.js b/apps/mobile/src/views/Settings/index.js
index c9a339759..02318c1a7 100644
--- a/apps/mobile/src/views/Settings/index.js
+++ b/apps/mobile/src/views/Settings/index.js
@@ -1359,7 +1359,7 @@ const SettingsPrivacyAndSecurity = () => {
const settings = useSettingStore(state => state.settings);
const [collapsed, setCollapsed] = useState(true);
const [appLockVisible, setAppLockVisible] = useState(false);
-
+ const user = useUserStore(state => state.user);
const [vaultStatus, setVaultStatus] = React.useState({
exists: false,
biometryEnrolled: false,
@@ -1371,7 +1371,7 @@ const SettingsPrivacyAndSecurity = () => {
db.vault.exists().then(async r => {
let available = await BiometricService.isBiometryAvailable();
let fingerprint = await BiometricService.hasInternetCredentials();
-
+ console.log(available);
setVaultStatus({
exists: r,
biometryEnrolled: fingerprint,
@@ -1379,7 +1379,7 @@ const SettingsPrivacyAndSecurity = () => {
});
});
});
- });
+ }, [collapsed]);
useEffect(() => {
checkVaultStatus();
@@ -1387,7 +1387,7 @@ const SettingsPrivacyAndSecurity = () => {
return () => {
eUnSubscribeEvent('vaultUpdated', () => checkVaultStatus());
};
- }, []);
+ }, [collapsed]);
const modes = [
{
@@ -1545,7 +1545,7 @@ const SettingsPrivacyAndSecurity = () => {
}
/>
- {vaultStatus.isBiometryAvailable && (
+ {user || vaultStatus.isBiometryAvailable ? (
<CustomButton
key="appLock"
title="App lock"
@@ -1555,7 +1555,7 @@ const SettingsPrivacyAndSecurity = () => {
}}
maxWidth="90%"
/>
- )}
+ ) : null}
{vaultStatus.exists ? (
<>