diff options
author | Minh Nguyễn <mxn@1ec5.org> | 2016-05-02 15:34:46 -0700 |
---|---|---|
committer | Minh Nguyễn <mxn@1ec5.org> | 2016-05-06 11:06:52 -0700 |
commit | 2ec95bc490c5793b7b8a3aa9999f48d196ca8085 (patch) | |
tree | 413367e75df10a728a455d93cbfca80dda3b9662 | |
parent | 5ccb43477fc1d2028aef283d0db64848ebc9a347 (diff) | |
download | qtlocation-mapboxgl-2ec95bc490c5793b7b8a3aa9999f48d196ca8085.tar.gz |
[ios, osx] Renamed version constant, linked to more info
Renamed MGLStyleCurrentVersion to MGLStyleDefaultVersion to emphasize the constant’s role as an indicator of the default version used by SDK classes, which may be behind depending on release schedules. In the documentation for each style URL method, include the actual version number instead of the constant. In unit tests, verify that this documentation is in sync with the constant.
Link each style URL method’s documentation to a forthcoming webpage on mapbox.com that describes the style in rich detail.
-rw-r--r-- | platform/darwin/src/MGLStyle.h | 74 | ||||
-rw-r--r-- | platform/darwin/src/MGLStyle.mm | 2 | ||||
-rw-r--r-- | platform/darwin/src/MGLTilePyramidOfflineRegion.mm | 2 | ||||
-rw-r--r-- | platform/darwin/test/MGLOfflineRegionTests.m | 4 | ||||
-rw-r--r-- | platform/darwin/test/MGLStyleTests.mm | 44 | ||||
-rw-r--r-- | platform/ios/app/MBXViewController.m | 12 | ||||
-rw-r--r-- | platform/ios/jazzy.yml | 2 | ||||
-rw-r--r-- | platform/ios/src/MGLMapView.mm | 2 | ||||
-rw-r--r-- | platform/osx/app/MapDocument.m | 36 | ||||
-rw-r--r-- | platform/osx/src/MGLMapView.mm | 4 |
10 files changed, 102 insertions, 80 deletions
diff --git a/platform/darwin/src/MGLStyle.h b/platform/darwin/src/MGLStyle.h index 124954fee4..22b69464c3 100644 --- a/platform/darwin/src/MGLStyle.h +++ b/platform/darwin/src/MGLStyle.h @@ -5,112 +5,116 @@ NS_ASSUME_NONNULL_BEGIN /** - A version number identifying the latest released version of the suite of default styles provided by Mapbox. This version number may be passed into one of the “StyleURLWithVersion” class methods of MGLStyle. + A version number identifying the default version of the suite of default styles provided by Mapbox. This version number may be passed into one of the “StyleURLWithVersion” class methods of MGLStyle. - The value of this constant is current as of the date on which this SDK was published. Consult the <a href="https://www.mapbox.com/api-documentation/#styles">Mapbox Styles API documentation</a> for the most up-to-date style versioning information. + The value of this constant generally corresponds to the latest released version as of the date on which this SDK was published. You can use this constant to ascertain the style used by `MGLMapView` and `MGLTilePyramidOfflineRegion` when no style URL is specified. Consult the <a href="https://www.mapbox.com/api-documentation/#styles">Mapbox Styles API documentation</a> for the most up-to-date style versioning information. - @warning The value of this constant may change in a future release of the SDK. If you use any feature that depends on a specific implementation detail in a default style, you may use the current value of this constant or the underlying style URL, but do not use the constant itself. Such implementation details may change significantly from version to version. + @warning The value of this constant may change in a future release of the SDK. If you use any feature that depends on a specific aspect of a default style – for instance, the minimum zoom level that includes roads – you may use the current value of this constant or the underlying style URL, but do not use the constant itself. Such details may change significantly from version to version. */ -static const NSInteger MGLStyleCurrentVersion = 9; +static const NSInteger MGLStyleDefaultVersion = 9; /** - A collection of convenience methods for creating style URLs of default styles provided by Mapbox. + A collection of convenience methods for creating style URLs of default styles provided by Mapbox. <a href="https://www.mapbox.com/maps/">Learn more about Mapbox default styles</a>. */ @interface MGLStyle : NSObject /** - Returns the URL to version 8 of the Streets style. + Returns the URL to version 8 of the <a href="https://www.mapbox.com/maps/streets/">Mapbox Streets</a> style. - Mapbox Streets is a complete base map that balances nature, commerce, and infrastructure. + Streets is a complete base map that balances nature, commerce, and infrastructure. + + `MGLMapView` and `MGLTilePyramidOfflineRegion` use Mapbox Streets when no style is specified explicitly. */ + (NSURL *)streetsStyleURL __attribute__((deprecated("Use -streetsStyleURLWithVersion:."))); /** - Returns the URL to the given version of the Streets style. + Returns the URL to the given version of the <a href="https://www.mapbox.com/maps/streets/">Mapbox Streets</a> style. + + Streets is a complete base map that balances nature, commerce, and infrastructure. - Mapbox Streets is a complete base map that balances nature, commerce, and infrastructure. + `MGLMapView` and `MGLTilePyramidOfflineRegion` use Mapbox Streets when no style is specified explicitly. - @param version The style’s latest released version. The current version is given by `MGLStyleCurrentVersion`. + @param version The style’s latest released version. As of publication, the current version is `9`. */ + (NSURL *)streetsStyleURLWithVersion:(NSInteger)version; /** - Returns the URL to version 8 of the Emerald style. + Returns the URL to version 8 of the <a href="https://www.mapbox.com/blog/emerald-gl/">Mapbox Emerald</a> style. - Mapbox Emerald is a versatile style with emphasis on road networks and public transportation. + Emerald is a versatile style with emphasis on road networks and public transportation. */ + (NSURL *)emeraldStyleURL __attribute__((deprecated("Use <mapbox://styles/mapbox/emerald-v8>."))); /** - Returns the URL to the given version of the Outdoors style. + Returns the URL to the given version of the <a href="https://www.mapbox.com/maps/outdoors/">Mapbox Outdoors</a> style. - Mapbox Outdoors is a rugged style that emphasizes physical terrain and outdoor activities. + Outdoors is a rugged style that emphasizes physical terrain and outdoor activities. - @param version The style’s latest released version. The current version is given by `MGLStyleCurrentVersion`. + @param version The style’s latest released version. As of publication, the current version is `9`. */ + (NSURL *)outdoorsStyleURLWithVersion:(NSInteger)version; /** - Returns the URL to version 8 of the Light style. + Returns the URL to version 8 of the <a href="https://www.mapbox.com/maps/light-dark/">Mapbox Light</a> style. - Mapbox Light is a subtle, light-colored backdrop for data visualizations. + Light is a subtle, light-colored backdrop for data visualizations. */ + (NSURL *)lightStyleURL __attribute__((deprecated("Use -lightStyleURLWithVersion:."))); /** - Returns the URL to the given version of the Light style. + Returns the URL to the given version of the <a href="https://www.mapbox.com/maps/light-dark/">Mapbox Light</a> style. - Mapbox Light is a subtle, light-colored backdrop for data visualizations. + Light is a subtle, light-colored backdrop for data visualizations. - @param version The style’s latest released version. The current version is given by `MGLStyleCurrentVersion`. + @param version The style’s latest released version. As of publication, the current version is `9`. */ + (NSURL *)lightStyleURLWithVersion:(NSInteger)version; /** - Returns the URL to version 8 of the Dark style. + Returns the URL to version 8 of the <a href="https://www.mapbox.com/maps/light-dark/">Mapbox Dark</a> style. - Mapbox Dark is a subtle, dark-colored backdrop for data visualizations. + Dark is a subtle, dark-colored backdrop for data visualizations. */ + (NSURL *)darkStyleURL __attribute__((deprecated("Use -darkStyleURLWithVersion:."))); /** - Returns the URL to the given version of the Dark style. + Returns the URL to the given version of the <a href="https://www.mapbox.com/maps/light-dark/">Mapbox Dark</a> style. - Mapbox Dark is a subtle, dark-colored backdrop for data visualizations. + Dark is a subtle, dark-colored backdrop for data visualizations. - @param version The style’s latest released version. The current version is given by `MGLStyleCurrentVersion`. + @param version The style’s latest released version. As of publication, the current version is `9`. */ + (NSURL *)darkStyleURLWithVersion:(NSInteger)version; /** - Returns the URL to version 8 of the Satellite style. + Returns the URL to version 8 of the <a href="https://www.mapbox.com/maps/satellite/">Mapbox Satellite</a> style. - Mapbox Satellite is a beautiful global satellite and aerial imagery layer. + Satellite is a beautiful global satellite and aerial imagery layer. */ + (NSURL *)satelliteStyleURL __attribute__((deprecated("Use -satelliteStyleURLWithVersion:."))); /** - Returns the URL to the given version of the Satellite style. + Returns the URL to the given version of the <a href="https://www.mapbox.com/maps/satellite/">Mapbox Satellite</a> style. - Mapbox Satellite is a beautiful global satellite and aerial imagery layer. + Satellite is a beautiful global satellite and aerial imagery layer. - @param version The style’s latest released version. The current version is given by `MGLStyleCurrentVersion`. + @param version The style’s latest released version. As of publication, the current version is `9`. */ + (NSURL *)satelliteStyleURLWithVersion:(NSInteger)version; /** - Returns the URL to version 8 of the Satellite Streets style. + Returns the URL to version 8 of the <a href="https://www.mapbox.com/maps/satellite/">Mapbox Satellite Streets</a> style. - Mapbox Satellite Streets combines the global satellite and aerial imagery of Mapbox Satellite with unobtrusive labels and translucent roads from Mapbox Streets. + Satellite Streets combines the global satellite and aerial imagery of Mapbox Satellite with unobtrusive labels and translucent roads from Mapbox Streets. */ + (NSURL *)hybridStyleURL __attribute__((deprecated("Use -satelliteStreetsStyleURLWithVersion:."))); /** - Returns the URL to the given version of the Satellite Streets style. + Returns the URL to the given version of the <a href="https://www.mapbox.com/maps/satellite/">Mapbox Satellite Streets</a> style. - Mapbox Satellite Streets combines the global satellite and aerial imagery of Mapbox Satellite with unobtrusive labels and translucent roads from Mapbox Streets. + Satellite Streets combines the global satellite and aerial imagery of Mapbox Satellite with unobtrusive labels and translucent roads from Mapbox Streets. - @param version The style’s latest released version. The current version is given by `MGLStyleCurrentVersion`. + @param version The style’s latest released version. As of publication, the current version is `9`. */ + (NSURL *)satelliteStreetsStyleURLWithVersion:(NSInteger)version; diff --git a/platform/darwin/src/MGLStyle.mm b/platform/darwin/src/MGLStyle.mm index 13404c8d08..347fc2be24 100644 --- a/platform/darwin/src/MGLStyle.mm +++ b/platform/darwin/src/MGLStyle.mm @@ -4,7 +4,7 @@ @implementation MGLStyle -static_assert(mbgl::util::default_styles::currentVersion == MGLStyleCurrentVersion, "mbgl::util::default_styles::currentVersion and MGLStyleCurrentVersion disagree."); +static_assert(mbgl::util::default_styles::currentVersion == MGLStyleDefaultVersion, "mbgl::util::default_styles::currentVersion and MGLStyleDefaultVersion disagree."); /// @param name The style’s marketing name, written in lower camelCase. /// @param fileName The last path component in the style’s URL, excluding the version suffix. diff --git a/platform/darwin/src/MGLTilePyramidOfflineRegion.mm b/platform/darwin/src/MGLTilePyramidOfflineRegion.mm index 9b33d267df..f128fbb256 100644 --- a/platform/darwin/src/MGLTilePyramidOfflineRegion.mm +++ b/platform/darwin/src/MGLTilePyramidOfflineRegion.mm @@ -33,7 +33,7 @@ - (instancetype)initWithStyleURL:(NSURL *)styleURL bounds:(MGLCoordinateBounds)bounds fromZoomLevel:(double)minimumZoomLevel toZoomLevel:(double)maximumZoomLevel { if (self = [super init]) { if (!styleURL) { - styleURL = [MGLStyle streetsStyleURLWithVersion:MGLStyleCurrentVersion]; + styleURL = [MGLStyle streetsStyleURLWithVersion:MGLStyleDefaultVersion]; } if (!styleURL.scheme) { diff --git a/platform/darwin/test/MGLOfflineRegionTests.m b/platform/darwin/test/MGLOfflineRegionTests.m index a578bf0824..bb467dd35b 100644 --- a/platform/darwin/test/MGLOfflineRegionTests.m +++ b/platform/darwin/test/MGLOfflineRegionTests.m @@ -11,7 +11,7 @@ - (void)testStyleURLs { MGLCoordinateBounds bounds = MGLCoordinateBoundsMake(kCLLocationCoordinate2DInvalid, kCLLocationCoordinate2DInvalid); MGLTilePyramidOfflineRegion *region = [[MGLTilePyramidOfflineRegion alloc] initWithStyleURL:nil bounds:bounds fromZoomLevel:0 toZoomLevel:DBL_MAX]; - XCTAssertEqualObjects(region.styleURL, [MGLStyle streetsStyleURLWithVersion:MGLStyleCurrentVersion], @"Streets isn’t the default style."); + XCTAssertEqualObjects(region.styleURL, [MGLStyle streetsStyleURLWithVersion:MGLStyleDefaultVersion], @"Streets isn’t the default style."); NSURL *localURL = [NSURL URLWithString:@"beautiful.style"]; XCTAssertThrowsSpecificNamed([[MGLTilePyramidOfflineRegion alloc] initWithStyleURL:localURL bounds:bounds fromZoomLevel:0 toZoomLevel:DBL_MAX], NSException, @"Invalid style URL", @"No exception raised when initializing region with a local file URL as the style URL."); @@ -19,7 +19,7 @@ - (void)testEquality { MGLCoordinateBounds bounds = MGLCoordinateBoundsMake(kCLLocationCoordinate2DInvalid, kCLLocationCoordinate2DInvalid); - MGLTilePyramidOfflineRegion *original = [[MGLTilePyramidOfflineRegion alloc] initWithStyleURL:[MGLStyle lightStyleURLWithVersion:MGLStyleCurrentVersion] bounds:bounds fromZoomLevel:5 toZoomLevel:10]; + MGLTilePyramidOfflineRegion *original = [[MGLTilePyramidOfflineRegion alloc] initWithStyleURL:[MGLStyle lightStyleURLWithVersion:MGLStyleDefaultVersion] bounds:bounds fromZoomLevel:5 toZoomLevel:10]; MGLTilePyramidOfflineRegion *copy = [original copy]; XCTAssertEqualObjects(original, copy, @"Tile pyramid region should be equal to its copy."); diff --git a/platform/darwin/test/MGLStyleTests.mm b/platform/darwin/test/MGLStyleTests.mm index c8fc802e00..8c42417aba 100644 --- a/platform/darwin/test/MGLStyleTests.mm +++ b/platform/darwin/test/MGLStyleTests.mm @@ -27,18 +27,18 @@ - (void)testVersionedStyleURLs { // Test that all the default styles have publicly-declared MGLStyle class // methods and that the URLs all have the right values. - XCTAssertEqualObjects([MGLStyle streetsStyleURLWithVersion:MGLStyleCurrentVersion].absoluteString, @(mbgl::util::default_styles::streets.url)); - XCTAssertEqualObjects([MGLStyle outdoorsStyleURLWithVersion:MGLStyleCurrentVersion].absoluteString, @(mbgl::util::default_styles::outdoors.url)); - XCTAssertEqualObjects([MGLStyle lightStyleURLWithVersion:MGLStyleCurrentVersion].absoluteString, @(mbgl::util::default_styles::light.url)); - XCTAssertEqualObjects([MGLStyle darkStyleURLWithVersion:MGLStyleCurrentVersion].absoluteString, @(mbgl::util::default_styles::dark.url)); - XCTAssertEqualObjects([MGLStyle satelliteStyleURLWithVersion:MGLStyleCurrentVersion].absoluteString, @(mbgl::util::default_styles::satellite.url)); - XCTAssertEqualObjects([MGLStyle satelliteStreetsStyleURLWithVersion:MGLStyleCurrentVersion].absoluteString, @(mbgl::util::default_styles::satelliteStreets.url)); + XCTAssertEqualObjects([MGLStyle streetsStyleURLWithVersion:MGLStyleDefaultVersion].absoluteString, @(mbgl::util::default_styles::streets.url)); + XCTAssertEqualObjects([MGLStyle outdoorsStyleURLWithVersion:MGLStyleDefaultVersion].absoluteString, @(mbgl::util::default_styles::outdoors.url)); + XCTAssertEqualObjects([MGLStyle lightStyleURLWithVersion:MGLStyleDefaultVersion].absoluteString, @(mbgl::util::default_styles::light.url)); + XCTAssertEqualObjects([MGLStyle darkStyleURLWithVersion:MGLStyleDefaultVersion].absoluteString, @(mbgl::util::default_styles::dark.url)); + XCTAssertEqualObjects([MGLStyle satelliteStyleURLWithVersion:MGLStyleDefaultVersion].absoluteString, @(mbgl::util::default_styles::satellite.url)); + XCTAssertEqualObjects([MGLStyle satelliteStreetsStyleURLWithVersion:MGLStyleDefaultVersion].absoluteString, @(mbgl::util::default_styles::satelliteStreets.url)); static_assert(6 == mbgl::util::default_styles::numOrderedStyles, "MGLStyleTests isn’t testing all the styles in mbgl::util::default_styles."); } -- (void)testStyleURLComprehensiveness { +- (void)testStyleURLDeclarations { // Make sure this test is comprehensive. const unsigned numImplicitArgs = 2 /* _cmd, self */; unsigned numMethods = 0; @@ -63,12 +63,7 @@ mbgl::util::default_styles::numOrderedStyles, numVersionedMethods); // Test that all the versioned style methods are in the public header. - NSURL *styleHeaderURL = [[[NSBundle mgl_frameworkBundle].bundleURL - URLByAppendingPathComponent:@"Headers" isDirectory:YES] - URLByAppendingPathComponent:@"MGLStyle.h"]; - NSError *styleHeaderError; - NSString *styleHeader = [NSString stringWithContentsOfURL:styleHeaderURL usedEncoding:nil error:&styleHeaderError]; - XCTAssertNil(styleHeaderError, @"Error getting contents of MGLStyle.h."); + NSString *styleHeader = self.stringWithContentsOfStyleHeader; NSError *versionedMethodError; NSString *versionedMethodExpressionString = @(R"RE(^\+\s*\(NSURL\s*\*\s*\)\s*\w+StyleURLWithVersion\s*:\s*\(\s*NSInteger\s*\)\s*version\s*;)RE"); @@ -76,6 +71,29 @@ XCTAssertNil(versionedMethodError, @"Error compiling regular expression to search for versioned methods."); NSUInteger numVersionedMethodDeclarations = [versionedMethodExpression numberOfMatchesInString:styleHeader options:0 range:NSMakeRange(0, styleHeader.length)]; XCTAssertEqual(numVersionedMethodDeclarations, numVersionedMethods); + + // Test that “current version is” statements are present and current for all versioned style methods. + NSError *versionError; + NSString *versionExpressionString = @(R"RE(the current version is `(\d+)`)RE"); + NSRegularExpression *versionExpression = [NSRegularExpression regularExpressionWithPattern:versionExpressionString options:0 error:&versionError]; + XCTAssertNil(versionError, @"Error compiling regular expression to search for current version statements."); + NSUInteger numVersionDeclarations = [versionExpression numberOfMatchesInString:styleHeader options:0 range:NSMakeRange(0, styleHeader.length)]; + XCTAssertEqual(numVersionDeclarations, numVersionedMethods); + [versionExpression enumerateMatchesInString:styleHeader options:0 range:NSMakeRange(0, styleHeader.length) usingBlock:^(NSTextCheckingResult * _Nullable result, NSMatchingFlags flags, BOOL * _Nonnull stop) { + XCTAssertEqual(result.numberOfRanges, 2, @"Regular expression should have one capture group."); + NSString *version = [styleHeader substringWithRange:[result rangeAtIndex:1]]; + XCTAssertEqual([version integerValue], MGLStyleDefaultVersion, @"Versioned style URL method should document current version as %ld, not %ld.", MGLStyleDefaultVersion, version.integerValue); + }]; +} + +- (NSString *)stringWithContentsOfStyleHeader { + NSURL *styleHeaderURL = [[[NSBundle mgl_frameworkBundle].bundleURL + URLByAppendingPathComponent:@"Headers" isDirectory:YES] + URLByAppendingPathComponent:@"MGLStyle.h"]; + NSError *styleHeaderError; + NSString *styleHeader = [NSString stringWithContentsOfURL:styleHeaderURL usedEncoding:nil error:&styleHeaderError]; + XCTAssertNil(styleHeaderError, @"Error getting contents of MGLStyle.h."); + return styleHeader; } @end diff --git a/platform/ios/app/MBXViewController.m b/platform/ios/app/MBXViewController.m index 791fe0d7bf..88117de1a6 100644 --- a/platform/ios/app/MBXViewController.m +++ b/platform/ios/app/MBXViewController.m @@ -482,12 +482,12 @@ static const CLLocationCoordinate2D WorldTourDestinations[] = { @"Satellite Streets", ]; styleURLs = @[ - [MGLStyle streetsStyleURLWithVersion:MGLStyleCurrentVersion], - [MGLStyle outdoorsStyleURLWithVersion:MGLStyleCurrentVersion], - [MGLStyle lightStyleURLWithVersion:MGLStyleCurrentVersion], - [MGLStyle darkStyleURLWithVersion:MGLStyleCurrentVersion], - [MGLStyle satelliteStyleURLWithVersion:MGLStyleCurrentVersion], - [MGLStyle satelliteStreetsStyleURLWithVersion:MGLStyleCurrentVersion], + [MGLStyle streetsStyleURLWithVersion:MGLStyleDefaultVersion], + [MGLStyle outdoorsStyleURLWithVersion:MGLStyleDefaultVersion], + [MGLStyle lightStyleURLWithVersion:MGLStyleDefaultVersion], + [MGLStyle darkStyleURLWithVersion:MGLStyleDefaultVersion], + [MGLStyle satelliteStyleURLWithVersion:MGLStyleDefaultVersion], + [MGLStyle satelliteStreetsStyleURLWithVersion:MGLStyleDefaultVersion], ]; NSAssert(styleNames.count == styleURLs.count, @"Style names and URLs don’t match."); diff --git a/platform/ios/jazzy.yml b/platform/ios/jazzy.yml index 205f0c7f4f..f6a5cfba4b 100644 --- a/platform/ios/jazzy.yml +++ b/platform/ios/jazzy.yml @@ -23,7 +23,7 @@ custom_categories: - MGLMapView - MGLMapViewDelegate - MGLStyle - - MGLStyleCurrentVersion + - MGLStyleDefaultVersion - MGLUserTrackingMode - name: Annotations children: diff --git a/platform/ios/src/MGLMapView.mm b/platform/ios/src/MGLMapView.mm index 2c3cbf8f5f..e12e54d676 100644 --- a/platform/ios/src/MGLMapView.mm +++ b/platform/ios/src/MGLMapView.mm @@ -329,7 +329,7 @@ mbgl::Duration MGLDurationInSeconds(NSTimeInterval duration) if ( ! styleURL) { - styleURL = [MGLStyle streetsStyleURLWithVersion:MGLStyleCurrentVersion]; + styleURL = [MGLStyle streetsStyleURLWithVersion:MGLStyleDefaultVersion]; } if ( ! [styleURL scheme]) diff --git a/platform/osx/app/MapDocument.m b/platform/osx/app/MapDocument.m index 64f814dd28..bc692ba213 100644 --- a/platform/osx/app/MapDocument.m +++ b/platform/osx/app/MapDocument.m @@ -120,22 +120,22 @@ static const CLLocationCoordinate2D WorldTourDestinations[] = { NSURL *styleURL; switch (tag) { case 1: - styleURL = [MGLStyle streetsStyleURLWithVersion:MGLStyleCurrentVersion]; + styleURL = [MGLStyle streetsStyleURLWithVersion:MGLStyleDefaultVersion]; break; case 2: - styleURL = [MGLStyle outdoorsStyleURLWithVersion:MGLStyleCurrentVersion]; + styleURL = [MGLStyle outdoorsStyleURLWithVersion:MGLStyleDefaultVersion]; break; case 3: - styleURL = [MGLStyle lightStyleURLWithVersion:MGLStyleCurrentVersion]; + styleURL = [MGLStyle lightStyleURLWithVersion:MGLStyleDefaultVersion]; break; case 4: - styleURL = [MGLStyle darkStyleURLWithVersion:MGLStyleCurrentVersion]; + styleURL = [MGLStyle darkStyleURLWithVersion:MGLStyleDefaultVersion]; break; case 5: - styleURL = [MGLStyle satelliteStyleURLWithVersion:MGLStyleCurrentVersion]; + styleURL = [MGLStyle satelliteStyleURLWithVersion:MGLStyleDefaultVersion]; break; case 6: - styleURL = [MGLStyle satelliteStreetsStyleURLWithVersion:MGLStyleCurrentVersion]; + styleURL = [MGLStyle satelliteStreetsStyleURLWithVersion:MGLStyleDefaultVersion]; break; default: NSAssert(NO, @"Cannot set style from control with tag %li", (long)tag); @@ -447,22 +447,22 @@ static const CLLocationCoordinate2D WorldTourDestinations[] = { NSCellStateValue state; switch (menuItem.tag) { case 1: - state = [styleURL isEqual:[MGLStyle streetsStyleURLWithVersion:MGLStyleCurrentVersion]]; + state = [styleURL isEqual:[MGLStyle streetsStyleURLWithVersion:MGLStyleDefaultVersion]]; break; case 2: - state = [styleURL isEqual:[MGLStyle outdoorsStyleURLWithVersion:MGLStyleCurrentVersion]]; + state = [styleURL isEqual:[MGLStyle outdoorsStyleURLWithVersion:MGLStyleDefaultVersion]]; break; case 3: - state = [styleURL isEqual:[MGLStyle lightStyleURLWithVersion:MGLStyleCurrentVersion]]; + state = [styleURL isEqual:[MGLStyle lightStyleURLWithVersion:MGLStyleDefaultVersion]]; break; case 4: - state = [styleURL isEqual:[MGLStyle darkStyleURLWithVersion:MGLStyleCurrentVersion]]; + state = [styleURL isEqual:[MGLStyle darkStyleURLWithVersion:MGLStyleDefaultVersion]]; break; case 5: - state = [styleURL isEqual:[MGLStyle satelliteStyleURLWithVersion:MGLStyleCurrentVersion]]; + state = [styleURL isEqual:[MGLStyle satelliteStyleURLWithVersion:MGLStyleDefaultVersion]]; break; case 6: - state = [styleURL isEqual:[MGLStyle satelliteStreetsStyleURLWithVersion:MGLStyleCurrentVersion]]; + state = [styleURL isEqual:[MGLStyle satelliteStreetsStyleURLWithVersion:MGLStyleDefaultVersion]]; break; default: return NO; @@ -557,12 +557,12 @@ static const CLLocationCoordinate2D WorldTourDestinations[] = { } NSArray *styleURLs = @[ - [MGLStyle streetsStyleURLWithVersion:MGLStyleCurrentVersion], - [MGLStyle outdoorsStyleURLWithVersion:MGLStyleCurrentVersion], - [MGLStyle lightStyleURLWithVersion:MGLStyleCurrentVersion], - [MGLStyle darkStyleURLWithVersion:MGLStyleCurrentVersion], - [MGLStyle satelliteStyleURLWithVersion:MGLStyleCurrentVersion], - [MGLStyle satelliteStreetsStyleURLWithVersion:MGLStyleCurrentVersion], + [MGLStyle streetsStyleURLWithVersion:MGLStyleDefaultVersion], + [MGLStyle outdoorsStyleURLWithVersion:MGLStyleDefaultVersion], + [MGLStyle lightStyleURLWithVersion:MGLStyleDefaultVersion], + [MGLStyle darkStyleURLWithVersion:MGLStyleDefaultVersion], + [MGLStyle satelliteStyleURLWithVersion:MGLStyleDefaultVersion], + [MGLStyle satelliteStreetsStyleURLWithVersion:MGLStyleDefaultVersion], ]; return [styleURLs indexOfObject:self.mapView.styleURL]; } diff --git a/platform/osx/src/MGLMapView.mm b/platform/osx/src/MGLMapView.mm index 0202c0dacb..741f0a7c02 100644 --- a/platform/osx/src/MGLMapView.mm +++ b/platform/osx/src/MGLMapView.mm @@ -532,7 +532,7 @@ public: - (nonnull NSURL *)styleURL { NSString *styleURLString = @(_mbglMap->getStyleURL().c_str()).mgl_stringOrNilIfEmpty; - return styleURLString ? [NSURL URLWithString:styleURLString] : [MGLStyle streetsStyleURLWithVersion:MGLStyleCurrentVersion]; + return styleURLString ? [NSURL URLWithString:styleURLString] : [MGLStyle streetsStyleURLWithVersion:MGLStyleDefaultVersion]; } - (void)setStyleURL:(nullable NSURL *)styleURL { @@ -547,7 +547,7 @@ public: if (![MGLAccountManager accessToken]) { return; } - styleURL = [MGLStyle streetsStyleURLWithVersion:MGLStyleCurrentVersion]; + styleURL = [MGLStyle streetsStyleURLWithVersion:MGLStyleDefaultVersion]; } if (![styleURL scheme]) { |