#1216 - Adding start and stop location manager update to pause and resume functions.
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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];
|
||||
|
||||
Reference in New Issue
Block a user