diff --git a/app/push_notifications/push_notifications.ios.js b/app/push_notifications/push_notifications.ios.js index 7036cca99..b04850f0c 100644 --- a/app/push_notifications/push_notifications.ios.js +++ b/app/push_notifications/push_notifications.ios.js @@ -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 = () => { diff --git a/app/utils/push_notifications.test.js b/app/utils/push_notifications.test.js index f61eca441..fa748c6a4 100644 --- a/app/utils/push_notifications.test.js +++ b/app/utils/push_notifications.test.js @@ -33,6 +33,7 @@ jest.mock('react-native-notifications', () => { NotificationAction: jest.fn(), NotificationCategory: jest.fn(), localNotification: jest.fn(), + getInitialNotification: jest.fn(() => Promise.resolve()), }; });