From 308d382bd28b0a03eb5bf427f9ff83316fea3c85 Mon Sep 17 00:00:00 2001 From: Brad Leege Date: Tue, 24 Mar 2015 11:33:08 -0500 Subject: #1033 - Building Mapbox Metrics Disabled UI in Settings.app and functionality in Events tracking infrastructure --- ios/app/Settings.bundle/Root.plist | 70 +++++++++++++++++++++++--------------- platform/ios/MGLMapboxEvents.m | 8 +++-- 2 files changed, 49 insertions(+), 29 deletions(-) diff --git a/ios/app/Settings.bundle/Root.plist b/ios/app/Settings.bundle/Root.plist index 513836e92f..e09c225913 100644 --- a/ios/app/Settings.bundle/Root.plist +++ b/ios/app/Settings.bundle/Root.plist @@ -1,31 +1,47 @@ - - PreferenceSpecifiers - - - Title - Privacy Settings - Type - PSGroupSpecifier - - - DefaultValue - - Key - mapbox_metrics_enabled_preference - Title - Mapbox Metrics - Type - PSToggleSwitchSpecifier - TrueValue - - FalseValue - - - - StringsTable - Root - + + PreferenceSpecifiers + + + Title + Privacy Settings + Type + PSGroupSpecifier + + + DefaultValue + + Key + mapbox_metrics_disabled + Title + Mapbox Metrics Are Disabled + Type + PSTitleValueSpecifier + TrueValue + + FalseValue + + + + + StringsTable + Root + diff --git a/platform/ios/MGLMapboxEvents.m b/platform/ios/MGLMapboxEvents.m index 11303bc0ec..a231b5115f 100644 --- a/platform/ios/MGLMapboxEvents.m +++ b/platform/ios/MGLMapboxEvents.m @@ -123,7 +123,12 @@ NSNumber *scale; return; } - // TODO - Add Metrics Disabled App Wide Check + // Add Metrics Disabled App Wide Check + if ([[NSUserDefaults standardUserDefaults] objectForKey:@"mapbox_metrics_disabled"] != nil) { + NSLog(@"Mapbox Metrics have been disabled for this app."); + [_queue removeAllObjects]; + return; + } if (!event) { return; @@ -173,7 +178,6 @@ NSNumber *scale; return; } - int upper = (int)_flushAt; if (_flushAt > [_queue count]) { if ([_queue count] == 0) { -- cgit v1.2.1