summaryrefslogtreecommitdiff
path: root/platform
diff options
context:
space:
mode:
authorMinh Nguyễn <mxn@1ec5.org>2015-05-01 19:24:14 -0400
committerMinh Nguyễn <mxn@1ec5.org>2015-05-01 19:24:14 -0400
commit98dc0b6f81b1acf5ab30dc376a9ea44e9ed3923b (patch)
treeb71f7b76b32e4cc85c3452701b7c89000895b379 /platform
parentdac4b7d3c95f84358bd475e01aae45e2ca52ddc0 (diff)
downloadqtlocation-mapboxgl-98dc0b6f81b1acf5ab30dc376a9ea44e9ed3923b.tar.gz
Avoid creating MGLMapboxEvents when Metrics is disabled
Mapbox Metrics already has a bottleneck; might as well use it to avoid fetching data in the first place.
Diffstat (limited to 'platform')
-rw-r--r--platform/ios/MGLMapboxEvents.m11
1 files changed, 3 insertions, 8 deletions
diff --git a/platform/ios/MGLMapboxEvents.m b/platform/ios/MGLMapboxEvents.m
index be299daf90..36ed63d334 100644
--- a/platform/ios/MGLMapboxEvents.m
+++ b/platform/ios/MGLMapboxEvents.m
@@ -214,13 +214,14 @@ NSString *const MGLEventGestureRotateStart = @"Rotation";
}
// Can be called from any thread. Called implicitly from any
-// public class convenience methods.
+// public class convenience methods. May return nil if this feature is disabled.
//
+ (instancetype)sharedManager {
static dispatch_once_t onceToken;
static MGLMapboxEvents *_sharedManager;
dispatch_once(&onceToken, ^{
- if ( ! NSProcessInfo.processInfo.mgl_isInterfaceBuilderDesignablesAgent) {
+ if ( ! NSProcessInfo.processInfo.mgl_isInterfaceBuilderDesignablesAgent &&
+ [[NSUserDefaults standardUserDefaults] objectForKey:@"mapbox_metrics_disabled"] == nil) {
void (^setupBlock)() = ^{
_sharedManager = [[self alloc] init];
};
@@ -331,12 +332,6 @@ NSString *const MGLEventGestureRotateStart = @"Rotation";
return;
}
- // Add Metrics Disabled App Wide Check
- if ([[NSUserDefaults standardUserDefaults] objectForKey:@"mapbox_metrics_disabled"] != nil) {
- [_eventQueue removeAllObjects];
- return;
- }
-
// Metrics Collection Has Been Paused
if (_paused) {
return;