|
71 | 71 |
|
72 | 72 | @implementation OneSignal
|
73 | 73 |
|
74 |
| -NSString* const ONESIGNAL_VERSION = @"020010"; |
| 74 | +NSString* const ONESIGNAL_VERSION = @"020011"; |
75 | 75 |
|
76 | 76 | static bool registeredWithApple = false; //Has attempted to register for push notifications with Apple.
|
77 | 77 | static OneSignalTrackIAP* trackIAPPurchase;
|
@@ -177,16 +177,22 @@ + (id)initWithLaunchOptions:(NSDictionary*)launchOptions appId:(NSString*)appId
|
177 | 177 |
|
178 | 178 | [OneSignalTracker onFocus:NO];
|
179 | 179 | }
|
| 180 | + |
| 181 | + /* |
| 182 | + * No need to call the handleNotificationOpened:userInfo as it will be called from the |
| 183 | + * application:didReceiveRemoteNotification:fetchCompletionHandler / userNotificationCenter:didReceiveNotificationResponse:withCompletionHandler (i10) |
| 184 | + */ |
180 | 185 |
|
181 | 186 | //If app opened from tap on notification or action
|
| 187 | +/* |
182 | 188 | NSDictionary* userInfo = [launchOptions objectForKey:UIApplicationLaunchOptionsRemoteNotificationKey];
|
183 | 189 | if(userInfo) {
|
184 | 190 | OSNotificationActionType type = Opened;
|
185 | 191 | if(userInfo[@"custom"][@"a"][@"actionSelected"] || userInfo[@"actionSelected"])
|
186 | 192 | type = ActionTaken;
|
187 | 193 | [self handleNotificationOpened:userInfo isActive:NO actionType:type displayType:Notification];
|
188 | 194 | }
|
189 |
| - |
| 195 | +*/ |
190 | 196 | [self clearBadgeCount:false];
|
191 | 197 |
|
192 | 198 | if ([OneSignalTrackIAP canTrack])
|
@@ -785,7 +791,7 @@ + (void)notificationOpened:(NSDictionary*)messageDict isActive:(BOOL)isActive {
|
785 | 791 | }
|
786 | 792 | else {
|
787 | 793 |
|
788 |
| - //app was in background and opened due to a tap on a notification or an action check what type |
| 794 | + //app was in background / not running and opened due to a tap on a notification or an action check what type |
789 | 795 | NSString* actionSelected = NULL;
|
790 | 796 | OSNotificationActionType type = Opened;
|
791 | 797 | if(messageDict[@"custom"][@"a"][@"actionSelected"]) {
|
@@ -835,12 +841,11 @@ + (void) handleNotificationOpened:(NSDictionary*)messageDict isActive:(BOOL)isAc
|
835 | 841 | + (void)launchWebURL:(NSString*)openUrl {
|
836 | 842 |
|
837 | 843 | if (openUrl) {
|
838 |
| - if ([OneSignalHelper verifyURL:openUrl]) |
| 844 | + if ([OneSignalHelper verifyURL:openUrl]) { |
839 | 845 | //Create a dleay to allow alertview to dismiss before showing anything or going to safari
|
840 |
| - dispatch_after(dispatch_time(DISPATCH_TIME_NOW, 0.5 * NSEC_PER_SEC), dispatch_get_main_queue(), ^{ |
841 |
| - NSURL *url = [NSURL URLWithString:openUrl]; |
842 |
| - [OneSignalHelper displayWebView:url]; |
843 |
| - }); |
| 846 | + NSURL *url = [NSURL URLWithString:openUrl]; |
| 847 | + [OneSignalHelper performSelector:@selector(displayWebView:) withObject:url afterDelay:0.5]; |
| 848 | + } |
844 | 849 | }
|
845 | 850 |
|
846 | 851 | }
|
|
0 commit comments