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 = () => {
|
||||
const { navigation } = this.props;
|
||||
let params = null;
|
||||
let key = null;
|
||||
let routeName = null;
|
||||
|
||||
Push.setListener({
|
||||
onPushNotificationReceived(pushNotification) {
|
||||
if (AppState.currentState === 'background') {
|
||||
if (pushNotification.customProperties.routeName) {
|
||||
navigation.navigate({
|
||||
routeName: pushNotification.customProperties.routeName,
|
||||
});
|
||||
const extra = JSON.parse(pushNotification.customProperties.extra);
|
||||
|
||||
if (extra.parent_permlink || extra.permlink) {
|
||||
params = {
|
||||
author:
|
||||
extra.parent_permlink
|
||||
? extra.parent_author
|
||||
: 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 {
|
||||
navigation.navigate({
|
||||
routeName: ROUTES.TABBAR.NOTIFICATION,
|
||||
});
|
||||
}
|
||||
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