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