[FIX] App crashes when opening a notification while app is closed (#3629)
This commit is contained in:
parent
2946c4724e
commit
9d25636cf4
|
@ -9,4 +9,5 @@ export interface INotification {
|
|||
from: string;
|
||||
image: string;
|
||||
soundname: string;
|
||||
getData: () => INotification;
|
||||
}
|
||||
|
|
|
@ -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<string, string> = {
|
||||
|
|
|
@ -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();
|
||||
});
|
||||
|
|
|
@ -16,7 +16,7 @@ class PushNotification {
|
|||
});
|
||||
|
||||
NotificationsAndroid.setNotificationOpenedListener((notification: Notification) => {
|
||||
this.onNotification(notification?.getData());
|
||||
this.onNotification(notification);
|
||||
});
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue