Skip to content
This repository has been archived by the owner on Aug 8, 2023. It is now read-only.

Merge branch release-ios-v3.3.5 into master #6884

Merged
merged 10 commits into from
Nov 2, 2016
7 changes: 7 additions & 0 deletions platform/ios/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,13 @@ Mapbox welcomes participation and contributions from everyone. Please read [CONT
* MGLMapDebugOverdrawVisualizationMask no longer has any effect in Release builds of the SDK. This debug mask has been disabled for performance reasons. ([#5555](https://github.com/mapbox/mapbox-gl-native/pull/5555))
* Fixed a typo in the documentation for the MGLCompassDirectionFormatter class. ([#5879](https://github.com/mapbox/mapbox-gl-native/pull/5879))

## 3.3.5 - November 2, 2016

* Speculatively fixed an OpenGL rendering crash. ([#6844](https://github.com/mapbox/mapbox-gl-native/pull/6844))
* Fixed an issue with symbols not being properly stripped from the dynamic framework. The dSYM file included with the standard dynamic framework in previous releases (e.g., `mapbox-ios-sdk-3.3.4-dynamic.zip` or the `Mapbox-iOS-SDK` pod) could not be used to symbolicate crashes. ([#6531](https://github.com/mapbox/mapbox-gl-native/pull/6531))
* Include simulator architecture slices in the dSYM file that is generated for release builds. ([#5740](https://github.com/mapbox/mapbox-gl-native/pull/5740))
* Fixed a rare networking-related crash. ([#5932](https://github.com/mapbox/mapbox-gl-native/pull/5932))

## 3.3.4 - August 8, 2016

* Fixed an issue that caused the user dot to be selected when tapping an annotation that lies within the user dot’s accuracy circle. First attempt was [#5816](https://github.com/mapbox/mapbox-gl-native/pull/5816) in v3.3.2, which excluded the pulsing halo but not the accuracy circle. ([#5894](https://github.com/mapbox/mapbox-gl-native/pull/5894))
Expand Down
27 changes: 22 additions & 5 deletions platform/ios/src/MGLMapboxEvents.m
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,7 @@ @interface MGLMapboxEvents () <MGLLocationManagerDelegate>

@implementation MGLMapboxEvents {
NSString *_instanceID;
UIBackgroundTaskIdentifier _backgroundTaskIdentifier;
}

+ (void)initialize {
Expand Down Expand Up @@ -257,9 +258,20 @@ - (void)userDefaultsDidChange:(NSNotification *)notification {
}

- (void)pauseOrResumeMetricsCollectionIfRequired {
UIApplication *application = [UIApplication sharedApplication];

// Prevent blue status bar when host app has `when in use` permission only and it is not in foreground
if ([CLLocationManager authorizationStatus] == kCLAuthorizationStatusAuthorizedWhenInUse &&
[UIApplication sharedApplication].applicationState == UIApplicationStateBackground) {
application.applicationState == UIApplicationStateBackground) {

if (_backgroundTaskIdentifier == UIBackgroundTaskInvalid) {
_backgroundTaskIdentifier = [application beginBackgroundTaskWithExpirationHandler:^{
[application endBackgroundTask:_backgroundTaskIdentifier];
_backgroundTaskIdentifier = UIBackgroundTaskInvalid;
}];
[self flush];
}

[self pauseMetricsCollection];
return;
}
Expand Down Expand Up @@ -307,7 +319,10 @@ - (void)flush {
return;
}

if ([self.eventQueue count] == 0) {
if ([self.eventQueue count] <= 1) {
[self.eventQueue removeAllObjects];
[[UIApplication sharedApplication] endBackgroundTask:_backgroundTaskIdentifier];
_backgroundTaskIdentifier = UIBackgroundTaskInvalid;
return;
}

Expand Down Expand Up @@ -485,10 +500,12 @@ - (void)postEvents:(NS_ARRAY_OF(MGLMapboxEventAttributes *) *)events {
if (error) {
[strongSelf pushDebugEvent:MGLEventTypeLocalDebug withAttributes:@{MGLEventKeyLocalDebugDescription: @"Network error",
@"error": error}];
return;
} else {
[strongSelf pushDebugEvent:MGLEventTypeLocalDebug withAttributes:@{MGLEventKeyLocalDebugDescription: @"post",
@"debug.eventsCount": @(events.count)}];
}
[strongSelf pushDebugEvent:MGLEventTypeLocalDebug withAttributes:@{MGLEventKeyLocalDebugDescription: @"post",
@"debug.eventsCount": @(events.count)}];
[[UIApplication sharedApplication] endBackgroundTask:_backgroundTaskIdentifier];
_backgroundTaskIdentifier = UIBackgroundTaskInvalid;
}];
});
}
Expand Down