Skip to content

Commit

Permalink
Fixed bug where OSHandleNotificationActionBlock does not get called i…
Browse files Browse the repository at this point in the history
…n iOS 10+ devices when app in foregound, OSNotificationDisplayType set to @(Notification).
  • Loading branch information
Joseph Kalash committed Sep 28, 2016
1 parent 0648c3b commit 3162445
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
Binary file modified iOS_SDK/Framework/OneSignal.framework/Versions/A/OneSignal
Binary file not shown.
14 changes: 9 additions & 5 deletions iOS_SDK/OneSignal/OneSignal.m
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@

@implementation OneSignal

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

inAppAlert = [[[NSUserDefaults standardUserDefaults] objectForKey:@"ONESIGNAL_ALERT_OPTION"] intValue] == OSNotificationDisplayTypeInAppAlert;
int iaaoption = [[[NSUserDefaults standardUserDefaults] objectForKey:@"ONESIGNAL_ALERT_OPTION"] intValue];
inAppAlert = iaaoption == OSNotificationDisplayTypeInAppAlert;

[OneSignalHelper lastMessageReceived:messageDict];

Expand Down Expand Up @@ -825,7 +826,7 @@ + (void)notificationOpened:(NSDictionary*)messageDict isActive:(BOOL)isActive {
return;
}

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

Expand Down Expand Up @@ -1142,7 +1143,8 @@ - (void)userNotificationCenter:(id)center didReceiveNotificationResponse:(id)res
}

else {
BOOL isActive = [UIApplication sharedApplication].applicationState == UIApplicationStateActive;
BOOL isActive = [UIApplication sharedApplication].applicationState == UIApplicationStateActive &&
[[[NSUserDefaults standardUserDefaults] objectForKey:@"ONESIGNAL_ALERT_OPTION"] intValue] != OSNotificationDisplayTypeNotification;
[OneSignal notificationOpened:usrInfo isActive:isActive];
[OneSignal tunnelToDelegate:center :response :completionHandler];
return;
Expand Down Expand Up @@ -1173,7 +1175,9 @@ - (void)userNotificationCenter:(id)center didReceiveNotificationResponse:(id)res
userInfo[@"aps"] = @{ @"alert" : userInfo[@"m"] };
}

BOOL isActive = [UIApplication sharedApplication].applicationState == UIApplicationStateActive;
BOOL isActive = [UIApplication sharedApplication].applicationState == UIApplicationStateActive &&
[[[NSUserDefaults standardUserDefaults] objectForKey:@"ONESIGNAL_ALERT_OPTION"] intValue] != OSNotificationDisplayTypeNotification;


[OneSignal notificationOpened:userInfo isActive:isActive];
[OneSignal tunnelToDelegate:center :response :completionHandler];
Expand Down

0 comments on commit 3162445

Please sign in to comment.