add trash template

This commit is contained in:
ammarahm-ed
2020-01-18 00:45:37 +05:00
parent 462c76c55f
commit ab629b29d2
3 changed files with 15 additions and 3 deletions

View File

@@ -18,6 +18,7 @@ import {
_unSubscribeEvent, _unSubscribeEvent,
} from './src/components/DialogManager'; } from './src/components/DialogManager';
import {getColorScheme} from './src/common/common'; import {getColorScheme} from './src/common/common';
import {useAppContext} from './src/provider/useAppContext';
export const DDS = new DeviceDetectionService(); export const DDS = new DeviceDetectionService();
export const db = new Storage(StorageInterface); export const db = new Storage(StorageInterface);
@@ -25,8 +26,7 @@ export const db = new Storage(StorageInterface);
let sideMenuRef; let sideMenuRef;
const App = () => { const App = () => {
const [state, dispatch] = useTracked(); const [state, dispatch] = useTracked();
const {colors} = state; const [colors] = state;
// Local State // Local State
const [sidebar, setSidebar] = useState(w * 0.3); const [sidebar, setSidebar] = useState(w * 0.3);
const [init, setInit] = useState(false); const [init, setInit] = useState(false);

View File

@@ -20,7 +20,7 @@ import Icon from 'react-native-vector-icons/Feather';
import NavigationService from '../../services/NavigationService'; import NavigationService from '../../services/NavigationService';
import {db} from '../../../App'; import {db} from '../../../App';
import FastStorage from 'react-native-fast-storage'; import FastStorage from 'react-native-fast-storage';
import {useTracked} from '../../provider'; import {useTracked, ACTIONS} from '../../provider';
const w = Dimensions.get('window').width; const w = Dimensions.get('window').width;
const h = Dimensions.get('window').height; const h = Dimensions.get('window').height;
@@ -260,6 +260,7 @@ export const ActionSheetComponent = ({
if (!note.dateCreated) return; if (!note.dateCreated) return;
db.pinItem(note.type, note.dateCreated); db.pinItem(note.type, note.dateCreated);
localRefresh(item.type); localRefresh(item.type);
dispatch({type: ACTIONS.PINNED});
}, },
close: false, close: false,
check: true, check: true,

View File

@@ -15,6 +15,7 @@ import Icon from 'react-native-vector-icons/Feather';
import {getElevation, ToastEvent} from '../../utils/utils'; import {getElevation, ToastEvent} from '../../utils/utils';
import {dialogActions, updateEvent} from '../DialogManager'; import {dialogActions, updateEvent} from '../DialogManager';
import {db} from '../../../App'; import {db} from '../../../App';
import {ACTIONS} from '../../provider';
export class Dialog extends Component { export class Dialog extends Component {
constructor(props) { constructor(props) {
@@ -44,6 +45,16 @@ export class Dialog extends Component {
}); });
NavigationService.goBack(); 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; break;
} }
} }