File tree Expand file tree Collapse file tree 1 file changed +12
-1
lines changed
iOS_SDK/OneSignalSDK/Source Expand file tree Collapse file tree 1 file changed +12
-1
lines changed Original file line number Diff line number Diff line change @@ -192,7 +192,18 @@ - (void) oneSignalReceiveRemoteNotification:(UIApplication*)application UserInfo
192192 BOOL startedBackgroundJob = false ;
193193
194194 if ([OneSignal appId ]) {
195- if ([UIApplication sharedApplication ].applicationState == UIApplicationStateActive && userInfo[@" aps" ][@" alert" ])
195+ let appState = [UIApplication sharedApplication ].applicationState ;
196+ let isVisibleNotification = userInfo[@" aps" ][@" alert" ] != nil ;
197+
198+ // iOS 9 - Notification was tapped on
199+ // https://medium.com/posts-from-emmerge/ios-push-notification-background-fetch-demystified-7090358bb66e
200+ // - NOTE: We do not have the extra logic for the notifiation center or double tap home button cases
201+ // of "inactive" on notification received the link above describes.
202+ // Omiting that complex logic as iOS 9 usage stats are very low (12/11/2020) and these are rare cases.
203+ if ([OneSignalHelper isIOSVersionLessThan: @" 10.0" ] && appState == UIApplicationStateInactive && isVisibleNotification) {
204+ [OneSignal notificationReceived: userInfo wasOpened: YES ];
205+ }
206+ else if (appState == UIApplicationStateActive && isVisibleNotification)
196207 [OneSignal notificationReceived: userInfo wasOpened: NO ];
197208 else
198209 startedBackgroundJob = [OneSignal receiveRemoteNotification: application UserInfo: userInfo completionHandler: callExistingSelector ? nil : completionHandler];
You can’t perform that action at this time.
0 commit comments