Skip to content

Commit 717fa41

Browse files
committed
Fixing notification received when App is Inactive
1 parent cd42203 commit 717fa41

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

iOS_SDK/OneSignalSDK/Source/OneSignal.m

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2243,15 +2243,14 @@ + (BOOL)remoteSilentNotification:(UIApplication*)application UserInfo:(NSDiction
22432243
}
22442244
}
22452245
// Method was called due to a tap on a notification - Fire open notification
2246-
else if (application.applicationState != UIApplicationStateBackground) {
2246+
else if (application.applicationState == UIApplicationStateActive) {
22472247
[OneSignalHelper lastMessageReceived:userInfo];
22482248

2249-
if (application.applicationState == UIApplicationStateActive)
2250-
[OneSignalHelper handleNotificationReceived:OSNotificationDisplayTypeNotification fromBackground:NO];
2251-
2252-
if (![OneSignalHelper isRemoteSilentNotification:userInfo])
2253-
[OneSignal notificationReceived:userInfo foreground:application.applicationState == UIApplicationStateActive isActive:NO wasOpened:YES];
2249+
[OneSignalHelper handleNotificationReceived:OSNotificationDisplayTypeNotification fromBackground:NO];
22542250

2251+
if (![OneSignalHelper isRemoteSilentNotification:userInfo]) {
2252+
[OneSignal notificationReceived:userInfo foreground:YES isActive:NO wasOpened:YES];
2253+
}
22552254
return startedBackgroundJob;
22562255
}
22572256
// content-available notification received in the background - Fire handleNotificationReceived block in app

0 commit comments

Comments
 (0)