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 { } else {
noteColors.push(color); noteColors.push(color);
} }
//db.notes.note(note.id).
// TODO // TODO
/* db.addNote({ /* db.addNote({
dateCreated: note.dateCreated, dateCreated: note.dateCreated,

View File

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

View File

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

View File

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

View File

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