-
Notifications
You must be signed in to change notification settings - Fork 1.3k
[ios, macos] Deprecate trafficDayStyleURL and trafficNightStyleURL #9918
[ios, macos] Deprecate trafficDayStyleURL and trafficNightStyleURL #9918
Conversation
platform/darwin/src/MGLStyle.mm
Outdated
@@ -134,6 +132,26 @@ + (NSURL *)emeraldStyleURL { | |||
return MGLStyleURL_emerald; | |||
} | |||
|
|||
// Emerald is no longer getting new versions as a default style, so the current version is hard-coded here. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These comments say “Emerald”.
9b2cfcf
to
3934c78
Compare
platform/darwin/src/MGLStyle.h
Outdated
*/ | ||
+ (NSURL *)trafficDayStyleURLWithVersion:(NSInteger)version; | ||
+ (NSURL *)trafficDayStyleURL __attribute__((deprecated("Create an NSURL object with the string “mapbox://styles/mapbox/traffic-day-v2”."))); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This change renames the selector from -trafficDayStyleURLWithVersion:
to -trafficDayStyleURL
. This is a backwards-incompatible change. Consider retaining the original method name but deprecating it nonetheless.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@1ec5 I'm deprecating + (NSURL *)trafficDayStyleURL;
and deleting trafficDayStyleURLWithVersion:(NSInteger)version
is that ok or should I keep the later?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We shouldn’t delete anything without a major version bump. So we’ll need to keep both symbols and mark them both as deprecated.
4474f33
to
6738042
Compare
platform/macos/app/MapDocument.m
Outdated
@@ -926,8 +914,6 @@ - (NSUInteger)indexOfStyleInToolbarItem { | |||
[MGLStyle darkStyleURL], | |||
[MGLStyle satelliteStyleURL], | |||
[MGLStyle satelliteStreetsStyleURL], | |||
[MGLStyle trafficDayStyleURL], | |||
[MGLStyle trafficNightStyleURL], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For consistency with iosapp, we might as well keep the styles-as-URLs here, too.
platform/macos/app/MapDocument.m
Outdated
styleURL = [MGLStyle trafficDayStyleURL]; | ||
break; | ||
case 8: | ||
styleURL = [MGLStyle trafficNightStyleURL]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The menu items themselves are defined in MapDocument.xib (for the toolbar) and MainMenu.xib (for the View menu). Removing the backing code without removing the UI elements leads to the assertion below when interacting with the UI elements.
6738042
to
efafdfa
Compare
platform/macos/app/MapDocument.m
Outdated
styleURL = [NSURL URLWithString:@"mapbox://styles/mapbox/traffic-day-v2"]; | ||
break; | ||
case 8: | ||
styleURL = [NSURL URLWithString:@"mapbox://styles/mapbox/traffic-night-v2"]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To clarify, it’s fine to remove the deprecated styles from macosapp – after all, Emerald isn’t listed – but you need to remove them completely. Otherwise, any inconsistencies between this code and the XIBs could result in a crash.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Removed or kept, we should do the same here and in iosapp.
@@ -140,7 +132,7 @@ - (void)testStyleURLDeclarations { | |||
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"); | |||
NSString *versionedMethodExpressionString = @(R"RE(^\+\s*\(NSURL\s*\*\s*\)\s*\w+StyleURLWithVersion\s*:\s*\(\s*NSInteger\s*\)\s*version\s*)RE"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Might be a good idea to add a \b
where the ;
was, to ensure that all the methods have the same parameter name (and not something like versions
).
@@ -99,14 +99,6 @@ - (void)testVersionedStyleURLs { | |||
@(mbgl::util::default_styles::satelliteStreets.url)); | |||
XCTAssertEqualObjects([MGLStyle satelliteStreetsStyleURLWithVersion:99].absoluteString, | |||
@"mapbox://styles/mapbox/satellite-streets-v99"); | |||
XCTAssertEqualObjects([MGLStyle trafficDayStyleURLWithVersion:mbgl::util::default_styles::trafficDay.currentVersion].absoluteString, | |||
@(mbgl::util::default_styles::trafficDay.url)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should continue to test these versioned methods as long as they’re part of the API. To work around the deprecation warnings, use pragmas.
efafdfa
to
d392203
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, but I defer to @1ễc5.
d392203
to
5a4e0c0
Compare
platform/darwin/src/MGLStyle.mm
Outdated
} | ||
|
||
+ (NSURL *)trafficDayStyleURLWithVersion:(NSInteger)version { | ||
return [MGLStyle trafficDayStyleURL]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[MGLStyle trafficDayStyleURLWithVersion:1]
ends up returning Traffic Day v2. This could be a breaking change for any developers calling this method.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@1ec5 I may misunderstood this but is it possible return a versioned style now that is deprecated? in the docs I wrote https://github.com/mapbox/mapbox-gl-native/pull/9918/files#diff-1d168de285fc4ba01ce48c4236f0b3ceR298
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
-trafficDayStyleURLWithVersion:
should return whatever version is specified, like it always has. -trafficDayStyleURL
should return version 2. Both methods should be deprecated but should continue to work like they always have.
5a4e0c0
to
0114484
Compare
… in MGLStyleTests.
0114484
to
d369f8d
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Interestingly, it looks like we were never testing the unversioned traffic methods in the first place.
|
||
/** | ||
Returns the URL to the given version of the | ||
Returns the URL to to the version 2 of the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Typo: “to to”.
….1.4 * release-ios-v3.6.0-android-v5.1.0: (36 commits) [android] [auto] Update properties to version 5.1.4 in preparation for build. [android] - latLngBounds test [android] - update changelog for 5.1.4 release. bump MAS version number to 2.2.3 (mapbox#9901) [android] fix is download complete (a download is complete when count and required resources match and the download state is inactive) (mapbox#9913) [android] - avoid adding duplicate points to bounds [android] Clear out mapCallback's OnMapReadyCallbacks on onDestroy [android] - harden offline region deletion Do not check connection if it is local request [android] - disable rotation gesture when pinch zooming macos-v0.5.1 [ios] Bump podspec to 3.6.4 (mapbox#10059) [android, ios, macos] Updated translations [core] make sure tiles are not treated as complete until all worker operations completed [core] keep tiles renderable even if a subsequent error occurs [ios] Be sure to get a BOOL value for nullable dict keys iosv3.6.3 podspec bump (mapbox#10008) [ios, macos] Deprecate trafficDayStyleURL and trafficNightStyleURL (mapbox#9918) [ios] Use constraints to manage ornament view placement (again) (mapbox#9995) [ios] Canned spam coming from Transifex ... # Conflicts: # platform/android/MapboxGLAndroidSDK/proguard-rules.pro # platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/MapGestureDetector.java
Deprecates styles according to the latest spec.