Skip to content

A fully open source & end-to-end encrypted note taking alternative to Evernote.

partially fix note locking

ammarahm-ed99a5374d9b51
diff --git a/apps/mobile/src/components/DialogManager/index.js b/apps/mobile/src/components/DialogManager/index.js
index 2288250c4..557dada36 100644
--- a/apps/mobile/src/components/DialogManager/index.js
+++ b/apps/mobile/src/components/DialogManager/index.js
@@ -464,6 +464,12 @@ export class DialogManager extends Component {
colors={colors}
note={item}
perm={isPerm}
+ reset={() => {
+ this.setState({
+ isPerm: false,
+ shareAfterUnlock: false,
+ });
+ }}
shareAfterUnlock={shareAfterUnlock}
openedToUnlock={false}
visible={vaultDialog}
diff --git a/apps/mobile/src/components/VaultDialog/index.js b/apps/mobile/src/components/VaultDialog/index.js
index 20e8c576c..19dafdda4 100644
--- a/apps/mobile/src/components/VaultDialog/index.js
+++ b/apps/mobile/src/components/VaultDialog/index.js
@@ -43,6 +43,7 @@ export class VaultDialog extends Component {
this.setState({
visible: false,
});
+ this.props.reset();
};
onPress = async () => {
diff --git a/apps/mobile/src/views/Editor/index.js b/apps/mobile/src/views/Editor/index.js
index a251b52e3..d921201ae 100755
--- a/apps/mobile/src/views/Editor/index.js
+++ b/apps/mobile/src/views/Editor/index.js
@@ -105,7 +105,7 @@ const Editor = ({navigation, noMenu}) => {
};
const clearEditor = async () => {
- await saveNote();
+ await saveNote(true);
title = null;
content = null;
note = null;
@@ -177,7 +177,6 @@ const Editor = ({navigation, noMenu}) => {
},
id: id,
});
- console.log('here', title, id);
if (id !== rId && !note?.locked) {
id = rId;
note = db.notes.note(id);
@@ -191,12 +190,12 @@ const Editor = ({navigation, noMenu}) => {
}
}, 500);
}
- if (id) {
- dispatch({
- type: ACTIONS.CURRENT_EDITING_NOTE,
- id: id,
- });
- }
+ }
+ if (id) {
+ dispatch({
+ type: ACTIONS.CURRENT_EDITING_NOTE,
+ id: id,
+ });
}
if (content.text.length < 200 || saveCounter < 2) {
@@ -206,8 +205,10 @@ const Editor = ({navigation, noMenu}) => {
}
saveCounter++;
if (id) {
- let lockednote = db.notes.note(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');
}
}