mirror of
https://github.com/streetwriters/notesnook.git
synced 2025-12-23 15:09:33 +01:00
add trash
This commit is contained in:
@@ -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,
|
||||||
|
|||||||
@@ -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,
|
||||||
|
|||||||
@@ -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,
|
||||||
|
|||||||
@@ -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,
|
||||||
|
|||||||
@@ -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');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user