A fully open source & end-to-end encrypted note taking alternative to Evernote.
TypeScript asp-net-coredotnet-coreelectronfosshacktoberfestnote-managmentnote-takingnote-taking-appnotebooknotesnotes-appopen-sourceopensourceprivacyproductivityreactreact-nativereactjsself-hosted
mobile: fix app state
Ammar Ahmed74e3a28e2a85
diff --git a/apps/mobile/app/hooks/use-app-events.tsx b/apps/mobile/app/hooks/use-app-events.tsxindex 5f52e0643..28c634113 100644--- a/apps/mobile/app/hooks/use-app-events.tsx+++ b/apps/mobile/app/hooks/use-app-events.tsx@@ -244,18 +244,16 @@ async function checkForShareExtensionLaunchedInBackground() {}async function saveEditorState() {- if (editorState().currentlyEditing) {+ if (!editorState().movedAway) {const id = useTabStore.getState().getCurrentNoteId();const note = id ? await db.notes.note(id) : undefined;const locked = note && (await db.vaults.itemExists(note));if (locked) return;const state = JSON.stringify({editing: editorState().currentlyEditing,- note: note,movedAway: editorState().movedAway,timestamp: Date.now()});-MMKV.setString("appState", state);} else {MMKV.removeItem("appState");diff --git a/apps/mobile/app/navigation/tabs-holder.js b/apps/mobile/app/navigation/tabs-holder.jsindex 060e25234..0c961ef31 100644--- a/apps/mobile/app/navigation/tabs-holder.js+++ b/apps/mobile/app/navigation/tabs-holder.js@@ -271,9 +271,11 @@ const _TabsHolder = () => {if (!needsUpdate) {return;}- setTimeout(() => {- console.log("movedAway", editorState().movedAway);+ const state = getAppState();+ console.log("MOVED AWAY", state?.movedAway);++ setTimeout(() => {switch (current) {case "tablet":tabBarRef.current?.goToIndex(0, false);@@ -287,7 +289,8 @@ const _TabsHolder = () => {break;case "mobile":if (- !editorState().movedAway &&+ state &&+ !state?.movedAway &&useTabStore.getState().getCurrentNoteId()) {tabBarRef.current?.goToIndex(2, false);