Skip to content

Commit 3162445

Browse files
author
Joseph Kalash
committed
Fixed bug where OSHandleNotificationActionBlock does not get called in iOS 10+ devices when app in foregound, OSNotificationDisplayType set to @(Notification).
1 parent 0648c3b commit 3162445

File tree

2 files changed

+9
-5
lines changed

2 files changed

+9
-5
lines changed
9.05 KB
Binary file not shown.

iOS_SDK/OneSignal/OneSignal.m

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@
7575

7676
@implementation OneSignal
7777

78-
NSString* const ONESIGNAL_VERSION = @"020114";
78+
NSString* const ONESIGNAL_VERSION = @"020115";
7979
static NSString* mSDKType = @"native";
8080
static BOOL coldStartFromTapOnNotification = NO;
8181
static BOOL registeredWithApple = NO; //Has attempted to register for push notifications with Apple.
@@ -794,7 +794,8 @@ + (void)notificationOpened:(NSDictionary*)messageDict isActive:(BOOL)isActive {
794794
[[NSUserDefaults standardUserDefaults] synchronize];
795795
}
796796

797-
inAppAlert = [[[NSUserDefaults standardUserDefaults] objectForKey:@"ONESIGNAL_ALERT_OPTION"] intValue] == OSNotificationDisplayTypeInAppAlert;
797+
int iaaoption = [[[NSUserDefaults standardUserDefaults] objectForKey:@"ONESIGNAL_ALERT_OPTION"] intValue];
798+
inAppAlert = iaaoption == OSNotificationDisplayTypeInAppAlert;
798799

799800
[OneSignalHelper lastMessageReceived:messageDict];
800801

@@ -825,7 +826,7 @@ + (void)notificationOpened:(NSDictionary*)messageDict isActive:(BOOL)isActive {
825826
return;
826827
}
827828

828-
//App is active and a notification was received without inApp display. Display type is none
829+
//App is active and a notification was received without inApp display. Display type is none or notification
829830
//Call Received Block
830831
[OneSignalHelper handleNotificationReceived:[[[NSUserDefaults standardUserDefaults] objectForKey:@"ONESIGNAL_ALERT_OPTION"] intValue]];
831832

@@ -1142,7 +1143,8 @@ - (void)userNotificationCenter:(id)center didReceiveNotificationResponse:(id)res
11421143
}
11431144

11441145
else {
1145-
BOOL isActive = [UIApplication sharedApplication].applicationState == UIApplicationStateActive;
1146+
BOOL isActive = [UIApplication sharedApplication].applicationState == UIApplicationStateActive &&
1147+
[[[NSUserDefaults standardUserDefaults] objectForKey:@"ONESIGNAL_ALERT_OPTION"] intValue] != OSNotificationDisplayTypeNotification;
11461148
[OneSignal notificationOpened:usrInfo isActive:isActive];
11471149
[OneSignal tunnelToDelegate:center :response :completionHandler];
11481150
return;
@@ -1173,7 +1175,9 @@ - (void)userNotificationCenter:(id)center didReceiveNotificationResponse:(id)res
11731175
userInfo[@"aps"] = @{ @"alert" : userInfo[@"m"] };
11741176
}
11751177

1176-
BOOL isActive = [UIApplication sharedApplication].applicationState == UIApplicationStateActive;
1178+
BOOL isActive = [UIApplication sharedApplication].applicationState == UIApplicationStateActive &&
1179+
[[[NSUserDefaults standardUserDefaults] objectForKey:@"ONESIGNAL_ALERT_OPTION"] intValue] != OSNotificationDisplayTypeNotification;
1180+
11771181

11781182
[OneSignal notificationOpened:userInfo isActive:isActive];
11791183
[OneSignal tunnelToDelegate:center :response :completionHandler];

0 commit comments

Comments
 (0)