Skip to content

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

fix editor reloading in applock

ammarahm-ed834cf6439060
diff --git a/apps/mobile/src/components/launcher/index.js b/apps/mobile/src/components/launcher/index.js
index fc6c8bd2b..bfd4775f9 100644
--- a/apps/mobile/src/components/launcher/index.js
+++ b/apps/mobile/src/components/launcher/index.js
@@ -2,6 +2,7 @@ import React, { useEffect, useRef } from 'react';
import { Platform, View } from 'react-native';
import RNBootSplash from 'react-native-bootsplash';
import { checkVersion } from 'react-native-check-version';
+import { enabled } from 'react-native-privacy-snapshot';
import { editorState } from '../../screens/editor/tiptap/utils';
import BackupService from '../../services/backup';
import BiometricService from '../../services/biometrics';
@@ -52,14 +53,18 @@ const Launcher = React.memo(
if (verifyUser) {
return;
}
- await restoreEditorState();
+ if (!dbInitCompleted.current) {
+ await restoreEditorState();
+ }
setImmediate(() => {
db.notes.init().then(() => {
Walkthrough.init();
initialize();
setImmediate(() => {
setLoading(false);
- setImmediate(() => doAppLoadActions());
+ if (!dbInitCompleted.current) {
+ setImmediate(() => doAppLoadActions());
+ }
});
});
});
@@ -209,6 +214,7 @@ const Launcher = React.memo(
let verified = await BiometricService.validateUser('Unlock to access your notes', '');
if (verified) {
setVerifyUser(false);
+ enabled(false);
password.current = null;
}
};
@@ -226,6 +232,7 @@ const Launcher = React.memo(
let verified = await db.user.verifyPassword(password.current);
if (verified) {
setVerifyUser(false);
+ enabled(false);
password.current = null;
}
} catch (e) {}
diff --git a/apps/mobile/src/screens/editor/loading.js b/apps/mobile/src/screens/editor/loading.js
index bcaec2883..d7f3cd950 100644
--- a/apps/mobile/src/screens/editor/loading.js
+++ b/apps/mobile/src/screens/editor/loading.js
@@ -1,21 +1,18 @@
import React, { useEffect, useRef, useState } from 'react';
import { View } from 'react-native';
import Animated, { useAnimatedStyle, useSharedValue, withTiming } from 'react-native-reanimated';
+import { useSafeAreaInsets } from 'react-native-safe-area-context';
import { Button } from '../../components/ui/button';
import { IconButton } from '../../components/ui/icon-button';
-import Heading from '../../components/ui/typography/heading';
import Paragraph from '../../components/ui/typography/paragraph';
import { eSendEvent, eSubscribeEvent, eUnSubscribeEvent } from '../../services/event-manager';
import { useThemeStore } from '../../stores/use-theme-store';
import { eClearEditor, eOnLoadNote } from '../../utils/events';
import { SIZE } from '../../utils/size';
-import { timeConverter } from '../../utils/time';
import { editorState } from './tiptap/utils';
-import { useSafeAreaInsets } from 'react-native-safe-area-context';
const EditorOverlay = ({ editorId = '', editor }) => {
const colors = useThemeStore(state => state.colors);
- const [loading, setLoading] = useState(null);
const [error, setError] = useState(false);
const opacity = useSharedValue(1);
const translateValue = useSharedValue(6000);
@@ -38,7 +35,6 @@ const EditorOverlay = ({ editorId = '', editor }) => {
clearTimers();
if (_loading) {
opacity.value = 1;
- setLoading(_loading);
translateValue.value = 0;
timers.current.error = setTimeout(() => {
if (_loading) {
@@ -53,7 +49,6 @@ const EditorOverlay = ({ editorId = '', editor }) => {
setTimeout(() => {
setError(false);
editorState().overlay = false;
- setLoading(null);
opacity.value = withTiming(0, {
duration: 500
});
@@ -70,7 +65,7 @@ const EditorOverlay = ({ editorId = '', editor }) => {
clearTimers();
eUnSubscribeEvent('loadingNote' + editorId, load);
};
- }, [loading, editorId]);
+ }, [editorId]);
const animatedStyle = useAnimatedStyle(() => {
return {
diff --git a/apps/mobile/src/utils/hooks/useAppEvents.js b/apps/mobile/src/utils/hooks/useAppEvents.js
index 1607072b4..1c3c81ced 100644
--- a/apps/mobile/src/utils/hooks/useAppEvents.js
+++ b/apps/mobile/src/utils/hooks/useAppEvents.js
@@ -334,6 +334,7 @@ export const useAppEvents = () => {
let result = await BiometricService.validateUser('Unlock to access your notes');
if (result) {
useUserStore.getState().setVerifyUser(false);
+ enabled(false);
}
}
}
@@ -412,7 +413,6 @@ export const useAppEvents = () => {
}
async function checkIntentState() {
- console.log(checkIntentState, 'CHECK INTENT STATE');
try {
let notesAddedFromIntent = MMKV.getString('notesAddedFromIntent');
let shareExtensionOpened = MMKV.getString('shareExtensionOpened');