mirror of
https://github.com/ecency/ecency-mobile.git
synced 2024-12-02 11:15:35 +03:00
commit
d2f0ec40d7
@ -161,20 +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) {
|
||||||
if (AppState.currentState === 'background') {
|
const extra = JSON.parse(pushNotification.customProperties.extra);
|
||||||
if (pushNotification.customProperties.routeName) {
|
|
||||||
navigation.navigate({
|
if (extra.parent_permlink || extra.permlink) {
|
||||||
routeName: pushNotification.customProperties.routeName,
|
params = {
|
||||||
});
|
author:
|
||||||
} else {
|
extra.parent_permlink
|
||||||
navigation.navigate({
|
? extra.parent_author
|
||||||
routeName: ROUTES.TABBAR.NOTIFICATION,
|
: pushNotification.customProperties.target,
|
||||||
});
|
permlink: extra.parent_permlink ? extra.parent_permlink : extra.permlink,
|
||||||
}
|
};
|
||||||
|
key = extra.parent_permlink ? extra.parent_permlink : extra.permlink;
|
||||||
|
routeName = ROUTES.SCREENS.POST;
|
||||||
|
} else {
|
||||||
|
params = {
|
||||||
|
username: pushNotification.customProperties.source,
|
||||||
|
};
|
||||||
|
key = pushNotification.customProperties.source;
|
||||||
|
routeName = ROUTES.SCREENS.PROFILE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
setTimeout(() => {
|
||||||
|
navigation.navigate({ routeName, params, key });
|
||||||
|
}, 4000);
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user