[ios] Added open url on push notification support.

This commit is contained in:
Ilya Grechuhin 2015-08-12 17:03:39 +03:00 committed by Alex Zolotarev
parent 4750ab6eea
commit 1795bc50a0

View file

@ -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.