mirror of
https://github.com/ecency/ecency-mobile.git
synced 2025-01-07 06:32:02 +03:00
Refactored #466
This commit is contained in:
parent
98287110ff
commit
15cc7f3581
@ -161,43 +161,35 @@ const RootContainer = () => (WrappedComponent) => {
|
|||||||
|
|
||||||
_createPushListener = () => {
|
_createPushListener = () => {
|
||||||
const { navigation } = this.props;
|
const { navigation } = this.props;
|
||||||
|
let params = null;
|
||||||
|
let key = null;
|
||||||
|
let routeName = null;
|
||||||
|
|
||||||
Push.setListener({
|
Push.setListener({
|
||||||
onPushNotificationReceived(pushNotification) {
|
onPushNotificationReceived(pushNotification) {
|
||||||
const extra = JSON.parse(pushNotification.customProperties.extra);
|
const extra = JSON.parse(pushNotification.customProperties.extra);
|
||||||
if (extra.parent_permlink) {
|
|
||||||
setTimeout(() => {
|
if (extra.parent_permlink || extra.permlink) {
|
||||||
navigation.navigate({
|
params = {
|
||||||
routeName: ROUTES.SCREENS.POST,
|
author:
|
||||||
params: {
|
extra.parent_permlink
|
||||||
author: extra.parent_author,
|
? extra.parent_author
|
||||||
permlink: extra.parent_permlink,
|
: pushNotification.customProperties.target,
|
||||||
},
|
permlink: extra.parent_permlink ? extra.parent_permlink : extra.permlink,
|
||||||
key: extra.parent_permlink,
|
};
|
||||||
});
|
key = extra.parent_permlink ? extra.parent_permlink : extra.permlink;
|
||||||
}, 4000);
|
routeName = ROUTES.SCREENS.POST;
|
||||||
} else if (extra.permlink) {
|
|
||||||
setTimeout(() => {
|
|
||||||
navigation.navigate({
|
|
||||||
routeName: ROUTES.SCREENS.POST,
|
|
||||||
params: {
|
|
||||||
author: pushNotification.customProperties.target,
|
|
||||||
permlink: extra.permlink,
|
|
||||||
},
|
|
||||||
key: extra.permlink,
|
|
||||||
});
|
|
||||||
}, 4000);
|
|
||||||
} else {
|
} else {
|
||||||
setTimeout(() => {
|
params = {
|
||||||
navigation.navigate({
|
username: pushNotification.customProperties.source,
|
||||||
routeName: ROUTES.SCREENS.PROFILE,
|
};
|
||||||
params: {
|
key = pushNotification.customProperties.source;
|
||||||
username: pushNotification.customProperties.source,
|
routeName = ROUTES.SCREENS.PROFILE;
|
||||||
},
|
|
||||||
key: pushNotification.customProperties.source,
|
|
||||||
});
|
|
||||||
}, 4000);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
setTimeout(() => {
|
||||||
|
navigation.navigate({ routeName, params, key });
|
||||||
|
}, 4000);
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user