diff options
author | Ilya Grechuhin <i.grechuhin@mapswithme.com> | 2015-08-12 17:03:39 +0300 |
---|---|---|
committer | Alex Zolotarev <alex@maps.me> | 2015-09-23 03:01:08 +0300 |
commit | 1795bc50a08f7b2750abaa213b5fc4977a1fed20 (patch) | |
tree | 36c4ba9464b99dc2ad7751d9a57a97b210f8f745 /iphone/Maps/Classes/MapsAppDelegate.mm | |
parent | 4750ab6eea1f50f86b8a2ad3de1ef234d44c98f0 (diff) |
[ios] Added open url on push notification support.
Diffstat (limited to 'iphone/Maps/Classes/MapsAppDelegate.mm')
-rw-r--r-- | iphone/Maps/Classes/MapsAppDelegate.mm | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/iphone/Maps/Classes/MapsAppDelegate.mm b/iphone/Maps/Classes/MapsAppDelegate.mm index 6f13569df7..e923ce04d7 100644 --- a/iphone/Maps/Classes/MapsAppDelegate.mm +++ b/iphone/Maps/Classes/MapsAppDelegate.mm @@ -153,10 +153,23 @@ void InitLocalizedStrings() - (void)application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)userInfo fetchCompletionHandler:(void (^)(UIBackgroundFetchResult))completionHandler { [Statistics.instance logEvent:@"Push received" withParameters:userInfo]; - [PFPush handlePush:userInfo]; + if (![self handleURLPush:userInfo]) + [PFPush handlePush:userInfo]; completionHandler(UIBackgroundFetchResultNoData); } +- (BOOL)handleURLPush:(NSDictionary *)userInfo +{ + auto app = UIApplication.sharedApplication; + if (app.applicationState != UIApplicationStateInactive) + return NO; + NSString * openLink = userInfo[@"openURL"]; + if (!openLink) + return NO; + [app openURL:[NSURL URLWithString:openLink]]; + return YES; +} + - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { // Initialize Alohalytics statistics engine. |