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
fix trash item issues
ammarahm-ed3354747b8a67
diff --git a/apps/mobile/src/components/listitems/note/wrapper.js b/apps/mobile/src/components/listitems/note/wrapper.jsindex 7bdd7b5f1..92f84f77b 100644--- a/apps/mobile/src/components/listitems/note/wrapper.js+++ b/apps/mobile/src/components/listitems/note/wrapper.js@@ -16,15 +16,14 @@ export const openNote = async (item, isTrash, setSelectedItem) => {let _note = item;if (!isTrash) {_note = db.notes.note(item.id).data;- }-- if (!db.notes.note(item.id)?.synced()) {- presentDialog({- title: 'Note not synced',- negativeText: 'Ok',- paragraph: 'Please sync again to open this note for editing'- });- return;+ if (!db.notes.note(item.id)?.synced()) {+ presentDialog({+ title: 'Note not synced',+ negativeText: 'Ok',+ paragraph: 'Please sync again to open this note for editing'+ });+ return;+ }}if (history.selectedItemsList.length > 0 && history.selectionMode) {diff --git a/apps/mobile/src/components/listitems/notebook/wrapper.js b/apps/mobile/src/components/listitems/notebook/wrapper.jsindex e49cebee0..1d7d04415 100644--- a/apps/mobile/src/components/listitems/notebook/wrapper.js+++ b/apps/mobile/src/components/listitems/notebook/wrapper.js@@ -1,11 +1,13 @@import React from 'react';import { NotebookItem } from '.';-import { useSelectionStore } from '../../../stores/stores';-import { eSendEvent } from '../../../services/event-manager';+import { eSendEvent, ToastEvent } from '../../../services/event-manager';import Navigation from '../../../services/navigation';+import { useSelectionStore, useTrashStore } from '../../../stores/stores';import { history } from '../../../utils';import { eOnNewTopicAdded, refreshNotesPage } from '../../../utils/events';+import { presentDialog } from '../../dialog/functions';import SelectionWrapper from '../selection-wrapper';+import { db } from '../../../utils/database';export const NotebookWrapper = React.memo(({ item, index, dateBy }) => {@@ -19,6 +21,43 @@ export const NotebookWrapper = React.memo(} else {history.selectedItemsList = [];}++ if (isTrash) {+ presentDialog({+ title: `Restore ${item.itemType}`,+ paragraph: `Restore or delete ${item.itemType} forever`,+ positiveText: 'Restore',+ negativeText: 'Delete',+ positivePress: async () => {+ await db.trash.restore(item.id);+ Navigation.setRoutesToUpdate([+ Navigation.routeNames.Tags,+ Navigation.routeNames.Notes,+ Navigation.routeNames.Notebooks,+ Navigation.routeNames.NotesPage,+ Navigation.routeNames.Favorites,+ Navigation.routeNames.Trash+ ]);+ useSelectionStore.getState().setSelectionMode(false);+ ToastEvent.show({+ heading: 'Restore successful',+ type: 'success'+ });+ },+ onClose: async () => {+ await db.trash.delete(item.id);+ useTrashStore.getState().setTrash();+ useSelectionStore.getState().setSelectionMode(false);+ ToastEvent.show({+ heading: 'Permanantly deleted items',+ type: 'success',+ context: 'local'+ });+ }+ });+ return;+ }+let routeName = item.type === 'topic' ? 'NotesPage' : 'Notebook';let params =