Skip to content

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

fixed locked note opened on app launch

ammarahm-ed529d80673c18
diff --git a/apps/mobile/AppRootEvents.js b/apps/mobile/AppRootEvents.js
index c14bde11b..eb9206031 100644
--- a/apps/mobile/AppRootEvents.js
+++ b/apps/mobile/AppRootEvents.js
@@ -50,6 +50,7 @@ let subsriptionErrorListener;
let isUserReady = false;
async function storeAppState() {
if (editing.currentlyEditing) {
+ if (getNote().locked) return;
let state = JSON.stringify({
editing: editing.currentlyEditing,
note: getNote(),
diff --git a/apps/mobile/src/components/AppLoader/index.js b/apps/mobile/src/components/AppLoader/index.js
index e5173ed10..dbddcf60a 100644
--- a/apps/mobile/src/components/AppLoader/index.js
+++ b/apps/mobile/src/components/AppLoader/index.js
@@ -54,11 +54,13 @@ const AppLoader = ({onLoad}) => {
appState = JSON.parse(appState);
if (
appState.note &&
+ !appState.note.locked &&
!appState.movedAway &&
Date.now() < appState.timestamp + 3600000
) {
editing.isRestoringState = true;
editing.currentlyEditing = true;
+ editing.movedAway = false;
if (!DDS.isTab) {
tabBarRef.current?.goToPage(1);
}
diff --git a/apps/mobile/src/components/CustomTabs/index.js b/apps/mobile/src/components/CustomTabs/index.js
index d257d5b67..59a191d80 100644
--- a/apps/mobile/src/components/CustomTabs/index.js
+++ b/apps/mobile/src/components/CustomTabs/index.js
@@ -236,7 +236,7 @@ export default class CustomTabs extends Component {
this.props.offsets.c,
]}
contentOffset={{
- x: this.props.offsets.a,
+ x: editing.movedAway ? this.props.offsets.a : this.props.offsets.b,
}}
data={['drawer', 'navigation', 'editor']}
renderItem={this.renderItem}
diff --git a/apps/mobile/src/views/Editor/Functions.js b/apps/mobile/src/views/Editor/Functions.js
index c77aeac22..f8689fee5 100644
--- a/apps/mobile/src/views/Editor/Functions.js
+++ b/apps/mobile/src/views/Editor/Functions.js
@@ -504,7 +504,7 @@ export async function saveNote(preventUpdate) {
if (id) {
let _note = db.notes.note(id).data;
if (_note.conflicted) {
- presentResolveConflictDialog(_note)
+ presentResolveConflictDialog(_note);
return;
}
locked = _note.locked;
@@ -570,10 +570,10 @@ async function restoreEditorState() {
if (
appState.editing &&
appState.note &&
+ !appState.note.locked &&
appState.note.id &&
Date.now() < appState.timestamp + 3600000
) {
- console.log('restoring state');
editing.isRestoringState = true;
eSendEvent('loadingNote', appState.note);
editing.currentlyEditing = true;
@@ -595,7 +595,7 @@ async function restoreEditorState() {
editing.isRestoringState = false;
}
-const presentResolveConflictDialog = (_note) => {
+const presentResolveConflictDialog = _note => {
presentDialog({
title: 'Changes not saved',
paragraph: 'Please resolve conflicts to save changes',
@@ -604,13 +604,13 @@ const presentResolveConflictDialog = (_note) => {
eSendEvent(eShowMergeDialog, _note);
},
});
-}
+};
export async function updateNoteInEditor() {
- console.log('updating note in editor')
+ console.log('updating note in editor');
let _note = db.notes.note(id).data;
if (_note.conflicted) {
- presentResolveConflictDialog(_note)
+ presentResolveConflictDialog(_note);
return;
}
tiny.call(EditorWebView, tiny.isLoading);