#1216 - Adding start and stop location manager update to pause and resume functions.

This commit is contained in:
Brad Leege
2015-04-06 23:15:00 -05:00
parent 4092e46982
commit def309ba24
2 changed files with 10 additions and 1 deletions

View File

@@ -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

View File

@@ -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];