From 1503f33140e97090ccf53172853b4af10760deb0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Minh=20Nguy=E1=BB=85n?= Date: Fri, 8 May 2015 12:57:04 -0700 Subject: [PATCH] Predicate MGLMapboxEvents initialization on user opt-out --- platform/ios/MGLMapboxEvents.m | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/platform/ios/MGLMapboxEvents.m b/platform/ios/MGLMapboxEvents.m index 7890a7f53..1439293e2 100644 --- a/platform/ios/MGLMapboxEvents.m +++ b/platform/ios/MGLMapboxEvents.m @@ -225,6 +225,7 @@ NSString *const MGLEventGestureRotateStart = @"Rotation"; static MGLMapboxEvents *_sharedManager; dispatch_once(&onceToken, ^{ if ( ! NSProcessInfo.processInfo.mgl_isInterfaceBuilderDesignablesAgent && + [[NSUserDefaults standardUserDefaults] boolForKey:@"MGLMapboxMetricsEnabled"] && [[NSUserDefaults standardUserDefaults] integerForKey:@"MGLMapboxAccountType"] == 0) { void (^setupBlock)() = ^{ _sharedManager = [[self alloc] init]; @@ -330,12 +331,6 @@ NSString *const MGLEventGestureRotateStart = @"Rotation"; MGLMapboxEvents *strongSelf = weakSelf; if ( ! strongSelf) return; - // User has opted out - if (![[NSUserDefaults standardUserDefaults] boolForKey:@"MGLMapboxMetricsEnabled"]) { - [_eventQueue removeAllObjects]; - return; - } - // Metrics Collection Has Been Paused if (_paused) { return;