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
update
ammarahm-edddf250932a40
diff --git a/apps/mobile/src/components/Dialog/index.js b/apps/mobile/src/components/Dialog/index.jsindex ccf63c9a7..b1f2fae95 100644--- a/apps/mobile/src/components/Dialog/index.js+++ b/apps/mobile/src/components/Dialog/index.js@@ -21,9 +21,19 @@ export class Dialog extends Component {switch (template.action) {case dialogActions.ACTION_DELETE: {- await db.deleteNotes([item]);- ToastEvent.show('Note moved to trash', 'success', 3000);- updateEvent({type: item.type});+ if (item.type === 'note') {+ await db.deleteNotes([item]);+ ToastEvent.show('Note moved to trash', 'success', 3000);+ updateEvent({type: item.type});+ } else if (item.type === 'topic') {+ await db.deleteTopicFromNotebook(notebookID, item.title);+ updateEvent({type: 'notebook'});+ ToastEvent.show('Topic moved to trash', 'success', 3000);+ } else if (item.type === 'notebook') {+ await db.deleteNotebooks([item]);+ updateEvent({type: item.type});+ ToastEvent.show('Notebook moved to trash', 'success', 3000);+ }this.setState({visible: false,diff --git a/apps/mobile/src/components/DialogManager/index.js b/apps/mobile/src/components/DialogManager/index.jsindex fd4afc093..c936a24e9 100644--- a/apps/mobile/src/components/DialogManager/index.js+++ b/apps/mobile/src/components/DialogManager/index.js@@ -4,6 +4,9 @@ import ActionSheet from '../ActionSheet';import {ActionSheetComponent} from '../ActionSheetComponent';import {Dialog} from '../Dialog';import {VaultDialog} from '../VaultDialog';+import MoveNoteDialog from '../MoveNoteDialog';+import {AddTopicDialog} from '../AddTopicDialog';+import {AddNotebookDialog} from '../AddNotebookDialog';export const dialogActions = {ACTION_DELETE: 511,@@ -11,13 +14,21 @@ export const dialogActions = {ACTION_EMPTY_TRASH: 513,};-export const ActionSheetEvent = (item, colors, tags, rowItems, columnItems) => {+export const ActionSheetEvent = (+ item,+ colors,+ tags,+ rowItems,+ columnItems,+ extraData,+) => {DeviceEventEmitter.emit('ActionSheetEvent', {item,colors,tags,rowItems,columnItems,+ extraData,});};export const ActionSheetHideEvent = () => {@@ -32,6 +43,26 @@ export const simpleDialogHideEvent = () => {DeviceEventEmitter.emit('simpleDialogHideEvent');};+export const moveNoteEvent = () => {+ DeviceEventEmitter.emit('moveNoteEvent');+};+export const moveNoteHideEvent = () => {+ DeviceEventEmitter.emit('moveNoteHideEvent');+};++export const AddNotebookEvent = notebook => {+ DeviceEventEmitter.emit('addNotebookEvent', notebook);+};+export const HideAddNotebookEvent = notebook => {+ DeviceEventEmitter.emit('hideAddNotebookEvent', notebook);+};+export const AddTopicEvent = notebook => {+ DeviceEventEmitter.emit('addTopicEvent', notebook);+};+export const HideAddTopicEvent = notebook => {+ DeviceEventEmitter.emit('hideAddTopicEvent', notebook);+};+export const updateEvent = data => {DeviceEventEmitter.emit('updateEvent', data);};@@ -123,12 +154,29 @@ export class DialogManager extends Component {this.actionSheet._setModalVisible();};+ _showMoveNote = () => {+ this.moveNoteDialog.open();+ };++ _hideMoveNote = () => {+ this.moveNoteDialog.close();+ };+componentDidMount() {_recieveEvent('ActionSheetEvent', this._showActionSheet);_recieveEvent('ActionSheetHideEvent', this._hideActionSheet);_recieveEvent('simpleDialogEvent', this._showSimpleDialog);_recieveEvent('simpleDialogHideEvent', this._hideActionSheet);++ _recieveEvent('moveNoteEvent', this._showMoveNote);+ _recieveEvent('moveNoteHideEvent', this._hideMoveNote);++ _recieveEvent('addNotebookEvent', this.showAddNotebook);+ _recieveEvent('hideAddNotebookEvent', this.hideAddNotebook);++ _recieveEvent('addTopicEvent', this.showAddTopic);+ _recieveEvent('hideAddTopicEvent', this.hideAddTopic);}componentWillUnmount() {_unSubscribeEvent('ActionSheetEvent', this._showActionSheet);@@ -136,6 +184,40 @@ export class DialogManager extends Component {_unSubscribeEvent('simpleDialogEvent', this._showSimpleDialog);_unSubscribeEvent('simpleDialogHideEvent', this._hideSimpleDialog);++ _unSubscribeEvent('moveNoteEvent', this._showMoveNote);+ _unSubscribeEvent('moveNoteHideEvent', this._hideMoveNote);++ _unSubscribeEvent('addNotebookEvent', this.showAddNotebook);+ _unSubscribeEvent('hideAddNotebookEvent', this.hideAddNotebook);++ _unSubscribeEvent('addTopicEvent', this.showAddTopic);+ _unSubscribeEvent('hideAddTopicEvent', this.hideAddTopic);+ }++ showAddNotebook(notebook) {+ this.setState(+ {+ item: notebook,+ },+ () => {+ this.addNotebbokDialog.open();+ },+ );+ }+ hideAddNotebook() {+ this.addNotebbokDialog.close();+ }++ showAddTOpic() {+ this.setState({+ item: notebook,+ });+ this.addTopicsDialog.open();+ }++ hideAddTopic() {+ this.addTopicsDialog.close();}_showSimpleDialog = data => {@@ -161,19 +243,25 @@ export class DialogManager extends Component {onActionSheetHide = () => {if (this.show) {- if (this.show === 'delete') {- this._showSimpleDialog(TEMPLATE_DELETE(this.state.item.type));-- this.show = null;- } else if (this.show == 'lock') {- this._showVaultDialog();- this.show = null;- } else if (this.show == 'unlock') {- this.setState({- isPerm: true,- });- this._showVaultDialog();- this.show = null;+ switch (this.show) {+ case 'delete': {+ this._showSimpleDialog(TEMPLATE_DELETE(this.state.item.type));+ }+ case 'lock': {+ this._showVaultDialog();+ }+ case 'unlock': {+ this.setState({+ isPerm: true,+ });+ this._showVaultDialog();+ }+ case 'notebook': {+ this.showAddNotebook();+ }+ case 'topic': {+ this.showAddTOpic();+ }}}this.show = null;@@ -239,6 +327,27 @@ export class DialogManager extends Component {openedToUnlock={false}visible={vaultDialog}/>++ <MoveNoteDialog+ ref={ref => (this.moveNoteDialog = ref)}+ colors={colors}+ />++ <AddTopicDialog+ ref={ref => (this.addTopicsDialog = ref)}+ toEdit={item}+ notebookID={+ actionSheetData.extraData+ ? actionSheetData.extraData.notebookID+ : null+ }+ colors={colors}+ />+ <AddNotebookDialog+ ref={ref => (this.addNotebooksDialog = ref)}+ toEdit={item}+ colors={colors}+ /></>);}