Skip to content

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

add trash template

ammarahm-edab629b29d25d
diff --git a/apps/mobile/App.js b/apps/mobile/App.js
index f2196a4d8..49a73ab00 100644
--- a/apps/mobile/App.js
+++ b/apps/mobile/App.js
@@ -18,6 +18,7 @@ import {
_unSubscribeEvent,
} from './src/components/DialogManager';
import {getColorScheme} from './src/common/common';
+import {useAppContext} from './src/provider/useAppContext';
export const DDS = new DeviceDetectionService();
export const db = new Storage(StorageInterface);
@@ -25,8 +26,7 @@ export const db = new Storage(StorageInterface);
let sideMenuRef;
const App = () => {
const [state, dispatch] = useTracked();
- const {colors} = state;
-
+ const [colors] = state;
// Local State
const [sidebar, setSidebar] = useState(w * 0.3);
const [init, setInit] = useState(false);
diff --git a/apps/mobile/src/components/ActionSheetComponent/index.js b/apps/mobile/src/components/ActionSheetComponent/index.js
index fdbc1442c..eb3b69787 100644
--- a/apps/mobile/src/components/ActionSheetComponent/index.js
+++ b/apps/mobile/src/components/ActionSheetComponent/index.js
@@ -20,7 +20,7 @@ import Icon from 'react-native-vector-icons/Feather';
import NavigationService from '../../services/NavigationService';
import {db} from '../../../App';
import FastStorage from 'react-native-fast-storage';
-import {useTracked} from '../../provider';
+import {useTracked, ACTIONS} from '../../provider';
const w = Dimensions.get('window').width;
const h = Dimensions.get('window').height;
@@ -260,6 +260,7 @@ export const ActionSheetComponent = ({
if (!note.dateCreated) return;
db.pinItem(note.type, note.dateCreated);
localRefresh(item.type);
+ dispatch({type: ACTIONS.PINNED});
},
close: false,
check: true,
diff --git a/apps/mobile/src/components/Dialog/index.js b/apps/mobile/src/components/Dialog/index.js
index b0904513d..c38b42243 100644
--- a/apps/mobile/src/components/Dialog/index.js
+++ b/apps/mobile/src/components/Dialog/index.js
@@ -15,6 +15,7 @@ import Icon from 'react-native-vector-icons/Feather';
import {getElevation, ToastEvent} from '../../utils/utils';
import {dialogActions, updateEvent} from '../DialogManager';
import {db} from '../../../App';
+import {ACTIONS} from '../../provider';
export class Dialog extends Component {
constructor(props) {
@@ -44,6 +45,16 @@ export class Dialog extends Component {
});
NavigationService.goBack();
+ break;
+ }
+ case dialogActions.ACTION_EMPTY_TRASH: {
+ await db.clearTrash();
+ updateEvent({type: ACTIONS.TRASH});
+ ToastEvent.show('Trash cleared', 'success', 1000, () => {}, '');
+ this.setState({
+ visible: false,
+ });
+
break;
}
}