Merge branch 'release-agua' into master
# Conflicts: # platform/android/CHANGELOG.md # platform/android/MapboxGLAndroidSDK/gradle.properties # platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/MapView.java # platform/ios/CHANGELOG.md # platform/ios/ios.xcodeproj/project.pbxproj # platform/macos/CHANGELOG.md
This commit is contained in:
@@ -3364,7 +3364,6 @@ public class PropertyFactory {
|
||||
return new LayoutPropertyValue<>("text-optional", value);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* If true, icons will display without their corresponding text when the text collides with other symbols and the icon does not.
|
||||
*
|
||||
|
||||
@@ -21,6 +21,12 @@ Mapbox welcomes participation and contributions from everyone. Please read [CONT
|
||||
|
||||
* Long-pressing the attribution button causes the SDK’s version number to be displayed in the action sheet that appears. ([#10650](https://github.com/mapbox/mapbox-gl-native/pull/10650))
|
||||
|
||||
## 3.7.3
|
||||
|
||||
* Fixed a crash while zooming while annotations are present on the map. ([#10791](https://github.com/mapbox/mapbox-gl-native/pull/10791))
|
||||
* CJK characters can be displayed in a locally installed font or a custom font bundled with the application, reducing map download times. Specify the font name using the `MGLIdeographicFontFamilyName` key in the application’s Info.plist file. ([#10522](https://github.com/mapbox/mapbox-gl-native/pull/10522))
|
||||
* Fixed a hang that could occur if the application makes many changes to user defaults immediately after launching. ([#10803](https://github.com/mapbox/mapbox-gl-native/pull/10803))
|
||||
|
||||
## 3.7.2 - December 21, 2017
|
||||
|
||||
### Packaging
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
Pod::Spec.new do |m|
|
||||
|
||||
version = '3.7.2'
|
||||
version = '3.7.3'
|
||||
|
||||
m.name = 'Mapbox-iOS-SDK-nightly-dynamic'
|
||||
m.version = "#{version}-nightly"
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
Pod::Spec.new do |m|
|
||||
|
||||
version = '3.7.2'
|
||||
version = '3.7.3'
|
||||
|
||||
m.name = 'Mapbox-iOS-SDK-symbols'
|
||||
m.version = "#{version}-symbols"
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
Pod::Spec.new do |m|
|
||||
|
||||
version = '3.7.2'
|
||||
version = '3.7.3'
|
||||
|
||||
m.name = 'Mapbox-iOS-SDK'
|
||||
m.version = version
|
||||
|
||||
@@ -14,6 +14,7 @@
|
||||
071BBB071EE77631001FB02A /* MGLImageSourceTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 071BBB051EE7761A001FB02A /* MGLImageSourceTests.m */; };
|
||||
0778DD431F67556700A73B34 /* MGLComputedShapeSource.h in Headers */ = {isa = PBXBuildFile; fileRef = 0778DD401F67555F00A73B34 /* MGLComputedShapeSource.h */; settings = {ATTRIBUTES = (Public, ); }; };
|
||||
0778DD441F67556C00A73B34 /* MGLComputedShapeSource.mm in Sources */ = {isa = PBXBuildFile; fileRef = 0778DD411F67555F00A73B34 /* MGLComputedShapeSource.mm */; };
|
||||
16376B491FFEED010000563E /* MGLMapViewLayoutTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 16376B481FFEED010000563E /* MGLMapViewLayoutTests.m */; };
|
||||
07D8C6FB1F67560100381808 /* MGLComputedShapeSource.mm in Sources */ = {isa = PBXBuildFile; fileRef = 0778DD411F67555F00A73B34 /* MGLComputedShapeSource.mm */; };
|
||||
07D8C6FC1F67560400381808 /* MGLAbstractShapeSource.mm in Sources */ = {isa = PBXBuildFile; fileRef = 07D947501F67487E00E37934 /* MGLAbstractShapeSource.mm */; };
|
||||
07D8C6FF1F67562C00381808 /* MGLComputedShapeSourceTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 07D8C6FD1F67562800381808 /* MGLComputedShapeSourceTests.m */; };
|
||||
@@ -627,6 +628,7 @@
|
||||
0778DD401F67555F00A73B34 /* MGLComputedShapeSource.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MGLComputedShapeSource.h; sourceTree = "<group>"; };
|
||||
0778DD411F67555F00A73B34 /* MGLComputedShapeSource.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = MGLComputedShapeSource.mm; sourceTree = "<group>"; };
|
||||
07D8C6FD1F67562800381808 /* MGLComputedShapeSourceTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = MGLComputedShapeSourceTests.m; path = ../../darwin/test/MGLComputedShapeSourceTests.m; sourceTree = "<group>"; };
|
||||
16376B481FFEED010000563E /* MGLMapViewLayoutTests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = MGLMapViewLayoutTests.m; sourceTree = "<group>"; };
|
||||
07D9474E1F67487E00E37934 /* MGLAbstractShapeSource_Private.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MGLAbstractShapeSource_Private.h; sourceTree = "<group>"; };
|
||||
07D9474F1F67487E00E37934 /* MGLAbstractShapeSource.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MGLAbstractShapeSource.h; sourceTree = "<group>"; };
|
||||
07D947501F67487E00E37934 /* MGLAbstractShapeSource.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = MGLAbstractShapeSource.mm; sourceTree = "<group>"; };
|
||||
@@ -1420,6 +1422,7 @@
|
||||
DA0CD58F1CF56F6A00A5F5A5 /* MGLFeatureTests.mm */,
|
||||
DA2E885C1CC0382C00F24E7B /* MGLGeometryTests.mm */,
|
||||
DA5DB1291FABF1EE001C2326 /* MGLMapAccessibilityElementTests.m */,
|
||||
16376B481FFEED010000563E /* MGLMapViewLayoutTests.m */,
|
||||
35E208A61D24210F00EC9A46 /* MGLNSDataAdditionsTests.m */,
|
||||
1F95931C1E6DE2E900D5B294 /* MGLNSDateAdditionsTests.mm */,
|
||||
DAE7DEC11E245455007505A6 /* MGLNSStringAdditionsTests.m */,
|
||||
@@ -2409,6 +2412,7 @@
|
||||
DA0CD5901CF56F6A00A5F5A5 /* MGLFeatureTests.mm in Sources */,
|
||||
556660D81E1D085500E2C41B /* MGLVersionNumber.m in Sources */,
|
||||
4031ACFF1E9FD29F00A3EA26 /* MGLSDKTestHelpers.swift in Sources */,
|
||||
16376B491FFEED010000563E /* MGLMapViewLayoutTests.m in Sources */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
|
||||
@@ -757,7 +757,7 @@ public:
|
||||
toItem:viewController.topLayoutGuide
|
||||
attribute:NSLayoutAttributeBottom
|
||||
multiplier:1.0
|
||||
constant:5.0]];
|
||||
constant:8.0]];
|
||||
}
|
||||
[self.compassViewConstraints addObject:
|
||||
[NSLayoutConstraint constraintWithItem:self.compassView
|
||||
@@ -766,7 +766,7 @@ public:
|
||||
toItem:self
|
||||
attribute:NSLayoutAttributeTop
|
||||
multiplier:1.0
|
||||
constant:5.0 + self.contentInset.top]];
|
||||
constant:8.0 + self.contentInset.top]];
|
||||
|
||||
[self.compassViewConstraints addObject:
|
||||
[NSLayoutConstraint constraintWithItem:self
|
||||
@@ -775,7 +775,7 @@ public:
|
||||
toItem:self.compassView
|
||||
attribute:NSLayoutAttributeTrailing
|
||||
multiplier:1.0
|
||||
constant:5.0 + self.contentInset.right]];
|
||||
constant:8.0 + self.contentInset.right]];
|
||||
|
||||
[containerView addConstraints:self.compassViewConstraints];
|
||||
|
||||
@@ -792,7 +792,7 @@ public:
|
||||
toItem:viewController.topLayoutGuide
|
||||
attribute:NSLayoutAttributeBottom
|
||||
multiplier:1.0
|
||||
constant:5.0]];
|
||||
constant:8.0]];
|
||||
}
|
||||
[self.scaleBarConstraints addObject:
|
||||
[NSLayoutConstraint constraintWithItem:self.scaleBar
|
||||
@@ -801,7 +801,7 @@ public:
|
||||
toItem:self
|
||||
attribute:NSLayoutAttributeTop
|
||||
multiplier:1.0
|
||||
constant:5.0 + self.contentInset.top]];
|
||||
constant:8.0 + self.contentInset.top]];
|
||||
[self.scaleBarConstraints addObject:
|
||||
[NSLayoutConstraint constraintWithItem:self.scaleBar
|
||||
attribute:NSLayoutAttributeLeft
|
||||
@@ -835,7 +835,7 @@ public:
|
||||
toItem:self.logoView
|
||||
attribute:NSLayoutAttributeBaseline
|
||||
multiplier:1
|
||||
constant:8 + self.contentInset.bottom]];
|
||||
constant:8.0 + self.contentInset.bottom]];
|
||||
[self.logoViewConstraints addObject:
|
||||
[NSLayoutConstraint constraintWithItem:self.logoView
|
||||
attribute:NSLayoutAttributeLeading
|
||||
@@ -859,7 +859,7 @@ public:
|
||||
toItem:self.attributionButton
|
||||
attribute:NSLayoutAttributeBaseline
|
||||
multiplier:1
|
||||
constant:8 + self.contentInset.bottom]];
|
||||
constant:8.0 + self.contentInset.bottom]];
|
||||
}
|
||||
[self.attributionButtonConstraints addObject:
|
||||
[NSLayoutConstraint constraintWithItem:self
|
||||
@@ -868,7 +868,7 @@ public:
|
||||
toItem:self.attributionButton
|
||||
attribute:NSLayoutAttributeBaseline
|
||||
multiplier:1
|
||||
constant:8 + self.contentInset.bottom]];
|
||||
constant:8.0 + self.contentInset.bottom]];
|
||||
|
||||
[self.attributionButtonConstraints addObject:
|
||||
[NSLayoutConstraint constraintWithItem:self
|
||||
@@ -877,29 +877,20 @@ public:
|
||||
toItem:self.attributionButton
|
||||
attribute:NSLayoutAttributeTrailing
|
||||
multiplier:1
|
||||
constant:8 + self.contentInset.right]];
|
||||
constant:8.0 + self.contentInset.right]];
|
||||
[containerView addConstraints:self.attributionButtonConstraints];
|
||||
}
|
||||
|
||||
- (void)updateConstraints
|
||||
{
|
||||
|
||||
// If compiling with the iOS 11+ SDK
|
||||
#if __IPHONE_OS_VERSION_MAX_ALLOWED >= 110000
|
||||
// If safeAreaLayoutGuide API exists
|
||||
if ( [self respondsToSelector:@selector(safeAreaLayoutGuide)] ) {
|
||||
|
||||
#pragma clang diagnostic push
|
||||
#pragma clang diagnostic ignored "-Wpartial-availability"
|
||||
if (@available(iOS 11.0, *)) {
|
||||
UILayoutGuide *safeAreaLayoutGuide = self.safeAreaLayoutGuide;
|
||||
#pragma clang diagnostic pop
|
||||
|
||||
// compass view
|
||||
[self removeConstraints:self.compassViewConstraints];
|
||||
[self.compassViewConstraints removeAllObjects];
|
||||
#pragma clang diagnostic push
|
||||
#pragma clang diagnostic ignored "-Wpartial-availability"
|
||||
[self.compassViewConstraints addObject:[self.compassView.topAnchor constraintEqualToSystemSpacingBelowAnchor:safeAreaLayoutGuide.topAnchor multiplier:1]];
|
||||
#pragma clang diagnostic pop
|
||||
[self.compassViewConstraints addObject:[self constraintForYAxisAnchor:self.compassView.topAnchor belowAnchor:safeAreaLayoutGuide.topAnchor]];
|
||||
[self.compassViewConstraints addObject:[safeAreaLayoutGuide.rightAnchor constraintEqualToAnchor:self.compassView.rightAnchor
|
||||
constant:8.0 + self.contentInset.right]];
|
||||
[self addConstraints:self.compassViewConstraints];
|
||||
@@ -907,10 +898,7 @@ public:
|
||||
// scale bar view
|
||||
[self removeConstraints:self.scaleBarConstraints];
|
||||
[self.scaleBarConstraints removeAllObjects];
|
||||
#pragma clang diagnostic push
|
||||
#pragma clang diagnostic ignored "-Wpartial-availability"
|
||||
[self.scaleBarConstraints addObject:[self.scaleBar.topAnchor constraintEqualToSystemSpacingBelowAnchor:safeAreaLayoutGuide.topAnchor multiplier:1]];
|
||||
#pragma clang diagnostic pop
|
||||
[self.scaleBarConstraints addObject:[self constraintForYAxisAnchor:self.scaleBar.topAnchor belowAnchor:safeAreaLayoutGuide.topAnchor]];
|
||||
[self.scaleBarConstraints addObject:[self.scaleBar.leftAnchor constraintEqualToAnchor:safeAreaLayoutGuide.leftAnchor
|
||||
constant:8.0 + self.contentInset.left]];
|
||||
[self addConstraints:self.scaleBarConstraints];
|
||||
@@ -918,8 +906,7 @@ public:
|
||||
// logo view
|
||||
[self removeConstraints:self.logoViewConstraints];
|
||||
[self.logoViewConstraints removeAllObjects];
|
||||
[self.logoViewConstraints addObject:[safeAreaLayoutGuide.bottomAnchor constraintEqualToAnchor:self.logoView.bottomAnchor
|
||||
constant:8.0 + self.contentInset.bottom]];
|
||||
[self.logoViewConstraints addObject:[self constraintForYAxisAnchor:safeAreaLayoutGuide.bottomAnchor belowAnchor:self.logoView.bottomAnchor]];
|
||||
[self.logoViewConstraints addObject:[self.logoView.leftAnchor constraintEqualToAnchor:safeAreaLayoutGuide.leftAnchor
|
||||
constant:8.0 + self.contentInset.left]];
|
||||
[self addConstraints:self.logoViewConstraints];
|
||||
@@ -927,21 +914,26 @@ public:
|
||||
// attribution button
|
||||
[self removeConstraints:self.attributionButtonConstraints];
|
||||
[self.attributionButtonConstraints removeAllObjects];
|
||||
[self.attributionButtonConstraints addObject:[safeAreaLayoutGuide.bottomAnchor constraintEqualToAnchor:self.attributionButton.bottomAnchor
|
||||
constant:8.0 + self.contentInset.bottom]];
|
||||
[self.attributionButtonConstraints addObject:[self constraintForYAxisAnchor:safeAreaLayoutGuide.bottomAnchor belowAnchor:self.attributionButton.bottomAnchor]];
|
||||
[self.attributionButtonConstraints addObject:[safeAreaLayoutGuide.rightAnchor constraintEqualToAnchor:self.attributionButton.rightAnchor
|
||||
constant:8.0 + self.contentInset.right]];
|
||||
[self addConstraints:self.attributionButtonConstraints];
|
||||
} else {
|
||||
[self updateConstraintsPreiOS11];
|
||||
}
|
||||
#else
|
||||
[self updateConstraintsPreiOS11];
|
||||
#endif
|
||||
|
||||
[super updateConstraints];
|
||||
}
|
||||
|
||||
- (NSLayoutConstraint *)constraintForYAxisAnchor:(NSLayoutYAxisAnchor *)yAxisAnchor belowAnchor:(NSLayoutYAxisAnchor *)anchor
|
||||
{
|
||||
if (@available(iOS 11.0, *)) {
|
||||
return [yAxisAnchor constraintEqualToSystemSpacingBelowAnchor:anchor multiplier:1];
|
||||
} else {
|
||||
return nil;
|
||||
}
|
||||
}
|
||||
|
||||
- (BOOL)isOpaque
|
||||
{
|
||||
return _opaque;
|
||||
|
||||
@@ -54,6 +54,9 @@ static NSString *const MGLEventKeySessionId = @"sessionId";
|
||||
static NSString *const MGLEventKeyApplicationState = @"applicationState";
|
||||
static NSString *const MGLEventKeyAltitude = @"altitude";
|
||||
|
||||
static NSString *const MGLMapboxAccountType = @"MGLMapboxAccountType";
|
||||
static NSString *const MGLMapboxMetricsEnabled = @"MGLMapboxMetricsEnabled";
|
||||
|
||||
// SDK event source
|
||||
static NSString *const MGLEventSource = @"mapbox";
|
||||
|
||||
@@ -124,6 +127,8 @@ const NSTimeInterval MGLFlushInterval = 180;
|
||||
@property (nonatomic) NSTimer *timer;
|
||||
@property (nonatomic) NSDate *instanceIDRotationDate;
|
||||
@property (nonatomic) NSDate *nextTurnstileSendDate;
|
||||
@property (nonatomic) NSNumber *currentAccountTypeValue;
|
||||
@property (nonatomic) BOOL currentMetricsEnabledValue;
|
||||
|
||||
@end
|
||||
|
||||
@@ -135,10 +140,10 @@ const NSTimeInterval MGLFlushInterval = 180;
|
||||
+ (void)initialize {
|
||||
if (self == [MGLMapboxEvents class]) {
|
||||
NSBundle *bundle = [NSBundle mainBundle];
|
||||
NSNumber *accountTypeNumber = [bundle objectForInfoDictionaryKey:@"MGLMapboxAccountType"];
|
||||
NSNumber *accountTypeNumber = [bundle objectForInfoDictionaryKey:MGLMapboxAccountType];
|
||||
[[NSUserDefaults standardUserDefaults] registerDefaults:@{
|
||||
@"MGLMapboxAccountType": accountTypeNumber ?: @0,
|
||||
@"MGLMapboxMetricsEnabled": @YES,
|
||||
MGLMapboxAccountType: accountTypeNumber ?: @0,
|
||||
MGLMapboxMetricsEnabled: @YES,
|
||||
@"MGLMapboxMetricsDebugLoggingEnabled": @NO,
|
||||
}];
|
||||
}
|
||||
@@ -152,8 +157,8 @@ const NSTimeInterval MGLFlushInterval = 180;
|
||||
if ([NSProcessInfo instancesRespondToSelector:@selector(isLowPowerModeEnabled)]) {
|
||||
isLowPowerModeEnabled = [[NSProcessInfo processInfo] isLowPowerModeEnabled];
|
||||
}
|
||||
return ([[NSUserDefaults standardUserDefaults] boolForKey:@"MGLMapboxMetricsEnabled"] &&
|
||||
[[NSUserDefaults standardUserDefaults] integerForKey:@"MGLMapboxAccountType"] == 0 &&
|
||||
return ([[NSUserDefaults standardUserDefaults] boolForKey:MGLMapboxMetricsEnabled] &&
|
||||
[[NSUserDefaults standardUserDefaults] integerForKey:MGLMapboxAccountType] == 0 &&
|
||||
!isLowPowerModeEnabled);
|
||||
#endif
|
||||
}
|
||||
@@ -167,6 +172,9 @@ const NSTimeInterval MGLFlushInterval = 180;
|
||||
- (instancetype) init {
|
||||
self = [super init];
|
||||
if (self) {
|
||||
_currentAccountTypeValue = @0;
|
||||
_currentMetricsEnabledValue = YES;
|
||||
|
||||
_appBundleId = [[NSBundle mainBundle] bundleIdentifier];
|
||||
_apiClient = [[MGLAPIClient alloc] init];
|
||||
|
||||
@@ -249,38 +257,61 @@ const NSTimeInterval MGLFlushInterval = 180;
|
||||
}
|
||||
|
||||
- (void)userDefaultsDidChange:(NSNotification *)notification {
|
||||
dispatch_async(dispatch_get_main_queue(), ^{
|
||||
[self pauseOrResumeMetricsCollectionIfRequired];
|
||||
});
|
||||
|
||||
// Guard against over calling pause / resume if the values this implementation actually
|
||||
// cares about have not changed
|
||||
|
||||
if ([[notification object] respondsToSelector:@selector(objectForKey:)]) {
|
||||
NSUserDefaults *userDefaults = [notification object];
|
||||
|
||||
NSNumber *accountType = [userDefaults objectForKey:MGLMapboxAccountType];
|
||||
BOOL metricsEnabled = [[userDefaults objectForKey:MGLMapboxMetricsEnabled] boolValue];
|
||||
|
||||
if (![accountType isEqualToNumber:self.currentAccountTypeValue] || metricsEnabled != self.currentMetricsEnabledValue) {
|
||||
[self pauseOrResumeMetricsCollectionIfRequired];
|
||||
self.currentAccountTypeValue = accountType;
|
||||
self.currentMetricsEnabledValue = metricsEnabled;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
- (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 &&
|
||||
application.applicationState == UIApplicationStateBackground) {
|
||||
|
||||
if (_backgroundTaskIdentifier == UIBackgroundTaskInvalid) {
|
||||
_backgroundTaskIdentifier = [application beginBackgroundTaskWithExpirationHandler:^{
|
||||
[application endBackgroundTask:_backgroundTaskIdentifier];
|
||||
_backgroundTaskIdentifier = UIBackgroundTaskInvalid;
|
||||
}];
|
||||
[self flush];
|
||||
}
|
||||
|
||||
[self pauseMetricsCollection];
|
||||
return;
|
||||
}
|
||||
|
||||
// Toggle pause based on current pause state, user opt-out state, and low-power state.
|
||||
BOOL enabled = [[self class] isEnabled];
|
||||
if (self.paused && enabled) {
|
||||
[self resumeMetricsCollection];
|
||||
} else if (!self.paused && !enabled) {
|
||||
[self flush];
|
||||
[self pauseMetricsCollection];
|
||||
}
|
||||
|
||||
// [CLLocationManager authorizationStatus] has been found to block in some cases so
|
||||
// dispatch the call to a non-UI thread
|
||||
dispatch_async(self.serialQueue, ^{
|
||||
CLAuthorizationStatus status = [CLLocationManager authorizationStatus];
|
||||
|
||||
// Checking application state must be done on the main thread for safety and
|
||||
// to avoid a thread sanitizer error
|
||||
dispatch_async(dispatch_get_main_queue(), ^{
|
||||
UIApplication *application = [UIApplication sharedApplication];
|
||||
UIApplicationState state = application.applicationState;
|
||||
|
||||
// Prevent blue status bar when host app has `when in use` permission only and it is not in foreground
|
||||
if (status == kCLAuthorizationStatusAuthorizedWhenInUse && state == UIApplicationStateBackground) {
|
||||
if (_backgroundTaskIdentifier == UIBackgroundTaskInvalid) {
|
||||
_backgroundTaskIdentifier = [application beginBackgroundTaskWithExpirationHandler:^{
|
||||
[application endBackgroundTask:_backgroundTaskIdentifier];
|
||||
_backgroundTaskIdentifier = UIBackgroundTaskInvalid;
|
||||
}];
|
||||
[self flush];
|
||||
}
|
||||
[self pauseMetricsCollection];
|
||||
return;
|
||||
}
|
||||
|
||||
// Toggle pause based on current pause state, user opt-out state, and low-power state.
|
||||
BOOL enabled = [[self class] isEnabled];
|
||||
if (self.paused && enabled) {
|
||||
[self resumeMetricsCollection];
|
||||
} else if (!self.paused && !enabled) {
|
||||
[self flush];
|
||||
[self pauseMetricsCollection];
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
- (void)pauseMetricsCollection {
|
||||
@@ -602,7 +633,7 @@ const NSTimeInterval MGLFlushInterval = 180;
|
||||
BOOL metricsEnabledSettingShownInAppFlag = [shownInAppNumber boolValue];
|
||||
|
||||
if (!metricsEnabledSettingShownInAppFlag &&
|
||||
[[NSUserDefaults standardUserDefaults] integerForKey:@"MGLMapboxAccountType"] == 0) {
|
||||
[[NSUserDefaults standardUserDefaults] integerForKey:MGLMapboxAccountType] == 0) {
|
||||
// Opt-out is not configured in UI, so check for Settings.bundle
|
||||
id defaultEnabledValue;
|
||||
NSString *appSettingsBundle = [[NSBundle mainBundle] pathForResource:@"Settings" ofType:@"bundle"];
|
||||
@@ -612,7 +643,7 @@ const NSTimeInterval MGLFlushInterval = 180;
|
||||
NSDictionary *settings = [NSDictionary dictionaryWithContentsOfFile:[appSettingsBundle stringByAppendingPathComponent:@"Root.plist"]];
|
||||
NSArray *preferences = settings[@"PreferenceSpecifiers"];
|
||||
for (NSDictionary *prefSpecification in preferences) {
|
||||
if ([prefSpecification[@"Key"] isEqualToString:@"MGLMapboxMetricsEnabled"]) {
|
||||
if ([prefSpecification[@"Key"] isEqualToString:MGLMapboxMetricsEnabled]) {
|
||||
defaultEnabledValue = prefSpecification[@"DefaultValue"];
|
||||
}
|
||||
}
|
||||
|
||||
108
platform/ios/test/MGLMapViewLayoutTests.m
Normal file
108
platform/ios/test/MGLMapViewLayoutTests.m
Normal file
@@ -0,0 +1,108 @@
|
||||
#import <XCTest/XCTest.h>
|
||||
#import "MGLMapView.h"
|
||||
#import "MGLMapViewDelegate.h"
|
||||
#import "MGLAccountManager.h"
|
||||
|
||||
|
||||
@interface MGLMapViewLayoutTests : XCTestCase<MGLMapViewDelegate>
|
||||
|
||||
@property (nonatomic) UIView *superView;
|
||||
@property (nonatomic) MGLMapView *mapView;
|
||||
@property (nonatomic) XCTestExpectation *styleLoadingExpectation;
|
||||
|
||||
@end
|
||||
|
||||
@implementation MGLMapViewLayoutTests
|
||||
|
||||
- (void)setUp {
|
||||
[super setUp];
|
||||
|
||||
[MGLAccountManager setAccessToken:@"pk.feedcafedeadbeefbadebede"];
|
||||
NSURL *styleURL = [[NSBundle bundleForClass:[self class]] URLForResource:@"one-liner" withExtension:@"json"];
|
||||
|
||||
self.superView = [[UIView alloc] initWithFrame:UIScreen.mainScreen.bounds];
|
||||
|
||||
self.mapView = [[MGLMapView alloc] initWithFrame:UIScreen.mainScreen.bounds styleURL:styleURL];
|
||||
self.mapView.delegate = self;
|
||||
|
||||
[self.superView addSubview:self.mapView];
|
||||
|
||||
UIView *mapView = self.mapView;
|
||||
NSDictionary *bindings = NSDictionaryOfVariableBindings(mapView);
|
||||
NSArray *verticalConstraints = [NSLayoutConstraint constraintsWithVisualFormat:@"V:|-0-[mapView]-0-|" options:0 metrics:nil views:bindings];
|
||||
NSArray *horizonatalConstraints = [NSLayoutConstraint constraintsWithVisualFormat:@"H:|-0-[mapView]-0-|" options:0 metrics:nil views:bindings];
|
||||
|
||||
[self.superView addConstraints:[verticalConstraints arrayByAddingObjectsFromArray:horizonatalConstraints]];
|
||||
|
||||
self.styleLoadingExpectation = [self expectationWithDescription:@"Map view should finish loading style."];
|
||||
[self waitForExpectationsWithTimeout:1 handler:nil];
|
||||
|
||||
//set zoom and heading so that scale bar and compass will be shown
|
||||
[self.mapView setZoomLevel:4.5 animated:NO];
|
||||
[self.mapView.camera setHeading:12.0];
|
||||
|
||||
//invoke layout
|
||||
[self.superView setNeedsLayout];
|
||||
[self.superView layoutIfNeeded];
|
||||
|
||||
}
|
||||
|
||||
- (void)mapView:(MGLMapView *)mapView didFinishLoadingStyle:(MGLStyle *)style {
|
||||
XCTAssertNotNil(mapView.style);
|
||||
XCTAssertEqual(mapView.style, style);
|
||||
|
||||
[self.styleLoadingExpectation fulfill];
|
||||
}
|
||||
|
||||
- (void)tearDown {
|
||||
self.styleLoadingExpectation = nil;
|
||||
self.mapView = nil;
|
||||
|
||||
[super tearDown];
|
||||
}
|
||||
|
||||
- (void)testOrnamentPlacement {
|
||||
|
||||
CGFloat margin = 8.0;
|
||||
CGFloat bottomSafeAreaInset = 0.0;
|
||||
double accuracy = 0.01;
|
||||
|
||||
if ( [self.mapView respondsToSelector:@selector(safeAreaInsets)] ) {
|
||||
bottomSafeAreaInset = self.mapView.safeAreaInsets.bottom;
|
||||
}
|
||||
|
||||
//compass
|
||||
UIImageView *compassView = self.mapView.compassView;
|
||||
|
||||
CGFloat expectedCompassOriginX = CGRectGetMaxX(self.mapView.bounds) - margin - CGRectGetWidth(compassView.frame);
|
||||
CGFloat expectedCompassOriginY = margin;
|
||||
|
||||
XCTAssertEqualWithAccuracy(CGRectGetMinX(compassView.frame), expectedCompassOriginX, accuracy);
|
||||
XCTAssertEqualWithAccuracy(CGRectGetMinY(compassView.frame), expectedCompassOriginY, accuracy);
|
||||
|
||||
//scale bar
|
||||
UIView *scaleBar = self.mapView.scaleBar;
|
||||
|
||||
XCTAssertEqualWithAccuracy(CGRectGetMinX(scaleBar.frame), margin, accuracy);
|
||||
XCTAssertEqualWithAccuracy(CGRectGetMinY(scaleBar.frame), margin, accuracy);
|
||||
|
||||
//attribution button
|
||||
UIButton *attributionButton = self.mapView.attributionButton;
|
||||
|
||||
CGFloat expectedButtonOriginX = CGRectGetMaxX(self.mapView.bounds) - margin - CGRectGetWidth(attributionButton.frame);
|
||||
CGFloat expectedButtonOriginY = CGRectGetMaxY(self.mapView.bounds) - margin - bottomSafeAreaInset - CGRectGetHeight(attributionButton.frame);
|
||||
|
||||
XCTAssertEqualWithAccuracy(CGRectGetMinX(attributionButton.frame), expectedButtonOriginX, accuracy);
|
||||
XCTAssertEqualWithAccuracy(CGRectGetMinY(attributionButton.frame), expectedButtonOriginY, accuracy);
|
||||
|
||||
//mapbox logo
|
||||
UIImageView *logoView = self.mapView.logoView;
|
||||
|
||||
CGFloat expectedLogoOriginX = margin;
|
||||
CGFloat expectedLogoOriginY = CGRectGetMaxY(self.mapView.bounds) - margin - bottomSafeAreaInset - CGRectGetHeight(logoView.frame);
|
||||
|
||||
XCTAssertEqualWithAccuracy(CGRectGetMinX(logoView.frame), expectedLogoOriginX, accuracy);
|
||||
XCTAssertEqualWithAccuracy(CGRectGetMinY(logoView.frame), expectedLogoOriginY, accuracy);
|
||||
}
|
||||
|
||||
@end
|
||||
@@ -15,7 +15,16 @@
|
||||
|
||||
* Fixed a memory leak that occurred when creating a map snapshot. ([#10585](https://github.com/mapbox/mapbox-gl-native/pull/10585))
|
||||
|
||||
## v0.6.0
|
||||
## v0.6.1 - January 16, 2018
|
||||
|
||||
This version of the Mapbox macOS SDK corresponds to version 3.7.3 of the Mapbox Maps SDK for iOS.
|
||||
|
||||
* Fixed a crash while zooming while annotations are present on the map. ([#10791](https://github.com/mapbox/mapbox-gl-native/pull/10791))
|
||||
* CJK characters can be displayed in a locally installed font or a custom font bundled with the application, reducing map download times. Specify the font name using the `MGLIdeographicFontFamilyName` key in the application’s Info.plist file. ([#10522](https://github.com/mapbox/mapbox-gl-native/pull/10522))
|
||||
|
||||
## v0.6.0 - December 23, 2017
|
||||
|
||||
This version of the Mapbox macOS SDK corresponds to version 3.7.2 of the Mapbox Maps SDK for iOS.
|
||||
|
||||
### Packaging
|
||||
|
||||
@@ -60,7 +69,7 @@
|
||||
* Added documentation for usage of coordinate bounds that cross the anti-meridian. ([#10783](https://github.com/mapbox/mapbox-gl-native/pull/10783))
|
||||
* Removed duplicated variables in `MGLMapSnapshotter`. ([#10702](https://github.com/mapbox/mapbox-gl-native/pull/10702))
|
||||
|
||||
## 0.5.1
|
||||
## 0.5.1 - September 26, 2017
|
||||
|
||||
This version of the Mapbox macOS SDK corresponds to version 3.6.4 of the Mapbox iOS SDK.
|
||||
|
||||
@@ -71,7 +80,7 @@ This version of the Mapbox macOS SDK corresponds to version 3.6.4 of the Mapbox
|
||||
* Deprecated `+[MGLStyle trafficDayStyleURL]` and `+[MGLStyle trafficNightStyleURL]` with no replacement method. To use the Traffic Day and Traffic Night styles going forward, we recommend that you use the underlying URL. ([#9918](https://github.com/mapbox/mapbox-gl-native/pull/9918))
|
||||
* Fixed an issue where stale (but still valid) map data could be ignored in offline mode. ([#10012](https://github.com/mapbox/mapbox-gl-native/pull/10012))
|
||||
|
||||
## 0.5.0
|
||||
## 0.5.0 - June 30, 2017
|
||||
|
||||
This version of the Mapbox macOS SDK corresponds to version 3.6.0 of the Mapbox iOS SDK.
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
Pod::Spec.new do |m|
|
||||
|
||||
version = '0.6.0'
|
||||
version = '0.6.1'
|
||||
|
||||
m.name = 'Mapbox-macOS-SDK-symbols'
|
||||
m.version = "#{version}-symbols"
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
Pod::Spec.new do |m|
|
||||
|
||||
version = '0.6.0'
|
||||
version = '0.6.1'
|
||||
|
||||
m.name = 'Mapbox-macOS-SDK'
|
||||
m.version = version
|
||||
|
||||
@@ -19,20 +19,31 @@ function step { >&2 echo -e "\033[1m\033[36m* $@\033[0m"; }
|
||||
function finish { >&2 echo -en "\033[0m"; }
|
||||
trap finish EXIT
|
||||
|
||||
buildPackageStyle() {
|
||||
local package=$1 style=""
|
||||
if [[ ${#} -eq 2 ]]; then
|
||||
style="$2"
|
||||
fi
|
||||
step "Building: make ${package} ${style}"
|
||||
make ${package}
|
||||
step "Publishing ${package} with ${style}"
|
||||
publish() {
|
||||
OPTRESET=1
|
||||
OPTIND=
|
||||
local arg
|
||||
local rule=
|
||||
local suffix=
|
||||
local app=
|
||||
while getopts 'r:s:a:' arg; do
|
||||
case ${arg} in
|
||||
r) rule=${OPTARG};;
|
||||
s) suffix=${OPTARG};;
|
||||
a) app=${OPTARG};;
|
||||
*) "Usage: [-r rule] [-s suffix] [-a app]"; return
|
||||
esac
|
||||
done
|
||||
|
||||
step "Building: make ${rule} ${suffix}"
|
||||
make ${rule}
|
||||
step "Publishing ${rule} with ${suffix}"
|
||||
local file_name=""
|
||||
if [ -z ${style} ]
|
||||
if [ -z ${suffix} ]
|
||||
then
|
||||
file_name=mapbox-macos-sdk-${PUBLISH_VERSION}.zip
|
||||
else
|
||||
file_name=mapbox-macos-sdk-${PUBLISH_VERSION}-${style}.zip
|
||||
file_name=mapbox-macos-sdk-${PUBLISH_VERSION}-${suffix}.zip
|
||||
fi
|
||||
step "Compressing ${file_name}…"
|
||||
cd build/macos/pkg
|
||||
@@ -46,16 +57,18 @@ buildPackageStyle() {
|
||||
--name ${file_name} \
|
||||
--file "${BINARY_DIRECTORY}/${file_name}" > /dev/null
|
||||
fi
|
||||
if [[ ${DEPLOY_APP} == true ]]; then
|
||||
if [ ${app} ]; then
|
||||
file_name="Mapbox GL.app.zip"
|
||||
step "Compressing ${file_name}…"
|
||||
cd build/macos/app
|
||||
rm -f 'Mapbox GL.app.zip'
|
||||
zip -yr '../deploy/Mapbox GL.app.zip' 'Mapbox GL.app'
|
||||
rm -f "${file_name}"
|
||||
zip -yr "../deploy/${file_name}" 'Mapbox GL.app'
|
||||
cd -
|
||||
if [[ "${GITHUB_RELEASE}" == true ]]; then
|
||||
echo "Uploading ${file_name} to GitHub"
|
||||
github-release upload \
|
||||
--tag "macos-v${PUBLISH_VERSION}" \
|
||||
--name ${file_name} \
|
||||
--name "${file_name}" \
|
||||
--file "${BINARY_DIRECTORY}/${file_name}" > /dev/null
|
||||
fi
|
||||
fi
|
||||
@@ -126,7 +139,7 @@ if [[ "${GITHUB_RELEASE}" == true ]]; then
|
||||
--draft ${PUBLISH_PRE_FLAG}
|
||||
fi
|
||||
|
||||
buildPackageStyle "xpackage" "symbols"
|
||||
DEPLOY_APP=true buildPackageStyle "xpackage SYMBOLS=NO"
|
||||
publish -r xpackage -s symbols
|
||||
publish -r "xpackage SYMBOLS=NO" -a true
|
||||
|
||||
step "Finished deploying ${PUBLISH_VERSION} in $(($SECONDS / 60)) minutes and $(($SECONDS % 60)) seconds"
|
||||
|
||||
@@ -8,10 +8,10 @@ NAME=Mapbox
|
||||
OUTPUT=build/macos/pkg
|
||||
APP_OUTPUT=build/macos/app
|
||||
DERIVED_DATA=build/macos
|
||||
PRODUCTS=${DERIVED_DATA}
|
||||
|
||||
BUILDTYPE=${BUILDTYPE:-Release}
|
||||
SYMBOLS=${SYMBOLS:-YES}
|
||||
PRODUCTS=${DERIVED_DATA}/${BUILDTYPE}
|
||||
|
||||
function step { >&2 echo -e "\033[1m\033[36m* $@\033[0m"; }
|
||||
function finish { >&2 echo -en "\033[0m"; }
|
||||
@@ -24,15 +24,7 @@ PROJ_VERSION=$(git rev-list --count HEAD)
|
||||
SEM_VERSION=$( git describe --tags --match=macos-v*.*.* --abbrev=0 | sed 's/^macos-v//' )
|
||||
SHORT_VERSION=${SEM_VERSION%-*}
|
||||
|
||||
XCODEBUILD_SCHEME=dynamic
|
||||
XCODEBUILD_ACTION=build
|
||||
if [[ ${BUILDTYPE} == Release ]]; then
|
||||
XCODEBUILD_SCHEME=macosapp
|
||||
XCODEBUILD_ACTION=archive
|
||||
mkdir -p ${APP_OUTPUT}
|
||||
fi
|
||||
|
||||
step "Building targets (build ${PROJ_VERSION}, version ${SEM_VERSION})…"
|
||||
step "Building dynamic framework (build ${PROJ_VERSION}, version ${SEM_VERSION})…"
|
||||
xcodebuild \
|
||||
CURRENT_PROJECT_VERSION=${PROJ_VERSION} \
|
||||
CURRENT_SHORT_VERSION=${SHORT_VERSION} \
|
||||
@@ -41,16 +33,33 @@ xcodebuild \
|
||||
-derivedDataPath ${DERIVED_DATA} \
|
||||
-archivePath "${APP_OUTPUT}/macosapp.xcarchive" \
|
||||
-workspace ./platform/macos/macos.xcworkspace \
|
||||
-scheme ${XCODEBUILD_SCHEME} \
|
||||
-scheme dynamic \
|
||||
-configuration ${BUILDTYPE} \
|
||||
-jobs ${JOBS} \
|
||||
${XCODEBUILD_ACTION} | xcpretty
|
||||
build | xcpretty
|
||||
|
||||
step "Copying dynamic framework into place"
|
||||
mkdir -p "${OUTPUT}/${NAME}.framework"
|
||||
ditto ${PRODUCTS}/${BUILDTYPE}/${NAME}.framework "${OUTPUT}/${NAME}.framework"
|
||||
if [[ -e ${PRODUCTS}/${BUILDTYPE}/${NAME}.framework.dSYM ]]; then
|
||||
cp -r ${PRODUCTS}/${BUILDTYPE}/${NAME}.framework.dSYM "${OUTPUT}"
|
||||
ditto ${PRODUCTS}/${NAME}.framework "${OUTPUT}/${NAME}.framework"
|
||||
if [[ -e ${PRODUCTS}/${NAME}.framework.dSYM ]]; then
|
||||
cp -r ${PRODUCTS}/${NAME}.framework.dSYM "${OUTPUT}"
|
||||
fi
|
||||
|
||||
step "Building and archiving Mapbox GL.app (build ${PROJ_VERSION}, version ${SEM_VERSION})…"
|
||||
if [[ ${BUILDTYPE} == Release ]]; then
|
||||
mkdir -p ${APP_OUTPUT}
|
||||
xcodebuild \
|
||||
CURRENT_PROJECT_VERSION=${PROJ_VERSION} \
|
||||
CURRENT_SHORT_VERSION=${SHORT_VERSION} \
|
||||
CURRENT_SEMANTIC_VERSION=${SEM_VERSION} \
|
||||
CURRENT_COMMIT_HASH=${HASH} \
|
||||
-derivedDataPath ${DERIVED_DATA} \
|
||||
-archivePath "${APP_OUTPUT}/macosapp.xcarchive" \
|
||||
-workspace ./platform/macos/macos.xcworkspace \
|
||||
-scheme macosapp \
|
||||
-configuration ${BUILDTYPE} \
|
||||
-jobs ${JOBS} \
|
||||
archive | xcpretty
|
||||
fi
|
||||
|
||||
if [[ ${SYMBOLS} = NO ]]; then
|
||||
|
||||
Reference in New Issue
Block a user