Skip to content

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

end note editing on swipe if note is locked

ammarahm-ed4ebf35b09de3
diff --git a/apps/mobile/initializer.root.js b/apps/mobile/initializer.root.js
index 5ea5b918c..4aef05e74 100644
--- a/apps/mobile/initializer.root.js
+++ b/apps/mobile/initializer.root.js
@@ -19,6 +19,7 @@ import {
} from './src/services/EventManager';
import {editing, setWidthHeight} from './src/utils';
import {
+ eClearEditor,
eCloseFullscreenEditor,
eCloseSideMenu,
eOnLoadNote,
@@ -27,7 +28,7 @@ import {
} from './src/utils/Events';
import {editorRef, tabBarRef} from './src/utils/Refs';
import {EditorWrapper} from './src/views/Editor/EditorWrapper';
-import {getIntent, getNote, post} from './src/views/Editor/Functions';
+import {clearEditor, getIntent, getNote, post} from './src/views/Editor/Functions';
let {width, height} = Dimensions.get('window');
let movedAway = true;
@@ -39,12 +40,16 @@ const onChangeTab = async (obj) => {
if (getIntent()) return;
movedAway = false;
currentTab = 1;
+
if (!editing.currentlyEditing || !getNote()) {
eSendEvent(eOnLoadNote, {type: 'new'});
editing.currentlyEditing = true;
}
} else {
if (obj.from === 1) {
+ if (getNote()?.locked) {
+ eSendEvent(eClearEditor);
+ }
movedAway = true;
post('blur');
}
diff --git a/apps/mobile/src/views/Editor/EditorHeader.js b/apps/mobile/src/views/Editor/EditorHeader.js
index 959516072..c118fda01 100644
--- a/apps/mobile/src/views/Editor/EditorHeader.js
+++ b/apps/mobile/src/views/Editor/EditorHeader.js
@@ -104,9 +104,8 @@ const EditorHeader = () => {
const onCallClear = async () => {
if (editing.currentlyEditing) {
- exitEditorAnimation();
+ await _onBackPress()
}
- await clearEditor();
};
useEffect(() => {
diff --git a/apps/mobile/src/views/Editor/Functions.js b/apps/mobile/src/views/Editor/Functions.js
index 45729c476..da8a405d6 100644
--- a/apps/mobile/src/views/Editor/Functions.js
+++ b/apps/mobile/src/views/Editor/Functions.js
@@ -1,18 +1,15 @@
import {createRef} from 'react';
import {Linking, Platform} from 'react-native';
-import SplashScreen from 'react-native-splash-screen';
import {updateEvent} from '../../components/DialogManager/recievers';
import {Actions} from '../../provider/Actions';
import {DDS} from '../../services/DeviceDetection';
import {eSendEvent, sendNoteEditedEvent} from '../../services/EventManager';
-import IntentService from '../../services/IntentService';
import {editing} from '../../utils';
import {COLORS_NOTE, COLOR_SCHEME} from '../../utils/Colors';
import {hexToRGBA} from '../../utils/ColorUtils';
import {db} from '../../utils/DB';
import {
eOnLoadNote,
- eOpenSideMenu,
eShowGetPremium,
refreshNotesPage,
} from '../../utils/Events';