partially fix note locking

This commit is contained in:
ammarahm-ed
2020-03-03 15:57:52 +05:00
parent 0f6ba58e6f
commit 99a5374d9b
3 changed files with 17 additions and 9 deletions

View File

@@ -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}

View File

@@ -43,6 +43,7 @@ export class VaultDialog extends Component {
this.setState({
visible: false,
});
this.props.reset();
};
onPress = async () => {

View File

@@ -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');
}
}