summaryrefslogtreecommitdiff
path: root/ios/app/MBXViewController.mm
diff options
context:
space:
mode:
Diffstat (limited to 'ios/app/MBXViewController.mm')
-rw-r--r--ios/app/MBXViewController.mm59
1 files changed, 42 insertions, 17 deletions
diff --git a/ios/app/MBXViewController.mm b/ios/app/MBXViewController.mm
index 57817d752b..6a2b0cc3fa 100644
--- a/ios/app/MBXViewController.mm
+++ b/ios/app/MBXViewController.mm
@@ -144,9 +144,8 @@ static const CLLocationCoordinate2D WorldTourDestinations[] = {
delegate:self
cancelButtonTitle:@"Cancel"
destructiveButtonTitle:nil
- otherButtonTitles:@"Reset North",
- @"Reset Position",
- @"Cycle debug options",
+ otherButtonTitles:@"Reset Position",
+ @"Cycle Debug Options",
@"Empty Memory",
@"Add 100 Points",
@"Add 1,000 Points",
@@ -156,6 +155,8 @@ static const CLLocationCoordinate2D WorldTourDestinations[] = {
@"Add Custom Callout Point",
@"Remove Annotations",
@"Toggle Custom Style Layer",
+ @"Print Telemetry Logfile",
+ @"Delete Telemetry Logfile",
nil];
[sheet showFromBarButtonItem:self.navigationItem.leftBarButtonItem animated:YES];
@@ -165,33 +166,29 @@ static const CLLocationCoordinate2D WorldTourDestinations[] = {
{
if (buttonIndex == actionSheet.firstOtherButtonIndex)
{
- [self.mapView resetNorth];
- }
- else if (buttonIndex == actionSheet.firstOtherButtonIndex + 1)
- {
[self.mapView resetPosition];
}
- else if (buttonIndex == actionSheet.firstOtherButtonIndex + 2)
+ else if (buttonIndex == actionSheet.firstOtherButtonIndex + 1)
{
[self.mapView cycleDebugOptions];
}
- else if (buttonIndex == actionSheet.firstOtherButtonIndex + 3)
+ else if (buttonIndex == actionSheet.firstOtherButtonIndex + 2)
{
[self.mapView emptyMemoryCache];
}
- else if (buttonIndex == actionSheet.firstOtherButtonIndex + 4)
+ else if (buttonIndex == actionSheet.firstOtherButtonIndex + 3)
{
[self parseFeaturesAddingCount:100];
}
- else if (buttonIndex == actionSheet.firstOtherButtonIndex + 5)
+ else if (buttonIndex == actionSheet.firstOtherButtonIndex + 4)
{
[self parseFeaturesAddingCount:1000];
}
- else if (buttonIndex == actionSheet.firstOtherButtonIndex + 6)
+ else if (buttonIndex == actionSheet.firstOtherButtonIndex + 5)
{
[self parseFeaturesAddingCount:10000];
}
- else if (buttonIndex == actionSheet.firstOtherButtonIndex + 7)
+ else if (buttonIndex == actionSheet.firstOtherButtonIndex + 6)
{
// PNW triangle
//
@@ -258,19 +255,19 @@ static const CLLocationCoordinate2D WorldTourDestinations[] = {
free(polygonCoordinates);
}
}
- else if (buttonIndex == actionSheet.firstOtherButtonIndex + 8)
+ else if (buttonIndex == actionSheet.firstOtherButtonIndex + 7)
{
[self startWorldTour:actionSheet];
}
- else if (buttonIndex == actionSheet.firstOtherButtonIndex + 9)
+ else if (buttonIndex == actionSheet.firstOtherButtonIndex + 8)
{
[self presentAnnotationWithCustomCallout];
}
- else if (buttonIndex == actionSheet.firstOtherButtonIndex + 10)
+ else if (buttonIndex == actionSheet.firstOtherButtonIndex + 9)
{
[self.mapView removeAnnotations:self.mapView.annotations];
}
- else if (buttonIndex == actionSheet.firstOtherButtonIndex + 11)
+ else if (buttonIndex == actionSheet.firstOtherButtonIndex + 10)
{
if (_isShowingCustomStyleLayer)
{
@@ -281,6 +278,24 @@ static const CLLocationCoordinate2D WorldTourDestinations[] = {
[self insertCustomStyleLayer];
}
}
+ else if (buttonIndex == actionSheet.firstOtherButtonIndex + 11)
+ {
+ NSString *fileContents = [NSString stringWithContentsOfFile:[self telemetryDebugLogfilePath] encoding:NSUTF8StringEncoding error:nil];
+ NSLog(@"%@", fileContents);
+ }
+ else if (buttonIndex == actionSheet.firstOtherButtonIndex + 12)
+ {
+ NSString *filePath = [self telemetryDebugLogfilePath];
+ if ([[NSFileManager defaultManager] isDeletableFileAtPath:filePath]) {
+ NSError *error;
+ BOOL success = [[NSFileManager defaultManager] removeItemAtPath:filePath error:&error];
+ if (success) {
+ NSLog(@"Deleted telemetry log.");
+ } else {
+ NSLog(@"Error deleting telemetry log: %@", error.localizedDescription);
+ }
+ }
+ }
}
- (void)parseFeaturesAddingCount:(NSUInteger)featuresCount
@@ -481,6 +496,16 @@ static const CLLocationCoordinate2D WorldTourDestinations[] = {
}];
}
+- (NSString *)telemetryDebugLogfilePath
+{
+ NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init];
+ [dateFormatter setDateFormat:@"yyyy'-'MM'-'dd"];
+ [dateFormatter setTimeZone:[NSTimeZone systemTimeZone]];
+ NSString *filePath = [[NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES) firstObject] stringByAppendingPathComponent:[NSString stringWithFormat:@"telemetry_log-%@.json", [dateFormatter stringFromDate:[NSDate date]]]];
+
+ return filePath;
+}
+
#pragma mark - Destruction
- (void)dealloc