#1352 - Adding start / stop visit monitoring infrastructure and integrating it with pause / resume metrics api
This commit is contained in:
@@ -7,5 +7,7 @@
|
||||
+ (instancetype)sharedManager;
|
||||
+ (void) startUpdatingLocation;
|
||||
+ (void) stopUpdatingLocation;
|
||||
+ (void) startMonitoringVisits;
|
||||
+ (void) stopMonitoringVisits;
|
||||
|
||||
@end
|
||||
|
||||
@@ -271,6 +271,7 @@ NSString *const MGLEventGestureRotateStart = @"Rotation";
|
||||
}
|
||||
[MGLMapboxEvents sharedManager].isPaused = YES;
|
||||
[MGLMetricsLocationManager stopUpdatingLocation];
|
||||
[MGLMetricsLocationManager stopMonitoringVisits];
|
||||
}
|
||||
|
||||
// Must be called from the main thread.
|
||||
@@ -282,6 +283,7 @@ NSString *const MGLEventGestureRotateStart = @"Rotation";
|
||||
}
|
||||
[MGLMapboxEvents sharedManager].isPaused = NO;
|
||||
[MGLMetricsLocationManager startUpdatingLocation];
|
||||
[MGLMetricsLocationManager startMonitoringVisits];
|
||||
}
|
||||
|
||||
// Can be called from any thread. Can be called rapidly from
|
||||
|
||||
@@ -37,6 +37,18 @@
|
||||
[[MGLMetricsLocationManager sharedManager].locationManager stopUpdatingLocation];
|
||||
}
|
||||
|
||||
+ (void) startMonitoringVisits {
|
||||
if ([[MGLMetricsLocationManager sharedManager].locationManager respondsToSelector:@selector(startMonitoringVisits)]) {
|
||||
[[MGLMetricsLocationManager sharedManager].locationManager startMonitoringVisits];
|
||||
}
|
||||
}
|
||||
|
||||
+ (void) stopMonitoringVisits {
|
||||
if ([[MGLMetricsLocationManager sharedManager].locationManager respondsToSelector:@selector(stopMonitoringVisits)]) {
|
||||
[[MGLMetricsLocationManager sharedManager].locationManager stopMonitoringVisits];
|
||||
}
|
||||
}
|
||||
|
||||
#pragma mark CLLocationManagerDelegate
|
||||
- (void)locationManager:(CLLocationManager *)manager didUpdateLocations:(NSArray *)locations {
|
||||
// Iterate through locations to pass all data
|
||||
@@ -65,10 +77,12 @@
|
||||
case kCLAuthorizationStatusDenied:
|
||||
newStatus = @"User Explcitly Denied";
|
||||
[MGLMetricsLocationManager stopUpdatingLocation];
|
||||
[MGLMetricsLocationManager stopMonitoringVisits];
|
||||
break;
|
||||
case kCLAuthorizationStatusAuthorized:
|
||||
newStatus = @"User Has Authorized / Authorized Always";
|
||||
[MGLMetricsLocationManager startUpdatingLocation];
|
||||
[MGLMetricsLocationManager startMonitoringVisits];
|
||||
break;
|
||||
// case kCLAuthorizationStatusAuthorizedAlways:
|
||||
// newStatus = @"Not Determined";
|
||||
@@ -76,6 +90,7 @@
|
||||
case kCLAuthorizationStatusAuthorizedWhenInUse:
|
||||
newStatus = @"User Has Authorized When In Use Only";
|
||||
[MGLMetricsLocationManager startUpdatingLocation];
|
||||
[MGLMetricsLocationManager startMonitoringVisits];
|
||||
break;
|
||||
default:
|
||||
newStatus = @"Unknown";
|
||||
|
||||
Reference in New Issue
Block a user