From 2c2cf65a0c30c9a53cf74ca92ab622f7f3791812 Mon Sep 17 00:00:00 2001 From: Alex Zolotarev Date: Tue, 8 Sep 2015 12:08:35 -0700 Subject: [PATCH] =?UTF-8?q?[ios]=20Correctly=20handle=20return=20value=20f?= =?UTF-8?q?or=20application:didFinishLaunchingWithOptions:=20@TODO:=20Shou?= =?UTF-8?q?ld=20we=20return=20immediately=20and=20do=20nothing=20if=20we?= =?UTF-8?q?=20have=20an=20url=20but=20can=E2=80=99t=20handle=20it=3F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- iphone/Maps/Classes/MapsAppDelegate.mm | 15 +++++++++------ iphone/Maps/Statistics/Statistics.h | 2 +- iphone/Maps/Statistics/Statistics.mm | 6 +++--- 3 files changed, 13 insertions(+), 10 deletions(-) diff --git a/iphone/Maps/Classes/MapsAppDelegate.mm b/iphone/Maps/Classes/MapsAppDelegate.mm index dd3ba1440a..dade6af005 100644 --- a/iphone/Maps/Classes/MapsAppDelegate.mm +++ b/iphone/Maps/Classes/MapsAppDelegate.mm @@ -156,12 +156,15 @@ void InitLocalizedStrings() - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { // Initialize all 3party engines. - [[Statistics instance] application:application didFinishLaunchingWithOptions:launchOptions]; + BOOL returnValue = [[Statistics instance] application:application + didFinishLaunchingWithOptions:launchOptions]; + + NSURL * urlUsedToLaunchMaps = launchOptions[UIApplicationLaunchOptionsURLKey]; + if (urlUsedToLaunchMaps != nil) + returnValue |= [self checkLaunchURL:urlUsedToLaunchMaps]; + else + returnValue = YES; - NSURL * url = launchOptions[UIApplicationLaunchOptionsURLKey]; - if (url != nil) - [self checkLaunchURL:url]; - [HttpThread setDownloadIndicatorProtocol:[MapsAppDelegate theApp]]; [self trackWatchUser]; @@ -215,7 +218,7 @@ void InitLocalizedStrings() application.applicationIconBadgeNumber = f.GetCountryTree().GetActiveMapLayout().GetOutOfDateCount(); f.GetLocationState()->InvalidatePosition(); - return YES; + return returnValue; } - (void)application:(UIApplication *)application performFetchWithCompletionHandler:(void (^)(UIBackgroundFetchResult))completionHandler diff --git a/iphone/Maps/Statistics/Statistics.h b/iphone/Maps/Statistics/Statistics.h index ee6a8046d0..cc64b8f8a1 100644 --- a/iphone/Maps/Statistics/Statistics.h +++ b/iphone/Maps/Statistics/Statistics.h @@ -6,7 +6,7 @@ - (void)disableOnNextAppLaunch; // Should be called from the same method in AppDelegate. -- (void)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions; +- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions; // Should be called from the same method in AppDelegate. - (void)applicationDidBecomeActive; - (void)logEvent:(NSString *)eventName; diff --git a/iphone/Maps/Statistics/Statistics.mm b/iphone/Maps/Statistics/Statistics.mm index bf28a5f639..025abdbc4f 100644 --- a/iphone/Maps/Statistics/Statistics.mm +++ b/iphone/Maps/Statistics/Statistics.mm @@ -70,15 +70,13 @@ char const * kStatisticsEnabledSettingsKey = "StatisticsEnabled"; [Alohalytics logEvent:@"statisticsDisabled"]; } -- (void)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions +- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { // _enabled should be already correctly set up in init method. if (_enabled) { [Flurry startSession:[[NSBundle mainBundle] objectForInfoDictionaryKey:@"FlurryKey"]]; - [[FBSDKApplicationDelegate sharedInstance] application:application didFinishLaunchingWithOptions:launchOptions]; - [MRMyTracker createTracker:@"***REMOVED***"]; #ifdef DEBUG [MRMyTracker setDebugMode:YES]; @@ -88,6 +86,8 @@ char const * kStatisticsEnabledSettingsKey = "StatisticsEnabled"; [Alohalytics setup:@"http://localhost:8080" withLaunchOptions:launchOptions]; } + // Always call Facebook method, looks like it is required to handle some url schemes and sign on scenarios. + return [[FBSDKApplicationDelegate sharedInstance] application:application didFinishLaunchingWithOptions:launchOptions]; } - (void)logLocation:(CLLocation *)location