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
add notes from anywhere
ammarahm-ed76a2d1dfcc41
diff --git a/apps/mobile/src/services/events.js b/apps/mobile/src/services/events.jsindex 74b03904b..93fac4890 100644--- a/apps/mobile/src/services/events.js+++ b/apps/mobile/src/services/events.js@@ -61,3 +61,5 @@ export const eOnNewTopicAdded = '529';export const eOpenVaultDialog = '530';export const eCloseVaultDialog = '531';++export const refreshNotesPage = '532';diff --git a/apps/mobile/src/utils/utils.js b/apps/mobile/src/utils/utils.jsindex d10b6e84e..f0c7c9f36 100755--- a/apps/mobile/src/utils/utils.js+++ b/apps/mobile/src/utils/utils.js@@ -21,6 +21,9 @@ export const getElevation = elevation => {export const editing = {currentlyEditing: false,isFullscreen: false,+ actionAfterFirstSave: {+ type: null,+ },};export const history = {diff --git a/apps/mobile/src/views/Editor/index.js b/apps/mobile/src/views/Editor/index.jsindex d921201ae..873bc4c92 100755--- a/apps/mobile/src/views/Editor/index.js+++ b/apps/mobile/src/views/Editor/index.js@@ -32,6 +32,7 @@ import {eCloseFullscreenEditor,eOnLoadNote,eOpenFullscreenEditor,+ refreshNotesPage,} from '../../services/events';import {exitEditorAnimation} from '../../utils/animations';import {@@ -106,6 +107,7 @@ const Editor = ({navigation, noMenu}) => {const clearEditor = async () => {await saveNote(true);+ setDateEdited(0);title = null;content = null;note = null;@@ -191,7 +193,47 @@ const Editor = ({navigation, noMenu}) => {}, 500);}}+if (id) {+ switch (editing.actionAfterFirstSave.type) {+ case 'topic': {+ await db.notes.move(+ {+ topic: editing.actionAfterFirstSave.id,+ id: editing.actionAfterFirstSave.notebook,+ },+ id,+ );+ editing.actionAfterFirstSave = {+ type: null,+ };++ break;+ }+ case 'tag': {+ await db.notes.note(note.id).tag(editing.actionAfterFirstSave.id);+ editing.actionAfterFirstSave = {+ type: null,+ };++ break;+ }+ case 'color': {+ console.log('I WORKED');++ await db.notes.note(id).color(editing.actionAfterFirstSave.id);++ editing.actionAfterFirstSave = {+ type: null,+ };++ break;+ }+ default: {+ break;+ }+ }+dispatch({type: ACTIONS.CURRENT_EDITING_NOTE,id: id,@@ -202,13 +244,13 @@ const Editor = ({navigation, noMenu}) => {dispatch({type: ACTIONS.NOTES,});+ eSendEvent(refreshNotesPage);}saveCounter++;if (id) {let lockednote = db.notes.note(id).data;- console.log(id, lockednote);+if (lockNote && lockednote && lockednote.locked) {- console.log('CRASH AFTER HERE');await db.notes.note(id).lock('password');}}diff --git a/apps/mobile/src/views/Notes/index.js b/apps/mobile/src/views/Notes/index.jsindex dfae2abfb..d6103fba8 100644--- a/apps/mobile/src/views/Notes/index.js+++ b/apps/mobile/src/views/Notes/index.js@@ -7,18 +7,27 @@ import {RefreshControl,ActivityIndicator,} from 'react-native';-import {db} from '../../../App';+import {db, DDS} from '../../../App';import Container from '../../components/Container';import NoteItem from '../../components/NoteItem';import SelectionWrapper from '../../components/SelectionWrapper';import {useTracked} from '../../provider';import {SIZE, WEIGHT} from '../../common/common';import {ACTIONS} from '../../provider/actions';-import {ToastEvent} from '../../utils/utils';-import {eSendEvent} from '../../services/eventManager';-import {eScrollEvent} from '../../services/events';+import {ToastEvent, editing, SideMenuEvent} from '../../utils/utils';+import {+ eSendEvent,+ eSubscribeEvent,+ eUnSubscribeEvent,+} from '../../services/eventManager';+import {+ eScrollEvent,+ refreshNotesPage,+ eOnLoadNote,+} from '../../services/events';import {NotesPlaceHolder} from '../../components/ListPlaceholders';import {useIsFocused} from 'react-navigation-hooks';+import {openEditorAnimation} from '../../utils/animations';export const Notes = ({navigation}) => {const [state, dispatch] = useTracked();@@ -43,13 +52,29 @@ export const Notes = ({navigation}) => {type: ACTIONS.CURRENT_SCREEN,screen: params.type,});+ } else {+ editing.actionAfterFirstSave = {+ type: null,+ };}}, [isFocused, allNotes, colorNotes]);+ useEffect(() => {+ eSubscribeEvent(refreshNotesPage, init);++ return () => {+ eUnSubscribeEvent(refreshNotesPage, init);+ editing.actionAfterFirstSave = {+ type: null,+ };+ };+ }, []);+const init = () => {eSendEvent(eScrollEvent, 0);if (params.type === 'tag') {let notesInTag = db.notes.tagged(params.tag.title);+setNotes([...notesInTag]);} else if (params.type == 'color') {let notesInColors = db.notes.colored(params.color.id);@@ -61,7 +86,7 @@ export const Notes = ({navigation}) => {.topics.topic(params.title).all;if (allNotes && allNotes.length > 0) {- setNotes(allNotes);+ setNotes([...allNotes]);}}};@@ -198,7 +223,34 @@ export const Notes = ({navigation}) => {placeholder={`Search in ${params.type == 'tag' ? '#' + params.title : params.title}`}- bottomButtonOnPress={() => {}}>+ bottomButtonOnPress={() => {+ if (params.type === 'tag') {+ editing.actionAfterFirstSave = {+ type: 'tag',+ id: params.tag.title,+ };+ } else if (params.type == 'color') {+ editing.actionAfterFirstSave = {+ type: 'color',+ id: params.color.id,+ };+ } else {+ editing.actionAfterFirstSave = {+ type: 'topic',+ id: params.title,+ notebook: params.notebookId,+ };+ }++ if (DDS.isTab) {+ eSendEvent(eOnLoadNote, {type: 'new'});+ } else {+ SideMenuEvent.close();+ SideMenuEvent.disable();+ eSendEvent(eOnLoadNote, {type: 'new'});+ openEditorAnimation();+ }+ }}><FlatListdata={notes}refreshControl={