summaryrefslogtreecommitdiff
path: root/platform
diff options
context:
space:
mode:
authorJason Wray <jason@mapbox.com>2016-05-21 14:55:33 -0400
committerJason Wray <jason@mapbox.com>2016-05-23 10:36:20 -0400
commit72bc22292f237c0714a1b13cc156117e5230b6bb (patch)
treef0fec57fca87e91591c1273850feb7fba722b76d /platform
parentdf1d63a2290269911a796bcdd8cbb31f9cb44251 (diff)
downloadqtlocation-mapboxgl-72bc22292f237c0714a1b13cc156117e5230b6bb.tar.gz
[ios] Only show telemetry debug log options when logging is enabled
Diffstat (limited to 'platform')
-rw-r--r--platform/ios/app/MBXViewController.m15
1 files changed, 11 insertions, 4 deletions
diff --git a/platform/ios/app/MBXViewController.m b/platform/ios/app/MBXViewController.m
index 290a86aae7..414329b437 100644
--- a/platform/ios/app/MBXViewController.m
+++ b/platform/ios/app/MBXViewController.m
@@ -34,6 +34,7 @@ static NSString * const MBXViewControllerAnnotationViewReuseIdentifer = @"MBXVie
@property (nonatomic) IBOutlet MGLMapView *mapView;
@property (nonatomic) NSInteger styleIndex;
+@property (nonatomic) BOOL debugLoggingEnabled;
@end
@@ -65,6 +66,8 @@ static NSString * const MBXViewControllerAnnotationViewReuseIdentifer = @"MBXVie
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(saveState:) name:UIApplicationWillTerminateNotification object:nil];
[self restoreState:nil];
+
+ self.debugLoggingEnabled = [[NSUserDefaults standardUserDefaults] boolForKey:@"MGLMapboxMetricsDebugLoggingEnabled"];
}
- (void)viewDidAppear:(BOOL)animated
@@ -188,10 +191,14 @@ static NSString * const MBXViewControllerAnnotationViewReuseIdentifer = @"MBXVie
@"Start World Tour",
@"Add Custom Callout Point",
@"Remove Annotations",
- @"Print Telemetry Logfile",
- @"Delete Telemetry Logfile",
nil];
+ if (self.debugLoggingEnabled)
+ {
+ [sheet addButtonWithTitle:@"Print Telemetry Logfile"];
+ [sheet addButtonWithTitle:@"Delete Telemetry Logfile"];
+ }
+
[sheet showFromBarButtonItem:self.navigationItem.leftBarButtonItem animated:YES];
}
@@ -312,12 +319,12 @@ static NSString * const MBXViewControllerAnnotationViewReuseIdentifer = @"MBXVie
{
[self.mapView removeAnnotations:self.mapView.annotations];
}
- else if (buttonIndex == actionSheet.firstOtherButtonIndex + 13)
+ else if (buttonIndex == actionSheet.numberOfButtons - 2 && self.debugLoggingEnabled)
{
NSString *fileContents = [NSString stringWithContentsOfFile:[self telemetryDebugLogfilePath] encoding:NSUTF8StringEncoding error:nil];
NSLog(@"%@", fileContents);
}
- else if (buttonIndex == actionSheet.firstOtherButtonIndex + 14)
+ else if (buttonIndex == actionSheet.numberOfButtons - 1 && self.debugLoggingEnabled)
{
NSString *filePath = [self telemetryDebugLogfilePath];
if ([[NSFileManager defaultManager] isDeletableFileAtPath:filePath]) {