summaryrefslogtreecommitdiff
path: root/platform/darwin/src/MGLStyle.mm
diff options
context:
space:
mode:
authorMinh Nguyễn <mxn@1ec5.org>2017-04-25 20:52:47 -0400
committerMinh Nguyễn <mxn@1ec5.org>2017-05-12 10:02:27 -0700
commitc5ee41a93a1f012acf41f29dc8bd75dc736ff4bc (patch)
tree761e85b0c1b0398e67ed97391bdda78848594147 /platform/darwin/src/MGLStyle.mm
parentd85471b7deb9c57973f9b70e0dfe4a8f386c8a01 (diff)
downloadqtlocation-mapboxgl-c5ee41a93a1f012acf41f29dc8bd75dc736ff4bc.tar.gz
[ios, macos] Undeprecated unversioned style URL factory methods
Undeprecated the unversioned style URL factory methods in MGLStyle for consistency with the Android and Qt SDKs. Added warnings about using them with the runtime styling API. Refactored mbgl::util::default_styles to track different versions for different styles. Cherry-picked from 9e384b78fbcf46d66d390122eefdf273f91b314e.
Diffstat (limited to 'platform/darwin/src/MGLStyle.mm')
-rw-r--r--platform/darwin/src/MGLStyle.mm10
1 files changed, 2 insertions, 8 deletions
diff --git a/platform/darwin/src/MGLStyle.mm b/platform/darwin/src/MGLStyle.mm
index 81b6446e7f..ce9e55bb99 100644
--- a/platform/darwin/src/MGLStyle.mm
+++ b/platform/darwin/src/MGLStyle.mm
@@ -58,8 +58,6 @@
#pragma mark Default style URLs
-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.
#define MGL_DEFINE_STYLE(name, fileName) \
@@ -67,17 +65,13 @@ static_assert(mbgl::util::default_styles::currentVersion == MGLStyleDefaultVersi
+ (NSURL *)name##StyleURL { \
static dispatch_once_t onceToken; \
dispatch_once(&onceToken, ^{ \
- MGLStyleURL_##name = [self name##StyleURLWithVersion:8]; \
+ MGLStyleURL_##name = [self name##StyleURLWithVersion:mbgl::util::default_styles::name.currentVersion]; \
}); \
return MGLStyleURL_##name; \
} \
\
+ (NSURL *)name##StyleURL##WithVersion:(NSInteger)version { \
- if (mbgl::util::default_styles::currentVersion == version) { \
- return [NSURL URLWithString:@(mbgl::util::default_styles::name.url)]; \
- } else { \
- return [NSURL URLWithString:[@"mapbox://styles/mapbox/" #fileName "-v" stringByAppendingFormat:@"%li", (long)version]]; \
- } \
+ return [NSURL URLWithString:[@"mapbox://styles/mapbox/" #fileName "-v" stringByAppendingFormat:@"%li", (long)version]]; \
}
MGL_DEFINE_STYLE(streets, streets)