diff options
author | VladiMihaylenko <vxmihaylenko@gmail.com> | 2015-04-17 17:17:28 +0300 |
---|---|---|
committer | Alex Zolotarev <alex@maps.me> | 2015-09-23 02:46:07 +0300 |
commit | e7511c6b87a0d498352318f1aaefafdcf6504071 (patch) | |
tree | 9ffc4acb819df6a86d31dd7faf8a2947169fef7a /iphone/Maps/Classes/MapsAppDelegate.mm | |
parent | c58e7810549ea9b6cca2b3b3f8f56a5e7298f97e (diff) |
[ios] Fixed launch from url.
Diffstat (limited to 'iphone/Maps/Classes/MapsAppDelegate.mm')
-rw-r--r-- | iphone/Maps/Classes/MapsAppDelegate.mm | 51 |
1 files changed, 31 insertions, 20 deletions
diff --git a/iphone/Maps/Classes/MapsAppDelegate.mm b/iphone/Maps/Classes/MapsAppDelegate.mm index a42e6191f3..9b9e3b75fc 100644 --- a/iphone/Maps/Classes/MapsAppDelegate.mm +++ b/iphone/Maps/Classes/MapsAppDelegate.mm @@ -109,6 +109,11 @@ void InitLocalizedStrings() #else NSString * serverUrl = @"http://localhost:8080/2"; #endif + + NSURL *url = launchOptions[UIApplicationLaunchOptionsURLKey]; + if (url != nil) + [self checkLaunchURL:url]; + [Alohalytics setup:serverUrl andFirstLaunch:[MapsAppDelegate isFirstAppLaunch] withLaunchOptions:launchOptions]; [[Statistics instance] startSessionWithLaunchOptions:launchOptions]; @@ -354,28 +359,11 @@ void InitLocalizedStrings() // We don't support HandleOpenUrl as it's deprecated from iOS 4.2 - (BOOL)application:(UIApplication *)application openURL:(NSURL *)url sourceApplication:(NSString *)sourceApplication annotation:(id)annotation { - NSString * scheme = url.scheme; - - m_scheme = scheme; m_sourceApplication = sourceApplication; - - // geo scheme support, see http://tools.ietf.org/html/rfc5870 - if ([scheme isEqualToString:@"geo"] || [scheme isEqualToString:@"ge0"]) - { - m_geoURL = [url absoluteString]; - return YES; - } - else if ([scheme isEqualToString:@"mapswithme"] || [scheme isEqualToString:@"mwm"]) - { - m_mwmURL = [url absoluteString]; - return YES; - } - else if ([scheme isEqualToString:@"file"]) - { - m_fileURL = [url relativePath]; + + if ([self checkLaunchURL:url]) return YES; - } - NSLog(@"Scheme %@ is not supported", scheme); + if ([[[UIDevice currentDevice] systemVersion] integerValue] < 7) return NO; @@ -394,6 +382,29 @@ void InitLocalizedStrings() [NSTimer scheduledTimerWithTimeInterval:5.0 target:self selector:@selector(dismissAlert) userInfo:nil repeats:NO]; } +- (BOOL)checkLaunchURL:(NSURL *)url +{ + NSString *scheme = url.scheme; + m_scheme = scheme; + if ([scheme isEqualToString:@"geo"] || [scheme isEqualToString:@"ge0"]) + { + m_geoURL = [url absoluteString]; + return YES; + } + else if ([scheme isEqualToString:@"mapswithme"] || [scheme isEqualToString:@"mwm"]) + { + m_mwmURL = [url absoluteString]; + return YES; + } + else if ([scheme isEqualToString:@"file"]) + { + m_fileURL = [url relativePath]; + return YES; + } + NSLog(@"Scheme %@ is not supported", scheme); + return NO; +} + - (void)dismissAlert { if (m_loadingAlertView) |