diff --git a/app/definitions/INotification.ts b/app/definitions/INotification.ts index 77467d9d..4974b0c9 100644 --- a/app/definitions/INotification.ts +++ b/app/definitions/INotification.ts @@ -9,4 +9,5 @@ export interface INotification { from: string; image: string; soundname: string; + getData: () => INotification; } diff --git a/app/notifications/push/index.ts b/app/notifications/push/index.ts index af25c9ee..09fa8602 100644 --- a/app/notifications/push/index.ts +++ b/app/notifications/push/index.ts @@ -16,9 +16,10 @@ interface IEjson { messageId: string; } -export const onNotification = (notification: INotification): void => { - if (notification) { +export const onNotification = (push: INotification): void => { + if (push) { try { + const notification = push?.getData(); const { rid, name, sender, type, host, messageType, messageId }: IEjson = EJSON.parse(notification.ejson); const types: Record = { diff --git a/app/notifications/push/push.ios.ts b/app/notifications/push/push.ios.ts index 92c2d3a6..a6b1118c 100644 --- a/app/notifications/push/push.ios.ts +++ b/app/notifications/push/push.ios.ts @@ -22,7 +22,7 @@ class PushNotification { // TODO REDUX MIGRATION TO TS const { background } = reduxStore.getState().app; if (background) { - this.onNotification(notification?.getData()); + this.onNotification(notification); } completion(); }); diff --git a/app/notifications/push/push.ts b/app/notifications/push/push.ts index 16aa8cf5..11eccbcb 100644 --- a/app/notifications/push/push.ts +++ b/app/notifications/push/push.ts @@ -16,7 +16,7 @@ class PushNotification { }); NotificationsAndroid.setNotificationOpenedListener((notification: Notification) => { - this.onNotification(notification?.getData()); + this.onNotification(notification); }); }