forked from organicmaps/organicmaps
[ios] Added open url on push notification support.
This commit is contained in:
parent
4750ab6eea
commit
1795bc50a0
1 changed files with 14 additions and 1 deletions
|
@ -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.
|
||||
|
|
Loading…
Add table
Reference in a new issue