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
return to previous screen after deleting note.
ammarahm-ed3aa61ab648ad
diff --git a/apps/mobile/src/components/ActionSheetComponent/index.js b/apps/mobile/src/components/ActionSheetComponent/index.jsindex b3b2b9efc..5a4d04e70 100644--- a/apps/mobile/src/components/ActionSheetComponent/index.js+++ b/apps/mobile/src/components/ActionSheetComponent/index.js@@ -42,7 +42,7 @@ export const ActionSheetComponent = ({columnItems = [],}) => {const [state, dispatch] = useTracked();- const {colors, tags} = state;+ const {colors, tags, currentEditingNote} = state;const [focused, setFocused] = useState(false);const [note, setNote] = useState(itemdiff --git a/apps/mobile/src/components/Dialog/index.js b/apps/mobile/src/components/Dialog/index.jsindex f3823b3c9..3efd4abbb 100644--- a/apps/mobile/src/components/Dialog/index.js+++ b/apps/mobile/src/components/Dialog/index.js@@ -11,7 +11,7 @@ import {db, DDS} from '../../../App';import {opacity, ph, pv, SIZE, WEIGHT} from '../../common/common';import {ACTIONS} from '../../provider/actions';import NavigationService from '../../services/NavigationService';-import {getElevation, ToastEvent} from '../../utils/utils';+import {getElevation, ToastEvent, editing} from '../../utils/utils';import {dialogActions, updateEvent} from '../DialogManager';import {eSendEvent} from '../../services/eventManager';import {eCloseFullscreenEditor} from '../../services/events';@@ -35,13 +35,11 @@ export class Dialog extends Component {ToastEvent.show('Note moved to trash', 'error', 3000);updateEvent({type: item.type});} else if (item.type === 'topic') {- console.log(item);- //TODO-await db.notebooks.notebook(item.notebookId).topics.delete(item.title);updateEvent({type: 'notebook'});+ToastEvent.show('Topic deleted', 'error', 3000);} else if (item.type === 'notebook') {await db.notebooks.delete(item.id);@@ -52,6 +50,9 @@ export class Dialog extends Component {this.setState({visible: false,});+ if (editing.currentlyEditing) {+ NavigationService.goBack();+ }break;}case dialogActions.ACTION_EXIT: {diff --git a/apps/mobile/src/utils/utils.js b/apps/mobile/src/utils/utils.jsindex b6b39f0ff..b1454f65c 100755--- a/apps/mobile/src/utils/utils.js+++ b/apps/mobile/src/utils/utils.js@@ -18,6 +18,10 @@ export const getElevation = elevation => {};};+export const editing = {+ currentlyEditing: false,+};+export function timeSince(date) {var seconds = Math.floor((new Date() - date) / 1000);diff --git a/apps/mobile/src/views/Editor/index.js b/apps/mobile/src/views/Editor/index.jsindex 312298636..6034d8cab 100755--- a/apps/mobile/src/views/Editor/index.js+++ b/apps/mobile/src/views/Editor/index.js@@ -34,7 +34,12 @@ import {eOnLoadNote,eOpenFullscreenEditor,} from '../../services/events';-import {SideMenuEvent, timeConverter, ToastEvent} from '../../utils/utils';+import {+ SideMenuEvent,+ timeConverter,+ ToastEvent,+ editing,+} from '../../utils/utils';import {AnimatedSafeAreaView} from '../Home';import NavigationService from '../../services/NavigationService';@@ -47,6 +52,7 @@ var title = null;let timer = null;let saveCounter = 0;let tapCount = 0;+const Editor = ({navigation, noMenu}) => {// Global Stateconst [state, dispatch] = useTracked();@@ -358,7 +364,7 @@ const Editor = ({navigation, noMenu}) => {content = null;note = null;id = null;-+ ToastEvent.show('Note Saved!', 'success');NavigationService.goBack();}}}@@ -528,6 +534,7 @@ const Editor = ({navigation, noMenu}) => {});useEffect(() => {+ editing.currentlyEditing = true;let handleBack;if (!noMenu && DDS.isTab) {handleBack = BackHandler.addEventListener('hardwareBackPress', () => {@@ -542,6 +549,7 @@ const Editor = ({navigation, noMenu}) => {content = null;note = null;id = null;+ ToastEvent.show('Note Saved!', 'success');return false;} else {tapCount = 1;@@ -560,6 +568,7 @@ const Editor = ({navigation, noMenu}) => {}return () => {+ editing.currentlyEditing = false;if (handleBack) {handleBack.remove();handleBack = null;