[MM-19927] Fix launching app from push notification on iOS (#3527)
* Call getInitialNotification on configure * Mock getInitialNotification
This commit is contained in:
parent
f2c47def31
commit
5360989336
2 changed files with 17 additions and 0 deletions
|
|
@ -66,6 +66,22 @@ class PushNotification {
|
|||
this.onReply = options.onReply;
|
||||
|
||||
this.requestNotificationReplyPermissions();
|
||||
|
||||
if (options.popInitialNotification) {
|
||||
NotificationsIOS.getInitialNotification().
|
||||
then((notification) => {
|
||||
if (notification) {
|
||||
const data = notification.getData();
|
||||
if (data) {
|
||||
ephemeralStore.appStartedFromPushNotification = true;
|
||||
this.handleNotification(data, false, true);
|
||||
}
|
||||
}
|
||||
}).
|
||||
catch((err) => {
|
||||
console.log('iOS getInitialNotifiation() failed', err); //eslint-disable-line no-console
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
requestNotificationReplyPermissions = () => {
|
||||
|
|
|
|||
|
|
@ -33,6 +33,7 @@ jest.mock('react-native-notifications', () => {
|
|||
NotificationAction: jest.fn(),
|
||||
NotificationCategory: jest.fn(),
|
||||
localNotification: jest.fn(),
|
||||
getInitialNotification: jest.fn(() => Promise.resolve()),
|
||||
};
|
||||
});
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue