Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
JSON.stringify(pushImageSummary),
)
await downloadAndUnzipIssue(pushImageSummary, screenSize)
await pushTracking('pushDownloadComplete', 'completed')
notificationTracking(notificationId, 'downloaded')
} catch (e) {
await pushTracking('pushDownloadError', JSON.stringify(e))
errorService.captureException(e)
} finally {
// No matter what happens, always clear up old issues
await clearOldIssues()
// required on iOS only (see fetchCompletionHandler docs: https://facebook.github.io/react-native/docs/pushnotificationios.html)
notification.finish(PushNotificationIOS.FetchResult.NoData)
}
}
},
senderID: defaultSettings.senderId,
onNotification: notification => {
this.onNotification(notification)
// https://facebook.github.io/react-native/docs/pushnotificationios.html
if (Platform.OS === 'ios') {
notification.finish(PushNotificationIOS.FetchResult.NoData)
}
},
// Android only
onNotification: notification => {
store.dispatch({type: NOTIFICATION_CLICKED})
// If we were able to set some data along with the notification (iOS), handle it!
const { data } = notification
if (data && data.conversationId)
Actions.conversation({conversationId: data.conversationId})
else if (data && data.bellId)
Actions.bells()
else
Actions.conversations()
// If we're on iOS, trigger the expected callback
if (Platform.OS === 'ios')
notification.finish(PushNotificationIOS.FetchResult.NoData)
}
})
const onNotification = (notification: PushNotificationIOS) => {
if (!notification.foreground) {
// @ts-ignore
this.navigator.dispatch(
NavigationActions.navigate({
routeName: routes.accountDetails,
params: {
accountRS: notification.data.accountRS
}
})
);
}
// required on iOS only (see fetchCompletionHandler docs:
// https://github.com/react-native-community/react-native-push-notification-ios)
notification.finish(PushNotificationIOS.FetchResult.NoData);
};