Skip to content

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

fix privacy screen not working in strict app lock mode

ammarahm-ed6a8d5130920f
diff --git a/apps/mobile/AppRootEvents.js b/apps/mobile/AppRootEvents.js
index 38a5c9cf2..27e4dcc89 100644
--- a/apps/mobile/AppRootEvents.js
+++ b/apps/mobile/AppRootEvents.js
@@ -20,7 +20,7 @@ import Navigation from './src/services/Navigation';
import PremiumService from './src/services/PremiumService';
import SettingsService from './src/services/SettingsService';
import Sync from './src/services/Sync';
-import {APP_VERSION, editing} from './src/utils';
+import {AndroidModule, APP_VERSION, editing} from './src/utils';
import {COLOR_SCHEME, updateStatusBarColor} from './src/utils/Colors';
import {db} from './src/utils/DB';
import {
@@ -86,7 +86,7 @@ const onAppStateChanged = async (state) => {
updateStatusBarColor();
if (
SettingsService.get().privacyScreen ||
- SettingsService.get().appLockMode !== 'none'
+ SettingsService.get().appLockMode === 'background'
) {
enabled(false);
SplashScreen.show();
@@ -106,13 +106,17 @@ const onAppStateChanged = async (state) => {
await MMKV.removeItem('appState');
}
} else {
- if (getNote()?.locked && SettingsService.get().appLockMode === 'none') {
+ if (
+ getNote()?.locked &&
+ SettingsService.get().appLockMode === 'background'
+ ) {
eSendEvent(eClearEditor);
}
await storeAppState();
+
if (
SettingsService.get().privacyScreen ||
- SettingsService.get().appLockMode !== 'none'
+ SettingsService.get().appLockMode === 'background'
) {
enabled(true);
}
diff --git a/apps/mobile/src/services/SettingsService.js b/apps/mobile/src/services/SettingsService.js
index 3feab9597..eef914f35 100644
--- a/apps/mobile/src/services/SettingsService.js
+++ b/apps/mobile/src/services/SettingsService.js
@@ -44,7 +44,7 @@ async function init() {
if (settings.fontScale) {
scale.fontScale = settings.fontScale;
}
- if (settings.privacyScreen) {
+ if (settings.privacyScreen || settings.appLockMode === "background") {
if (Platform.OS === 'android') {
AndroidModule.setSecureMode(true);
} else {
diff --git a/apps/mobile/src/views/Settings/index.js b/apps/mobile/src/views/Settings/index.js
index 6b875327e..346b93439 100644
--- a/apps/mobile/src/views/Settings/index.js
+++ b/apps/mobile/src/views/Settings/index.js
@@ -1167,10 +1167,7 @@ const SettingsPrivacyAndSecurity = () => {
title="App lock"
tagline="Require biometrics to access your notes."
onPress={() => {
- Platform.OS === 'android'
- ? AndroidModule.setSecureMode(!settings.privacyScreen)
- : enabled(true);
- setSetting(settings, 'privacyScreen', !settings.privacyScreen);
+ setAppLockVisible(true);
}}
maxWidth="90%"
/>