Skip to content

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

fix bugs

ammarahm-ed4cb1e74bd93f
diff --git a/apps/mobile/src/components/AppLoader/index.js b/apps/mobile/src/components/AppLoader/index.js
index ce39e191b..aedfa574c 100644
--- a/apps/mobile/src/components/AppLoader/index.js
+++ b/apps/mobile/src/components/AppLoader/index.js
@@ -1,5 +1,6 @@
import React, { useEffect, useRef, useState } from 'react';
import { Appearance, NativeModules, Platform, SafeAreaView } from 'react-native';
+import { NavigationBar } from 'react-native-bars';
import RNBootSplash from 'react-native-bootsplash';
import { checkVersion } from 'react-native-check-version';
import Animated from 'react-native-reanimated';
diff --git a/apps/mobile/src/navigation/RootView.js b/apps/mobile/src/navigation/RootView.js
index afed5295f..136a95062 100644
--- a/apps/mobile/src/navigation/RootView.js
+++ b/apps/mobile/src/navigation/RootView.js
@@ -1,8 +1,9 @@
import { activateKeepAwake, deactivateKeepAwake } from '@sayem314/react-native-keep-awake';
import React, { useEffect, useRef } from 'react';
-import { View } from 'react-native';
+import { Platform, View } from 'react-native';
import { StatusBar } from 'react-native-bars';
import Animated, { useValue } from 'react-native-reanimated';
+import { useSafeAreaInsets } from 'react-native-safe-area-context';
import { notesnook } from '../../e2e/test.ids';
import CustomTabs from '../components/CustomTabs';
import { DialogManager } from '../components/DialogManager';
@@ -91,6 +92,7 @@ const NativeStack = React.memo(
const setDeviceModeState = useSettingStore(state => state.setDeviceMode);
const dimensions = useSettingStore(state => state.dimensions);
const setDimensions = useSettingStore(state => state.setDimensions);
+ const insets = useSafeAreaInsets();
const animatedOpacity = useValue(0);
const animatedTranslateY = useValue(-9999);
const overlayRef = useRef();
@@ -336,7 +338,8 @@ const NativeStack = React.memo(
style={{
width: '100%',
height: '100%',
- backgroundColor: colors.bg
+ backgroundColor: colors.bg,
+ paddingBottom: Platform.OS === 'android' ? insets?.bottom : 0
}}
>
<StatusBar animated={true} barStyle={colors.night ? 'light-content' : 'dark-content'} />
diff --git a/apps/mobile/src/utils/useAppEvents.js b/apps/mobile/src/utils/useAppEvents.js
index 8e03d890c..ddf1b9a45 100644
--- a/apps/mobile/src/utils/useAppEvents.js
+++ b/apps/mobile/src/utils/useAppEvents.js
@@ -427,10 +427,8 @@ export const useAppEvents = () => {
let result = await BiometricService.validateUser('Unlock to access your notes');
if (result) {
+ useUserStore.getState().setVerifyUser(false);
refValues.current.showingDialog = false;
- } else {
- RNExitApp.exitApp();
- return;
}
}
}
diff --git a/apps/mobile/src/views/Settings/applock.js b/apps/mobile/src/views/Settings/applock.js
index 139a56d32..2fa5c894d 100644
--- a/apps/mobile/src/views/Settings/applock.js
+++ b/apps/mobile/src/views/Settings/applock.js
@@ -17,7 +17,7 @@ import { Button } from '../../components/Button';
import { getElevation } from '../../utils';
import umami from '../../utils/umami';
-const AppLock = welcome => {
+const AppLock = ({ welcome }) => {
const [state] = useTracked();
const { colors } = state;
const settings = useSettingStore(state => state.settings);
diff --git a/apps/mobile/src/views/Settings/privacy.js b/apps/mobile/src/views/Settings/privacy.js
index a37e8833c..1619545fe 100644
--- a/apps/mobile/src/views/Settings/privacy.js
+++ b/apps/mobile/src/views/Settings/privacy.js
@@ -1,15 +1,7 @@
import React, { useCallback, useEffect, useState } from 'react';
-import { Platform, View } from 'react-native';
+import { Platform } from 'react-native';
import { enabled } from 'react-native-privacy-snapshot';
import ToggleSwitch from 'toggle-switch-react-native';
-import BaseDialog from '../../components/Dialog/base-dialog';
-import DialogButtons from '../../components/Dialog/dialog-buttons';
-import DialogContainer from '../../components/Dialog/dialog-container';
-import DialogHeader from '../../components/Dialog/dialog-header';
-import { PressableButton } from '../../components/PressableButton';
-import Seperator from '../../components/Seperator';
-import Heading from '../../components/Typography/Heading';
-import Paragraph from '../../components/Typography/Paragraph';
import { useTracked } from '../../provider';
import { useSettingStore, useUserStore } from '../../provider/stores';
import BiometricService from '../../services/BiometricService';
@@ -18,7 +10,7 @@ import PremiumService from '../../services/PremiumService';
import SettingsService from '../../services/SettingsService';
import { AndroidModule, InteractionManager } from '../../utils';
import { db } from '../../utils/database';
-import { SIZE } from '../../utils/SizeUtils';
+import AppLock from './app-lock';
import { CustomButton } from './button';
import SectionHeader from './section-header';
@@ -27,7 +19,6 @@ const SettingsPrivacyAndSecurity = () => {
const { colors } = state;
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,
@@ -58,24 +49,6 @@ const SettingsPrivacyAndSecurity = () => {
};
}, [collapsed]);
- const modes = [
- {
- title: 'None',
- value: 'none',
- desc: 'Disable app lock. Notes can be accessed by anyone who opens the app'
- },
- {
- title: 'Secure Mode',
- value: 'launch',
- desc: 'Locks app on launch and keeps it unlocked when you switch to other apps.'
- },
- {
- title: 'Strict Mode',
- value: 'background',
- desc: 'Locks app on launch and also when you switch from other apps or background.'
- }
- ];
-
const toggleBiometricUnlocking = () => {
openVault({
item: {},
@@ -93,72 +66,6 @@ const SettingsPrivacyAndSecurity = () => {
return (
<>
- {appLockVisible && (
- <BaseDialog
- onRequestClose={() => {
- setAppLockVisible(false);
- }}
- visible={true}
- >
- <DialogContainer height={450}>
- <DialogHeader
- title="App lock mode"
- paragraph="Select the level of security you want to enable."
- padding={12}
- />
- <Seperator />
- <View
- style={{
- paddingHorizontal: 12
- }}
- >
- {modes.map(item => (
- <PressableButton
- key={item.title}
- type={settings.appLockMode === item.value ? 'grayBg' : 'transparent'}
- onPress={() => {
- SettingsService.set('appLockMode', item.value);
- }}
- customStyle={{
- justifyContent: 'flex-start',
- alignItems: 'flex-start',
- paddingHorizontal: 6,
- paddingVertical: 6,
- marginTop: 3,
- marginBottom: 3
- }}
- style={{
- marginBottom: 10
- }}
- >
- <Heading
- color={settings.appLockMode === item.value ? colors.accent : colors.pri}
- style={{ maxWidth: '95%' }}
- size={SIZE.md}
- >
- {item.title}
- </Heading>
- <Paragraph
- color={settings.appLockMode === item.value ? colors.accent : colors.icon}
- style={{ maxWidth: '95%' }}
- size={SIZE.sm}
- >
- {item.desc}
- </Paragraph>
- </PressableButton>
- ))}
- </View>
-
- <DialogButtons
- negativeTitle="Done"
- onPressNegative={() => {
- setAppLockVisible(false);
- }}
- />
- </DialogContainer>
- </BaseDialog>
- )}
-
<SectionHeader collapsed={collapsed} setCollapsed={setCollapsed} title="Privacy & security" />
{collapsed ? null : (
<>
@@ -217,7 +124,7 @@ const SettingsPrivacyAndSecurity = () => {
title="App lock"
tagline="Require biometrics to access your notes."
onPress={() => {
- setAppLockVisible(true);
+ AppLock.present();
}}
maxWidth="90%"
/>