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
minor changes
ammarahm-edc01ba68172f1
diff --git a/apps/mobile/App.js b/apps/mobile/App.jsindex 4e52d8a12..e40790227 100644--- a/apps/mobile/App.js+++ b/apps/mobile/App.js@@ -29,12 +29,10 @@ const App = () => {: require('./index.mobile');const _onOrientationChange = (o) => {- console.log(o, 'orientation');let smallTab = DDS.isSmallTab;DDS.setNewValues();DDS.checkSmallTab(o);if (smallTab === DDS.isSmallTab) {- console.log('nothing changed');return;}@@ -92,14 +90,11 @@ const App = () => {dispatch({type: Actions.ALL});}, resetApp = () => {note = getNote();- console.log(note, 'NOTE BEFORE RELOAD');setInit(false);Initialize().then(async () => {setInit(true);await sleep(300);- console.log(note, 'NOTE ON RELOAD');if (note && note.id) {- console.log(note);eSendEvent(eOnLoadNote, note);if (DDS.isPhone || DDS.isSmallTab) {openEditorAnimation();@@ -147,7 +142,6 @@ const App = () => {user = await db.user.get();} catch (e) {error = e;- console.log(e, "ERROR IN DB")} finally {if (user) {dispatch({type: Actions.USER, user: user});diff --git a/apps/mobile/loading.js b/apps/mobile/loading.jsindex b2db88d8e..fc1ee48a6 100755--- a/apps/mobile/loading.js+++ b/apps/mobile/loading.js@@ -1,7 +1,5 @@import React from 'react';import * as Animatable from 'react-native-animatable';-import {DialogManager} from './src/components/DialogManager';-import {Toast} from './src/components/Toast';import {useTracked} from './src/provider';import {dWidth} from './src/utils';import {SIZE, WEIGHT} from "./src/utils/SizeUtils";diff --git a/apps/mobile/src/components/ActionSheetComponent/index.js b/apps/mobile/src/components/ActionSheetComponent/index.jsindex 098d3c0e7..d2fb7a4ea 100644--- a/apps/mobile/src/components/ActionSheetComponent/index.js+++ b/apps/mobile/src/components/ActionSheetComponent/index.js@@ -13,7 +13,7 @@ import Share from 'react-native-share';import Icon from 'react-native-vector-icons/MaterialCommunityIcons';import {useTracked} from '../../provider';import {Actions} from '../../provider/Actions';-import {eSendEvent, openVault, ToastEvent} from '../../services/EventManager';+import {eSendEvent, openVault, sendNoteEditedEvent, ToastEvent} from '../../services/EventManager';import {eOnNoteEdited,eOpenLoginDialog,@@ -37,6 +37,7 @@ import {opacity, ph, pv, SIZE, WEIGHT} from "../../utils/SizeUtils";import {db} from "../../utils/DB";import {DDS} from "../../services/DeviceDetection";import {MMKV} from "../../utils/MMKV";+import id from "notes-core/utils/id";const w = Dimensions.get('window').width;const h = Dimensions.get('window').height;@@ -115,7 +116,6 @@ export const ActionSheetComponent = ({if (event.nativeEvent.key === 'Backspace') {if (backPressCount === 0 && !tagToAdd) {backPressCount = 1;-return;}if (backPressCount === 1 && !tagToAdd) {@@ -136,17 +136,15 @@ export const ActionSheetComponent = ({});}} else if (event.nativeEvent.key === ' ') {- _onSubmit();+ await _onSubmit();tagsInputRef.current?.setNativeProps({text: '',});- return;} else if (event.nativeEvent.key === ',') {- _onSubmit();+ await _onSubmit();tagsInputRef.current?.setNativeProps({text: '',});- return;}};@@ -341,7 +339,7 @@ export const ActionSheetComponent = ({await db.notebooks.notebook(note.id).favorite();}dispatch({type: Actions.FAVORITES});- eSendEvent(eOnNoteEdited , {id: note.id, noEdit: true});+ sendNoteEditedEvent(note.id, false,true)localRefresh(item.type,true);},close: false,@@ -365,7 +363,7 @@ export const ActionSheetComponent = ({db.vault.add(note.id).then(() => {- eSendEvent(eOnNoteEdited , {id: note.id, noEdit: true});+ sendNoteEditedEvent(note.id, false,true)close();}).catch(async (e) => {@@ -398,10 +396,10 @@ export const ActionSheetComponent = ({await db.notes.note(note.id).untag(oldProps.tags[oldProps.tags.indexOf(tag)]);- eSendEvent(eOnNoteEdited , {id: note.id, noEdit: true});+ sendNoteEditedEvent(note.id, false,true)dispatch({type: Actions.TAGS});} catch (e) {- eSendEvent(eOnNoteEdited , {id: note.id, noEdit: true});+ sendNoteEditedEvent(note.id, false,true)}}}style={{@@ -454,7 +452,7 @@ export const ActionSheetComponent = ({await db.notes.note(note.id).color(color.name);}dispatch({type: Actions.COLORS});- eSendEvent(eOnNoteEdited , {id: note.id, noEdit: true});+ sendNoteEditedEvent(note.id, false,true)localRefresh(note.type,true);}}customStyle={{diff --git a/apps/mobile/src/components/RestoreDialog/index.js b/apps/mobile/src/components/RestoreDialog/index.jsindex 21652318a..f0e711f66 100644--- a/apps/mobile/src/components/RestoreDialog/index.js+++ b/apps/mobile/src/components/RestoreDialog/index.js@@ -107,11 +107,11 @@ const RestoreDialog = () => {<Viewstyle={{- flexDirection: 'row',- justifyContent: 'center',+ justifyContent: 'space-between',alignItems: 'center',height: 50,marginTop: DDS.isTab ? 0 : insets.top,+ flexDirection:"row",}}><ActionIconname="close"@@ -120,8 +120,7 @@ const RestoreDialog = () => {customStyle={{width: 40,height: 40,- position: 'absolute',- textAlignVertical: 'center',+ textAlignVertical: 'center',left: 0,}}color={colors.heading}@@ -134,16 +133,13 @@ const RestoreDialog = () => {}}>Choose a Backup</Text>+ <View style={ {+ width: 40,+ height: 40,+ }}/>+</View>- <Text- style={{- color: colors.icon,- fontFamily: WEIGHT.regular,- fontSize: SIZE.xs + 1,- textAlign: 'center',- }}>- Phone Storage/Notesnook/backups/- </Text>+<FlatListdata={files}diff --git a/apps/mobile/src/components/SimpleList/NoteItemWrapper.js b/apps/mobile/src/components/SimpleList/NoteItemWrapper.jsindex ac60e1f76..1255455b5 100644--- a/apps/mobile/src/components/SimpleList/NoteItemWrapper.js+++ b/apps/mobile/src/components/SimpleList/NoteItemWrapper.js@@ -29,20 +29,21 @@ export const NoteItemWrapper = ({},[item])const onNoteChange = (data) => {- if (data.id !== note.id) {+ if (data.id !== note.id || data.closed) {if (editing) {setEditing(false);}return;}- if (editing !== true && !data.noEdit) {+ if (!editing && !data.noEdit) {setEditing(true);}+ let newNote = db.notes.note(data.id).data;- if (data.closed) {- setEditing(false);+ if (!data.noEdit && newNote.title === note.title && newNote.headline === note.headline) {+ return;}- setNote(db.notes.note(data.id).data);+ setNote(newNote);}useEffect(() => {diff --git a/apps/mobile/src/services/EventManager.js b/apps/mobile/src/services/EventManager.jsindex eb1686401..c93afe92d 100644--- a/apps/mobile/src/services/EventManager.js+++ b/apps/mobile/src/services/EventManager.js@@ -1,5 +1,5 @@import {DeviceEventEmitter} from 'react-native';-import {eHideToast, eOpenVaultDialog, eShowToast} from '../utils/Events';+import {eHideToast, eOnNoteEdited, eOpenVaultDialog, eShowToast} from '../utils/Events';export const eSubscribeEvent = (eventName, action) => {DeviceEventEmitter.addListener(eventName, action);@@ -32,6 +32,12 @@ export const openVault = (deleteNote,});};++export function sendNoteEditedEvent(id="",closed=false,noEdit=false) {+ eSendEvent(eOnNoteEdited , {id,closed, noEdit});+}++export const ToastEvent = {show: (message,diff --git a/apps/mobile/src/views/Editor/Functions.js b/apps/mobile/src/views/Editor/Functions.jsindex 8e657f7b6..90c13f1da 100644--- a/apps/mobile/src/views/Editor/Functions.js+++ b/apps/mobile/src/views/Editor/Functions.js@@ -2,7 +2,7 @@ import {createRef} from 'react';import {Linking, Platform} from 'react-native';import {updateEvent} from '../../components/DialogManager/recievers';import {Actions} from '../../provider/Actions';-import {eSendEvent} from '../../services/EventManager';+import {eSendEvent, sendNoteEditedEvent} from '../../services/EventManager';import {eOnNoteEdited, refreshNotesPage} from '../../utils/Events';import {editing} from '../../utils';import {sleep, timeConverter} from "../../utils/TimeUtils";@@ -120,7 +120,7 @@ export async function loadNote(item) {} else {await setNote(item);canSave = false;- eSendEvent(eOnNoteEdited , {id: item.id});+ sendNoteEditedEvent(item.id)await loadNoteInEditor();}noteEdited = false;@@ -170,7 +170,7 @@ export async function clearEditor() {await saveNote("clearEditor");}if (note && note.id) {- eSendEvent(eOnNoteEdited , {id: note.id, closed: true});+ sendNoteEditedEvent(note.id,true)}saveCounter = 0;post('reset');@@ -261,15 +261,17 @@ export async function saveNote(caller) {},id: id,});- await setNoteInEditorAfterSaving(id, rId);- if (saveCounter < 3) {+ if (!id) {updateEvent({type: Actions.NOTES,});eSendEvent(refreshNotesPage);}- eSendEvent(eOnNoteEdited, {id: rId});+ sendNoteEditedEvent(rId)++ await setNoteInEditorAfterSaving(id, rId);+if (id) {await addToCollection(id);diff --git a/apps/mobile/src/views/Home/index.js b/apps/mobile/src/views/Home/index.jsindex 53452d560..9de2dda65 100755--- a/apps/mobile/src/views/Home/index.js+++ b/apps/mobile/src/views/Home/index.js@@ -1,6 +1,4 @@import React, {useCallback, useEffect} from 'react';-import {Dimensions} from 'react-native';-import Orientation from 'react-native-orientation';import {ContainerBottomButton} from '../../components/Container/ContainerBottomButton';import {Placeholder} from '../../components/ListPlaceholders';import SimpleList from '../../components/SimpleList';@@ -12,7 +10,7 @@ import {eOnLoadNote, eScrollEvent} from '../../utils/Events';import {openEditorAnimation} from '../../utils/Animations';import {DDS} from "../../services/DeviceDetection";-export const Home = ({route, navigation}) => {+export const Home = ({navigation}) => {const [state, dispatch] = useTracked();const {notes} = state;