add trash

This commit is contained in:
ammarahm-ed
2020-02-06 21:33:18 +05:00
parent 4cd4f97932
commit 865ec89e91
5 changed files with 7 additions and 9 deletions

View File

@@ -344,6 +344,8 @@ export const ActionSheetComponent = ({
} else {
noteColors.push(color);
}
//db.notes.note(note.id).
// TODO
/* db.addNote({
dateCreated: note.dateCreated,

View File

@@ -112,7 +112,6 @@ export class AddNotebookDialog extends React.Component {
let id = toEdit && toEdit.id ? toEdit.id : null;
// TODO
await db.notebooks.add({
title: this.title,
description: this.description,

View File

@@ -60,9 +60,7 @@ export class Dialog extends Component {
break;
}
case dialogActions.ACTION_EMPTY_TRASH: {
// TODO
//await db.clearTrash();
await db.trash.clear();
updateEvent({type: ACTIONS.TRASH});
ToastEvent.show('Trash cleared', 'error', 1000, () => {}, '');
this.setState({
@@ -79,8 +77,7 @@ export class Dialog extends Component {
});
}
case dialogActions.ACTION_TRASH: {
// TODO
//db.restoreItem(item.dateCreated);
db.trash.restore(item.id);
ToastEvent.show(
item.type.slice(0, 1).toUpperCase() +
item.type.slice(1) +
@@ -98,6 +95,7 @@ export class Dialog extends Component {
let {template, item} = this.props;
if (dialogActions.ACTION_TRASH === template.action) {
// delete item forever.
db.trash.delete(item.id);
}
this.setState({
visible: false,

View File

@@ -26,8 +26,8 @@ export const reducer = (state, action) => {
};
}
case ACTIONS.TRASH: {
let trash = [];
// TODO
let trash = db.trash.all;
return {
...state,
trash: trash,

View File

@@ -194,7 +194,6 @@ const Editor = ({navigation, noMenu}) => {
if (id) {
let lockednote = db.notes.note(id);
if (lockNote && lockednote.locked) {
// TODO
await db.notes.note(id).lock('password');
}
}