diff options
author | Brad Leege <bleege@gmail.com> | 2015-04-06 23:15:00 -0500 |
---|---|---|
committer | Brad Leege <bleege@gmail.com> | 2015-04-06 23:15:00 -0500 |
commit | def309ba245635eeff53b3a5fb3b3821272d4d7c (patch) | |
tree | bc1265f5b0f5d52ca02499b338b5d7eb5c64dc04 | |
parent | 4092e469829e7cc14e946b2ed4e413091bd63b3b (diff) | |
download | qtlocation-mapboxgl-def309ba245635eeff53b3a5fb3b3821272d4d7c.tar.gz |
#1216 - Adding start and stop location manager update to pause and resume functions.
-rw-r--r-- | include/mbgl/ios/MGLMetricsLocationManager.h | 4 | ||||
-rw-r--r-- | platform/ios/MGLMapboxEvents.m | 7 |
2 files changed, 10 insertions, 1 deletions
diff --git a/include/mbgl/ios/MGLMetricsLocationManager.h b/include/mbgl/ios/MGLMetricsLocationManager.h index 7281d05010..5f3b568187 100644 --- a/include/mbgl/ios/MGLMetricsLocationManager.h +++ b/include/mbgl/ios/MGLMetricsLocationManager.h @@ -2,8 +2,10 @@ @interface MGLMetricsLocationManager : NSObject -// This method can be called from any thread. +// These methods can be called from any thread. // + (instancetype)sharedManager; ++ (void) startUpdatingLocation; ++ (void) stopUpdatingLocation; @end diff --git a/platform/ios/MGLMapboxEvents.m b/platform/ios/MGLMapboxEvents.m index 593a983904..0f3422b86d 100644 --- a/platform/ios/MGLMapboxEvents.m +++ b/platform/ios/MGLMapboxEvents.m @@ -231,6 +231,7 @@ NSString *const MGLEventGestureRotateStart = @"Rotation"; + (void) pauseMetricsCollection { assert([[NSThread currentThread] isMainThread]); [MGLMapboxEvents sharedManager].isPaused = YES; + [MGLMetricsLocationManager stopUpdatingLocation]; } // Must be called from the main thread. @@ -238,6 +239,7 @@ NSString *const MGLEventGestureRotateStart = @"Rotation"; + (void) resumeMetricsCollection { assert([[NSThread currentThread] isMainThread]); [MGLMapboxEvents sharedManager].isPaused = NO; + [MGLMetricsLocationManager startUpdatingLocation]; } // Can be called from any thread. Can be called rapidly from @@ -268,6 +270,11 @@ NSString *const MGLEventGestureRotateStart = @"Rotation"; return; } + // Metrics Collection Has Been Paused + if (_isPaused) { + return; + } + if (!event) return; NSMutableDictionary *evt = [[NSMutableDictionary alloc] initWithDictionary:attributeDictionary]; |