mirror of
https://github.com/streetwriters/notesnook.git
synced 2025-12-25 16:09:42 +01:00
update
This commit is contained in:
@@ -540,7 +540,7 @@ export const Menu = ({
|
||||
))}
|
||||
</View>
|
||||
|
||||
{!user && !user.username ? (
|
||||
{user && user.username ? (
|
||||
<View
|
||||
style={{
|
||||
width: '100%',
|
||||
|
||||
@@ -199,8 +199,7 @@ export const NotesList = ({isGrouped = false}) => {
|
||||
await db.sync();
|
||||
dispatch({type: ACTIONS.NOTES});
|
||||
dispatch({type: ACTIONS.PINNED});
|
||||
dispatch({type: ACTIONS.FAVORITES});
|
||||
|
||||
dispatch({type: ACTIONS.USER});
|
||||
setRefreshing(false);
|
||||
ToastEvent.show('Sync Complete', 'success');
|
||||
} catch (e) {
|
||||
|
||||
@@ -10,6 +10,7 @@ import {useTracked} from '../../provider';
|
||||
import {ACTIONS} from '../../provider/actions';
|
||||
import {eSendEvent} from '../../services/eventManager';
|
||||
import {eScrollEvent} from '../../services/events';
|
||||
import {ToastEvent} from '../../utils/utils';
|
||||
|
||||
export const Favorites = ({navigation}) => {
|
||||
const [state, dispatch] = useTracked();
|
||||
@@ -40,11 +41,19 @@ export const Favorites = ({navigation}) => {
|
||||
tintColor={colors.accent}
|
||||
colors={[colors.accent]}
|
||||
progressViewOffset={165}
|
||||
onRefresh={() => {
|
||||
onRefresh={async () => {
|
||||
setRefreshing(true);
|
||||
setTimeout(() => {
|
||||
try {
|
||||
await db.sync();
|
||||
|
||||
dispatch({type: ACTIONS.FAVORITES});
|
||||
dispatch({type: ACTIONS.USER});
|
||||
setRefreshing(false);
|
||||
}, 1000);
|
||||
ToastEvent.show('Sync Complete', 'success');
|
||||
} catch (e) {
|
||||
setRefreshing(false);
|
||||
ToastEvent.show('Sync failed, network error', 'error');
|
||||
}
|
||||
}}
|
||||
refreshing={refreshing}
|
||||
/>
|
||||
|
||||
@@ -20,7 +20,7 @@ import {ACTIONS} from '../../provider/actions';
|
||||
import {eSendEvent} from '../../services/eventManager';
|
||||
import {eScrollEvent} from '../../services/events';
|
||||
import {slideLeft, slideRight} from '../../utils/animations';
|
||||
import {w} from '../../utils/utils';
|
||||
import {w, ToastEvent} from '../../utils/utils';
|
||||
|
||||
export const Folders = ({navigation}) => {
|
||||
const [state, dispatch] = useTracked();
|
||||
@@ -95,11 +95,19 @@ export const Folders = ({navigation}) => {
|
||||
tintColor={colors.accent}
|
||||
colors={[colors.accent]}
|
||||
progressViewOffset={165}
|
||||
onRefresh={() => {
|
||||
onRefresh={async () => {
|
||||
setRefreshing(true);
|
||||
setTimeout(() => {
|
||||
try {
|
||||
await db.sync();
|
||||
dispatch({type: ACTIONS.NOTEBOOKS});
|
||||
dispatch({type: ACTIONS.PINNED});
|
||||
dispatch({type: ACTIONS.USER});
|
||||
setRefreshing(false);
|
||||
}, 1000);
|
||||
ToastEvent.show('Sync Complete', 'success');
|
||||
} catch (e) {
|
||||
setRefreshing(false);
|
||||
ToastEvent.show('Sync failed, network error', 'error');
|
||||
}
|
||||
}}
|
||||
refreshing={refreshing}
|
||||
/>
|
||||
|
||||
@@ -18,6 +18,7 @@ import {
|
||||
eOnNewTopicAdded,
|
||||
eScrollEvent,
|
||||
} from '../../services/events';
|
||||
import {ToastEvent} from '../../utils/utils';
|
||||
|
||||
export const Notebook = ({navigation}) => {
|
||||
const [state, dispatch] = useTracked();
|
||||
@@ -157,11 +158,19 @@ export const Notebook = ({navigation}) => {
|
||||
tintColor={colors.accent}
|
||||
colors={[colors.accent]}
|
||||
progressViewOffset={165}
|
||||
onRefresh={() => {
|
||||
onRefresh={async () => {
|
||||
setRefreshing(true);
|
||||
setTimeout(() => {
|
||||
try {
|
||||
await db.sync();
|
||||
|
||||
onLoad();
|
||||
dispatch({type: ACTIONS.USER});
|
||||
setRefreshing(false);
|
||||
}, 1000);
|
||||
ToastEvent.show('Sync Complete', 'success');
|
||||
} catch (e) {
|
||||
setRefreshing(false);
|
||||
ToastEvent.show('Sync failed, network error', 'error');
|
||||
}
|
||||
}}
|
||||
refreshing={refreshing}
|
||||
/>
|
||||
|
||||
@@ -7,6 +7,7 @@ import SelectionWrapper from '../../components/SelectionWrapper';
|
||||
import {useTracked} from '../../provider';
|
||||
import {SIZE, WEIGHT} from '../../common/common';
|
||||
import {ACTIONS} from '../../provider/actions';
|
||||
import {ToastEvent} from '../../utils/utils';
|
||||
|
||||
export const Notes = ({navigation}) => {
|
||||
const [state, dispatch] = useTracked();
|
||||
@@ -24,14 +25,14 @@ export const Notes = ({navigation}) => {
|
||||
}
|
||||
}, []);
|
||||
|
||||
useEffect(() => {
|
||||
const init = () => {
|
||||
eSendEvent(eScrollEvent, 0);
|
||||
if (params.type === 'tag') {
|
||||
let notesInTag = db.notes.tagged(params.tag.title);
|
||||
setNotes([...notesInTag]);
|
||||
} else if (params.type == 'color') {
|
||||
let notesInColors = db.notes.colored(params.color.id);
|
||||
console.log(notesInColors);
|
||||
|
||||
setNotes([...notesInColors]);
|
||||
//setNotes(...);
|
||||
} else {
|
||||
@@ -42,6 +43,10 @@ export const Notes = ({navigation}) => {
|
||||
setNotes(allNotes);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
useEffect(() => {
|
||||
init();
|
||||
}, [allNotes, colorNotes]);
|
||||
|
||||
const _renderItem = ({item, index}) => (
|
||||
@@ -135,11 +140,19 @@ export const Notes = ({navigation}) => {
|
||||
tintColor={colors.accent}
|
||||
colors={[colors.accent]}
|
||||
progressViewOffset={165}
|
||||
onRefresh={() => {
|
||||
onRefresh={async () => {
|
||||
setRefreshing(true);
|
||||
setTimeout(() => {
|
||||
try {
|
||||
await db.sync();
|
||||
|
||||
init();
|
||||
dispatch({type: ACTIONS.USER});
|
||||
setRefreshing(false);
|
||||
}, 1000);
|
||||
ToastEvent.show('Sync Complete', 'success');
|
||||
} catch (e) {
|
||||
setRefreshing(false);
|
||||
ToastEvent.show('Sync failed, network error', 'error');
|
||||
}
|
||||
}}
|
||||
refreshing={refreshing}
|
||||
/>
|
||||
|
||||
@@ -14,6 +14,7 @@ import {TagsPlaceHolder} from '../../components/ListPlaceholders';
|
||||
import {useTracked} from '../../provider';
|
||||
import {ACTIONS} from '../../provider/actions';
|
||||
import NavigationService from '../../services/NavigationService';
|
||||
import {ToastEvent} from '../../utils/utils';
|
||||
const w = Dimensions.get('window').width;
|
||||
const h = Dimensions.get('window').height;
|
||||
|
||||
@@ -63,11 +64,19 @@ export const Tags = ({navigation}) => {
|
||||
tintColor={colors.accent}
|
||||
colors={[colors.accent]}
|
||||
progressViewOffset={165}
|
||||
onRefresh={() => {
|
||||
onRefresh={async () => {
|
||||
setRefreshing(true);
|
||||
setTimeout(() => {
|
||||
try {
|
||||
await db.sync();
|
||||
|
||||
dispatch({type: ACTIONS.TAGS});
|
||||
dispatch({type: ACTIONS.USER});
|
||||
setRefreshing(false);
|
||||
}, 1000);
|
||||
ToastEvent.show('Sync Complete', 'success');
|
||||
} catch (e) {
|
||||
setRefreshing(false);
|
||||
ToastEvent.show('Sync failed, network error', 'error');
|
||||
}
|
||||
}}
|
||||
refreshing={refreshing}
|
||||
/>
|
||||
|
||||
@@ -11,7 +11,7 @@ import {NotebookItem} from '../../components/NotebookItem';
|
||||
import NoteItem from '../../components/NoteItem';
|
||||
import {useTracked} from '../../provider';
|
||||
import {ACTIONS} from '../../provider/actions';
|
||||
import {w} from '../../utils/utils';
|
||||
import {w, ToastEvent} from '../../utils/utils';
|
||||
import SelectionWrapper from '../../components/SelectionWrapper';
|
||||
|
||||
export const Trash = ({navigation}) => {
|
||||
@@ -111,11 +111,19 @@ export const Trash = ({navigation}) => {
|
||||
tintColor={colors.accent}
|
||||
colors={[colors.accent]}
|
||||
progressViewOffset={165}
|
||||
onRefresh={() => {
|
||||
onRefresh={async () => {
|
||||
setRefreshing(true);
|
||||
setTimeout(() => {
|
||||
try {
|
||||
await db.sync();
|
||||
|
||||
dispatch({type: ACTIONS.TRASH});
|
||||
dispatch({type: ACTIONS.USER});
|
||||
setRefreshing(false);
|
||||
}, 1000);
|
||||
ToastEvent.show('Sync Complete', 'success');
|
||||
} catch (e) {
|
||||
setRefreshing(false);
|
||||
ToastEvent.show('Sync failed, network error', 'error');
|
||||
}
|
||||
}}
|
||||
refreshing={refreshing}
|
||||
/>
|
||||
|
||||
Reference in New Issue
Block a user