some minor changes

This commit is contained in:
ammarahm-ed
2020-12-16 20:02:24 +05:00
parent e69756dd65
commit d7a64bf957
4 changed files with 29 additions and 11 deletions

View File

@@ -36,8 +36,10 @@ import {
eClosePremiumDialog, eClosePremiumDialog,
eDispatchAction, eDispatchAction,
eOnLoadNote, eOnLoadNote,
eOpenLoginDialog,
eOpenPendingDialog, eOpenPendingDialog,
eOpenPremiumDialog, eOpenPremiumDialog,
eOpenProgressDialog,
eOpenSideMenu, eOpenSideMenu,
eShowGetPremium, eShowGetPremium,
eStartSyncer, eStartSyncer,
@@ -270,6 +272,18 @@ const App = () => {
} }
}; };
const onLogout = (reason) => {
eSendEvent(eOpenProgressDialog, {
title: 'User Logged Out',
paragraph: reason,
action: () => {
eSendEvent(eOpenLoginDialog);
},
actionText: 'Login Again',
noProgress: true,
});
};
useEffect(() => { useEffect(() => {
eSubscribeEvent(eStartSyncer, startSyncer); eSubscribeEvent(eStartSyncer, startSyncer);
eSubscribeEvent(eDispatchAction, (type) => { eSubscribeEvent(eDispatchAction, (type) => {
@@ -284,9 +298,11 @@ const App = () => {
let unsub = NetInfo.addEventListener(onNetworkStateChanged); let unsub = NetInfo.addEventListener(onNetworkStateChanged);
Linking.addEventListener('url', _handleIntent); Linking.addEventListener('url', _handleIntent);
EV.subscribe('db:sync', dbSync); EV.subscribe('db:sync', dbSync);
EV.subscribe('user:loggedOut', onLogout);
EV.subscribe('user:checkStatus', handlePremiumAccess); EV.subscribe('user:checkStatus', handlePremiumAccess);
return () => { return () => {
EV.unsubscribe('db:refresh', syncChanges); EV.unsubscribe('db:refresh', syncChanges);
EV.unsubscribe('user:loggedOut', onLogout);
EV.unsubscribe('db:sync', dbSync); EV.unsubscribe('db:sync', dbSync);
eUnSubscribeEvent(eStartSyncer, startSyncer); eUnSubscribeEvent(eStartSyncer, startSyncer);
eUnSubscribeEvent(eDispatchAction, (type) => { eUnSubscribeEvent(eDispatchAction, (type) => {
@@ -321,7 +337,7 @@ const App = () => {
db.notes.init().then(() => { db.notes.init().then(() => {
dispatch({type: Actions.NOTES}); dispatch({type: Actions.NOTES});
dispatch({type: Actions.FAVORITES}); dispatch({type: Actions.FAVORITES});
eSendEvent(refreshNotesPage) eSendEvent(refreshNotesPage);
dispatch({type: Actions.LOADING, loading: false}); dispatch({type: Actions.LOADING, loading: false});
SettingsService.setAppLoaded(); SettingsService.setAppLoaded();
}); });

View File

@@ -15,7 +15,7 @@ import {TEMPLATE_TRASH} from '../DialogManager/Templates';
import {db} from '../../utils/DB'; import {db} from '../../utils/DB';
import {DDS} from '../../services/DeviceDetection'; import {DDS} from '../../services/DeviceDetection';
import {tabBarRef} from '../../utils/Refs'; import {tabBarRef} from '../../utils/Refs';
import { notesnook } from '../../../e2e/test.ids'; import {notesnook} from '../../../e2e/test.ids';
export const NoteItemWrapper = ({item, index, isTrash = false}) => { export const NoteItemWrapper = ({item, index, isTrash = false}) => {
const [state, dispatch] = useTracked(); const [state, dispatch] = useTracked();
@@ -60,7 +60,6 @@ export const NoteItemWrapper = ({item, index, isTrash = false}) => {
}; };
const onPress = async () => { const onPress = async () => {
if (note.conflicted) { if (note.conflicted) {
eSendEvent(eShowMergeDialog, note); eSendEvent(eShowMergeDialog, note);
return; return;

View File

@@ -91,6 +91,8 @@ const SimpleList = ({
justifyContent: 'space-between', justifyContent: 'space-between',
paddingHorizontal: 12, paddingHorizontal: 12,
height: 35, height: 35,
backgroundColor: index === 1 ? colors.shade : colors.nav,
marginTop: index === 1 ? 0 : 5,
}}> }}>
<TouchableWithoutFeedback <TouchableWithoutFeedback
onPress={() => { onPress={() => {
@@ -103,15 +105,16 @@ const SimpleList = ({
height: '100%', height: '100%',
justifyContent: 'center', justifyContent: 'center',
}}> }}>
<Paragraph <Heading
color={colors.accent} color={colors.accent}
size={SIZE.sm}
style={{ style={{
minWidth: 60, minWidth: 60,
alignSelf: 'center', alignSelf: 'center',
textAlignVertical: 'center', textAlignVertical: 'center',
}}> }}>
{item.title} {item.title}
</Paragraph> </Heading>
</TouchableWithoutFeedback> </TouchableWithoutFeedback>
{index === 1 && sortMenuButton ? <HeaderMenu /> : null} {index === 1 && sortMenuButton ? <HeaderMenu /> : null}
</View> </View>
@@ -156,7 +159,7 @@ const SimpleList = ({
if (refreshCallback) { if (refreshCallback) {
refreshCallback(); refreshCallback();
} }
dispatch({type: Actions.LAST_SYNC,lastSync: await db.lastSynced()}); dispatch({type: Actions.LAST_SYNC, lastSync: await db.lastSynced()});
dispatch({type: Actions.ALL}); dispatch({type: Actions.ALL});
} }
}, []); }, []);
@@ -234,12 +237,12 @@ const SimpleList = ({
break; break;
case 'header': case 'header':
dim.width = width; dim.width = width;
dim.height = 35 * fontScale; dim.height = 40 * fontScale;
break; break;
case 'MAIN_HEADER': case 'MAIN_HEADER':
dim.width = width; dim.width = width;
dim.height = dim.height =
dataType === 'search' ? 0 : DDS.isLargeTablet() ? 50 : 200; dataType === 'search' ? 0 : DDS.isLargeTablet() ? 50 : 195;
break; break;
default: default:
dim.width = width; dim.width = width;

View File

@@ -18,7 +18,7 @@ export function setLoginMessage(dispatch) {
}, },
data: {}, data: {},
icon: 'account-outline', icon: 'account-outline',
type:"normal" type: 'normal',
}, },
}); });
} }
@@ -38,15 +38,15 @@ export function setEmailVerifyMessage(dispatch) {
action: () => { action: () => {
eSendEvent(eCloseProgressDialog); eSendEvent(eCloseProgressDialog);
}, },
actionText: 'Resend Confirmation Link',
noProgress: true, noProgress: true,
}); });
}, },
data: {}, data: {},
icon: 'alert', icon: 'alert',
type:"error" type: 'error',
}, },
}); });
} }
export function clearMessage(dispatch) { export function clearMessage(dispatch) {