From e8ff9051d77e614bc4bd019ea6ebb27b2805375c Mon Sep 17 00:00:00 2001 From: ammarahm-ed Date: Tue, 17 Nov 2020 20:22:40 +0500 Subject: [PATCH] refactor --- .../components/ActionSheetComponent/index.js | 7 ++++- .../src/components/DialogManager/index.js | 27 ++++++++++++++++--- .../components/SimpleList/NoteItemWrapper.js | 7 ++++- 3 files changed, 35 insertions(+), 6 deletions(-) diff --git a/apps/mobile/src/components/ActionSheetComponent/index.js b/apps/mobile/src/components/ActionSheetComponent/index.js index 38cfe4928..9d143efda 100644 --- a/apps/mobile/src/components/ActionSheetComponent/index.js +++ b/apps/mobile/src/components/ActionSheetComponent/index.js @@ -154,7 +154,12 @@ export const ActionSheetComponent = ({ icon: 'share-variant', func: () => { if (note.locked) { - openVault(item, false, true, false, false, true); + openVault({ + item:item, + novault:true, + locked:true, + share:true, + }) } else { close(); let m = `${note.title}\n \n ${note.content.text}`; diff --git a/apps/mobile/src/components/DialogManager/index.js b/apps/mobile/src/components/DialogManager/index.js index 9b17f7ecb..15c901ce5 100644 --- a/apps/mobile/src/components/DialogManager/index.js +++ b/apps/mobile/src/components/DialogManager/index.js @@ -229,7 +229,12 @@ export class DialogManager extends Component { switch (this.show) { case 'delete': { if (this.state.item.locked) { - openVault(this.state.item, true, true, false, false, false, true); + openVault({ + item:this.state.item, + novault:true, + locked:true, + deleteNote:true, + }) } else { this._showSimpleDialog(TEMPLATE_DELETE(this.state.item.type)); } @@ -240,15 +245,29 @@ export class DialogManager extends Component { break; } case 'novault': { - openVault(this.state.item, false); + openVault({ + item:this.state.item, + novault:false, + locked:true, + deleteNote:true, + }) break; } case 'locked': { - openVault(this.state.item, true, true); + openVault({ + item:this.state.item, + novault:true, + locked:true, + }) break; } case 'unlock': { - openVault(this.state.item, true, true, true, false, false); + openVault({ + item:this.state.item, + novault:true, + locked:true, + permanant:true + }) break; } case 'notebook': { diff --git a/apps/mobile/src/components/SimpleList/NoteItemWrapper.js b/apps/mobile/src/components/SimpleList/NoteItemWrapper.js index a56c4f173..e3701ac80 100644 --- a/apps/mobile/src/components/SimpleList/NoteItemWrapper.js +++ b/apps/mobile/src/components/SimpleList/NoteItemWrapper.js @@ -67,7 +67,12 @@ export const NoteItemWrapper = ({item, index, isTrash = false}) => { onLongPress(); return; } else if (note.locked) { - openVault(item, true, true, false, true, false); + openVault({ + item:item, + novault:true, + locked:true, + goToEditor:true, + }) return; } if (isTrash) {