Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mapsme/omim.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlex Zolotarev <alex@maps.me>2015-09-02 04:48:35 +0300
committerAlex Zolotarev <alex@maps.me>2015-09-23 03:03:35 +0300
commitd569ea24c72f9e3949f53a8213d6f993c52f9e79 (patch)
tree62cdff93515536671e3eee67fcc86789702b61e9 /iphone/Maps/Classes
parent4fd3a63168e5ea81559a60c09cafdf60d19a827e (diff)
[ios] Implemented correct turning Alohalytics statistics off if user disabled it in settings.
Diffstat (limited to 'iphone/Maps/Classes')
-rw-r--r--iphone/Maps/Classes/MapsAppDelegate.mm14
1 files changed, 12 insertions, 2 deletions
diff --git a/iphone/Maps/Classes/MapsAppDelegate.mm b/iphone/Maps/Classes/MapsAppDelegate.mm
index c61daa03dc..9766a25806 100644
--- a/iphone/Maps/Classes/MapsAppDelegate.mm
+++ b/iphone/Maps/Classes/MapsAppDelegate.mm
@@ -171,13 +171,23 @@ void InitLocalizedStrings()
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
+ NSUserDefaults * ud = [NSUserDefaults standardUserDefaults];
// Initialize Alohalytics statistics engine.
#ifndef OMIM_PRODUCTION
[Alohalytics setDebugMode:YES];
#endif
[Alohalytics setup:@"http://localhost:8080" withLaunchOptions:launchOptions];
+ // Need to correctly support existing users who has already opted-out from statistics collection.
+ // TODO(AlexZ): Remove this code in a few releases after September 2nd, 2015.
+ NSString * const kOneTimeStatisticsDisabledCheck = @"AlohalyticsOneTimeStatisticsDisabledCheck";
+ if (![ud boolForKey:kOneTimeStatisticsDisabledCheck])
+ {
+ if (!Statistics.instance.enabled)
+ [Alohalytics disable];
+ [ud setBool:YES forKey:kOneTimeStatisticsDisabledCheck];
+ }
- NSURL *url = launchOptions[UIApplicationLaunchOptionsURLKey];
+ NSURL * url = launchOptions[UIApplicationLaunchOptionsURLKey];
if (url != nil)
[self checkLaunchURL:url];
@@ -235,7 +245,7 @@ void InitLocalizedStrings()
[self incrementSessionCount];
[self showAlertIfRequired];
}
- [[NSUserDefaults standardUserDefaults] synchronize];
+ [ud synchronize];
Framework & f = GetFramework();
application.applicationIconBadgeNumber = f.GetCountryTree().GetActiveMapLayout().GetOutOfDateCount();