diff options
author | Jordan Kiley <jmkiley@users.noreply.github.com> | 2018-02-16 16:20:08 -0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-02-16 16:20:08 -0800 |
commit | 9459cf6a91f98266f77960a8cf328cb9c0ec3034 (patch) | |
tree | 2f367251cd4440585e760a1ee48260eb8dc80ad8 /platform/darwin | |
parent | 604931247e8c78570058981ea17c034947c4430f (diff) | |
download | qtlocation-mapboxgl-9459cf6a91f98266f77960a8cf328cb9c0ec3034.tar.gz |
[ios, macos] Mark deprecated methods as unavailable (#11205)
Fixes #10735
Diffstat (limited to 'platform/darwin')
-rw-r--r-- | platform/darwin/src/MGLAccountManager.h | 2 | ||||
-rw-r--r-- | platform/darwin/src/MGLAccountManager.m | 5 | ||||
-rw-r--r-- | platform/darwin/src/MGLOfflineStorage.h | 8 | ||||
-rw-r--r-- | platform/darwin/src/MGLOfflineStorage.mm | 4 | ||||
-rw-r--r-- | platform/darwin/src/MGLStyle.h | 59 | ||||
-rw-r--r-- | platform/darwin/src/MGLStyle.mm | 83 | ||||
-rw-r--r-- | platform/darwin/test/MGLStyleTests.mm | 30 |
7 files changed, 19 insertions, 172 deletions
diff --git a/platform/darwin/src/MGLAccountManager.h b/platform/darwin/src/MGLAccountManager.h index 741cc323cb..b691c4c906 100644 --- a/platform/darwin/src/MGLAccountManager.h +++ b/platform/darwin/src/MGLAccountManager.h @@ -44,7 +44,7 @@ MGL_EXPORT */ + (nullable NSString *)accessToken; -+ (BOOL)mapboxMetricsEnabledSettingShownInApp __attribute__((deprecated("Telemetry settings are now always shown in the ℹ️ menu."))); ++ (BOOL)mapboxMetricsEnabledSettingShownInApp __attribute__((unavailable("Telemetry settings are now always shown in the ℹ️ menu."))); @end diff --git a/platform/darwin/src/MGLAccountManager.m b/platform/darwin/src/MGLAccountManager.m index 729caeaa31..5bd96ce337 100644 --- a/platform/darwin/src/MGLAccountManager.m +++ b/platform/darwin/src/MGLAccountManager.m @@ -54,11 +54,6 @@ return _sharedManager; } -+ (BOOL)mapboxMetricsEnabledSettingShownInApp { - NSLog(@"mapboxMetricsEnabledSettingShownInApp is no longer necessary; the Mapbox Maps SDK for iOS has changed to always provide a telemetry setting in-app."); - return YES; -} - + (void)setAccessToken:(NSString *)accessToken { accessToken = [accessToken stringByTrimmingCharactersInSet: [NSCharacterSet whitespaceAndNewlineCharacterSet]]; diff --git a/platform/darwin/src/MGLOfflineStorage.h b/platform/darwin/src/MGLOfflineStorage.h index b009f893b3..b3c9a0ede0 100644 --- a/platform/darwin/src/MGLOfflineStorage.h +++ b/platform/darwin/src/MGLOfflineStorage.h @@ -70,7 +70,7 @@ typedef NSString *MGLOfflinePackUserInfoKey NS_EXTENSIBLE_STRING_ENUM; */ extern MGL_EXPORT const MGLOfflinePackUserInfoKey MGLOfflinePackUserInfoKeyState; -extern MGL_EXPORT NSString * const MGLOfflinePackStateUserInfoKey __attribute__((deprecated("Use MGLOfflinePackUserInfoKeyState"))); +extern MGL_EXPORT NSString * const MGLOfflinePackStateUserInfoKey __attribute__((unavailable("Use MGLOfflinePackUserInfoKeyState"))); /** The key for an `NSValue` object that indicates an offline pack’s current @@ -81,7 +81,7 @@ extern MGL_EXPORT NSString * const MGLOfflinePackStateUserInfoKey __attribute__( */ extern MGL_EXPORT const MGLOfflinePackUserInfoKey MGLOfflinePackUserInfoKeyProgress; -extern MGL_EXPORT NSString * const MGLOfflinePackProgressUserInfoKey __attribute__((deprecated("Use MGLOfflinePackUserInfoKeyProgress"))); +extern MGL_EXPORT NSString * const MGLOfflinePackProgressUserInfoKey __attribute__((unavailable("Use MGLOfflinePackUserInfoKeyProgress"))); /** The key for an `NSError` object that is encountered in the course of @@ -91,7 +91,7 @@ extern MGL_EXPORT NSString * const MGLOfflinePackProgressUserInfoKey __attribute */ extern MGL_EXPORT const MGLOfflinePackUserInfoKey MGLOfflinePackUserInfoKeyError; -extern MGL_EXPORT NSString * const MGLOfflinePackErrorUserInfoKey __attribute__((deprecated("Use MGLOfflinePackUserInfoKeyError"))); +extern MGL_EXPORT NSString * const MGLOfflinePackErrorUserInfoKey __attribute__((unavailable("Use MGLOfflinePackUserInfoKeyError"))); /** The key for an `NSNumber` object that indicates the maximum number of @@ -103,7 +103,7 @@ extern MGL_EXPORT NSString * const MGLOfflinePackErrorUserInfoKey __attribute__( */ extern MGL_EXPORT const MGLOfflinePackUserInfoKey MGLOfflinePackUserInfoKeyMaximumCount; -extern MGL_EXPORT NSString * const MGLOfflinePackMaximumCountUserInfoKey __attribute__((deprecated("Use MGLOfflinePackUserInfoKeyMaximumCount"))); +extern MGL_EXPORT NSString * const MGLOfflinePackMaximumCountUserInfoKey __attribute__((unavailable("Use MGLOfflinePackUserInfoKeyMaximumCount"))); /** A block to be called once an offline pack has been completely created and diff --git a/platform/darwin/src/MGLOfflineStorage.mm b/platform/darwin/src/MGLOfflineStorage.mm index 7085aa58e5..4d999144e8 100644 --- a/platform/darwin/src/MGLOfflineStorage.mm +++ b/platform/darwin/src/MGLOfflineStorage.mm @@ -26,13 +26,9 @@ const NSNotificationName MGLOfflinePackErrorNotification = @"MGLOfflinePackError const NSNotificationName MGLOfflinePackMaximumMapboxTilesReachedNotification = @"MGLOfflinePackMaximumMapboxTilesReached"; const MGLOfflinePackUserInfoKey MGLOfflinePackUserInfoKeyState = @"State"; -NSString * const MGLOfflinePackStateUserInfoKey = MGLOfflinePackUserInfoKeyState; const MGLOfflinePackUserInfoKey MGLOfflinePackUserInfoKeyProgress = @"Progress"; -NSString * const MGLOfflinePackProgressUserInfoKey = MGLOfflinePackUserInfoKeyProgress; const MGLOfflinePackUserInfoKey MGLOfflinePackUserInfoKeyError = @"Error"; -NSString * const MGLOfflinePackErrorUserInfoKey = MGLOfflinePackUserInfoKeyError; const MGLOfflinePackUserInfoKey MGLOfflinePackUserInfoKeyMaximumCount = @"MaximumCount"; -NSString * const MGLOfflinePackMaximumCountUserInfoKey = MGLOfflinePackUserInfoKeyMaximumCount; @interface MGLOfflineStorage () diff --git a/platform/darwin/src/MGLStyle.h b/platform/darwin/src/MGLStyle.h index 0b360de8fc..eb7554534f 100644 --- a/platform/darwin/src/MGLStyle.h +++ b/platform/darwin/src/MGLStyle.h @@ -83,13 +83,7 @@ MGL_EXPORT */ + (NSURL *)streetsStyleURLWithVersion:(NSInteger)version; -/** - Returns the URL to version 8 of the - <a href="https://www.mapbox.com/blog/emerald-gl/">Mapbox Emerald</a> style. - - Emerald is a tactile style with subtle textures and dramatic hillshading. - */ -+ (NSURL *)emeraldStyleURL __attribute__((deprecated("Create an NSURL object with the string “mapbox://styles/mapbox/emerald-v8”."))); ++ (NSURL *)emeraldStyleURL __attribute__((unavailable("Create an NSURL object with the string “mapbox://styles/mapbox/emerald-v8”."))); /** Returns the URL to the current version of the @@ -191,16 +185,8 @@ MGL_EXPORT */ + (NSURL *)satelliteStyleURLWithVersion:(NSInteger)version; -/** - Returns the URL to version 8 of the - <a href="https://www.mapbox.com/maps/satellite/">Mapbox Satellite Streets</a> - style. - Satellite Streets combines the high-resolution satellite and aerial imagery of - Mapbox Satellite with unobtrusive labels and translucent roads from Mapbox - Streets. - */ -+ (NSURL *)hybridStyleURL __attribute__((deprecated("Use -satelliteStreetsStyleURL."))); ++ (NSURL *)hybridStyleURL __attribute__((unavailable("Use -satelliteStreetsStyleURL."))); /** Returns the URL to the current version of the @@ -232,39 +218,14 @@ MGL_EXPORT */ + (NSURL *)satelliteStreetsStyleURLWithVersion:(NSInteger)version; -/** - Returns the URL to version 2 of the - <a href="https://www.mapbox.com/blog/live-traffic-maps/">Mapbox Traffic Day</a> - style. - - */ -+ (NSURL *)trafficDayStyleURL __attribute__((deprecated("Create an NSURL object with the string “mapbox://styles/mapbox/traffic-day-v2”."))); -/** - Returns the URL to the given version of the - <a href="https://www.mapbox.com/blog/live-traffic-maps/">Mapbox Traffic Day</a> - style as of publication. - - @param version A specific version of the style. - */ -+ (NSURL *)trafficDayStyleURLWithVersion:(NSInteger)version __attribute__((deprecated("Create an NSURL object with the string “mapbox://styles/mapbox/traffic-day-v2”.")));; ++ (NSURL *)trafficDayStyleURL __attribute__((unavailable("Create an NSURL object with the string “mapbox://styles/mapbox/traffic-day-v2”."))); -/** - Returns the URL to the version 2 of the - <a href="https://www.mapbox.com/blog/live-traffic-maps/">Mapbox Traffic Night</a> - style. ++ (NSURL *)trafficDayStyleURLWithVersion:(NSInteger)version __attribute__((unavailable("Create an NSURL object with the string “mapbox://styles/mapbox/traffic-day-v2”.")));; - */ -+ (NSURL *)trafficNightStyleURL __attribute__((deprecated("Create an NSURL object with the string “mapbox://styles/mapbox/traffic-night-v2”."))); ++ (NSURL *)trafficNightStyleURL __attribute__((unavailable("Create an NSURL object with the string “mapbox://styles/mapbox/traffic-night-v2”."))); -/** - Returns the URL to to the version 2 of the - <a href="https://www.mapbox.com/blog/live-traffic-maps/">Mapbox Traffic Night</a> - style as of publication. - - @param version A specific version of the style. - */ -+ (NSURL *)trafficNightStyleURLWithVersion:(NSInteger)version __attribute__((deprecated("Create an NSURL object with the string “mapbox://styles/mapbox/traffic-night-v2”."))); ++ (NSURL *)trafficNightStyleURLWithVersion:(NSInteger)version __attribute__((unavailable("Create an NSURL object with the string “mapbox://styles/mapbox/traffic-night-v2”."))); #pragma mark Accessing Metadata About the Style @@ -458,22 +419,22 @@ MGL_EXPORT /** Support for style classes has been removed. This property always returns an empty array. */ -@property (nonatomic) NS_ARRAY_OF(NSString *) *styleClasses __attribute__((deprecated("This property is non-functional."))); +@property (nonatomic) NS_ARRAY_OF(NSString *) *styleClasses __attribute__((unavailable("This property is non-functional."))); /** Support for style classes has been removed. This method always returns NO. */ -- (BOOL)hasStyleClass:(NSString *)styleClass __attribute__((deprecated("This method is non-functional."))); +- (BOOL)hasStyleClass:(NSString *)styleClass __attribute__((unavailable("This method is non-functional."))); /** Support for style classes has been removed. This method is a no-op. */ -- (void)addStyleClass:(NSString *)styleClass __attribute__((deprecated("This method is non-functional."))); +- (void)addStyleClass:(NSString *)styleClass __attribute__((unavailable("This method is non-functional."))); /** Support for style classes has been removed. This method is a no-op. */ -- (void)removeStyleClass:(NSString *)styleClass __attribute__((deprecated("This method is non-functional."))); +- (void)removeStyleClass:(NSString *)styleClass __attribute__((unavailable("This method is non-functional."))); #pragma mark Managing a Style’s Images diff --git a/platform/darwin/src/MGLStyle.mm b/platform/darwin/src/MGLStyle.mm index f6fc5533be..199f6c2e02 100644 --- a/platform/darwin/src/MGLStyle.mm +++ b/platform/darwin/src/MGLStyle.mm @@ -116,58 +116,9 @@ MGL_DEFINE_STYLE(satelliteStreets, satellite-streets) // Make sure all the styles listed in mbgl::util::default_styles::orderedStyles // are defined above and also declared in MGLStyle.h. -static_assert(8 == mbgl::util::default_styles::numOrderedStyles, +static_assert(6 == mbgl::util::default_styles::numOrderedStyles, "mbgl::util::default_styles::orderedStyles and MGLStyle have different numbers of styles."); -// Hybrid has been renamed Satellite Streets, so the last Hybrid version is hard-coded here. -static NSURL *MGLStyleURL_hybrid; -+ (NSURL *)hybridStyleURL { - static dispatch_once_t onceToken; - dispatch_once(&onceToken, ^{ - MGLStyleURL_hybrid = [NSURL URLWithString:@"mapbox://styles/mapbox/satellite-hybrid-v8"]; - }); - return MGLStyleURL_hybrid; -} - -// Emerald is no longer getting new versions as a default style, so the current version is hard-coded here. -static NSURL *MGLStyleURL_emerald; -+ (NSURL *)emeraldStyleURL { - static dispatch_once_t onceToken; - dispatch_once(&onceToken, ^{ - MGLStyleURL_emerald = [NSURL URLWithString:@"mapbox://styles/mapbox/emerald-v8"]; - }); - return MGLStyleURL_emerald; -} - -// Traffic Day is no longer getting new versions as a default style, so the current version is hard-coded here. -static NSURL *MGLStyleURL_trafficDay; -+ (NSURL *)trafficDayStyleURL { - static dispatch_once_t onceToken; - dispatch_once(&onceToken, ^{ - MGLStyleURL_trafficDay = [NSURL URLWithString:@"mapbox://styles/mapbox/traffic-day-v2"]; - }); - return MGLStyleURL_trafficDay; -} - -+ (NSURL *)trafficDayStyleURLWithVersion:(NSInteger)version { - return [NSURL URLWithString:[@"mapbox://styles/mapbox/traffic-day-v" stringByAppendingFormat:@"%li", (long)version]]; -} - -// Traffic Night is no longer getting new versions as a default style, so the current version is hard-coded here. -static NSURL *MGLStyleURL_trafficNight; -+ (NSURL *)trafficNightStyleURL { - static dispatch_once_t onceToken; - dispatch_once(&onceToken, ^{ - MGLStyleURL_trafficNight = [NSURL URLWithString:@"mapbox://styles/mapbox/traffic-night-v2"]; - }); - return MGLStyleURL_trafficNight; -} - -+ (NSURL *)trafficNightStyleURLWithVersion:(NSInteger)version { - return [NSURL URLWithString:[@"mapbox://styles/mapbox/traffic-night-v" stringByAppendingFormat:@"%li", (long)version]]; -} - - #pragma mark - - (instancetype)initWithRawStyle:(mbgl::style::Style *)rawStyle mapView:(MGLMapView *)mapView { @@ -534,38 +485,6 @@ static NSURL *MGLStyleURL_trafficNight; [self didChangeValueForKey:@"layers"]; } -#pragma mark Style classes - -- (NS_ARRAY_OF(NSString *) *)styleClasses -{ - return @[]; -} - -- (void)setStyleClasses:(NS_ARRAY_OF(NSString *) *)appliedClasses -{ -} - -- (void)setStyleClasses:(NS_ARRAY_OF(NSString *) *)appliedClasses transitionDuration:(NSTimeInterval)transitionDuration -{ -} - -- (NSUInteger)countOfStyleClasses { - return 0; -} - -- (BOOL)hasStyleClass:(NSString *)styleClass -{ - return NO; -} - -- (void)addStyleClass:(NSString *)styleClass -{ -} - -- (void)removeStyleClass:(NSString *)styleClass -{ -} - #pragma mark Style images - (void)setImage:(MGLImage *)image forName:(NSString *)name diff --git a/platform/darwin/test/MGLStyleTests.mm b/platform/darwin/test/MGLStyleTests.mm index 8f610e338c..95051cfae0 100644 --- a/platform/darwin/test/MGLStyleTests.mm +++ b/platform/darwin/test/MGLStyleTests.mm @@ -64,12 +64,6 @@ XCTAssertEqualObjects([MGLStyle darkStyleURL].absoluteString, @(mbgl::util::default_styles::dark.url)); XCTAssertEqualObjects([MGLStyle satelliteStyleURL].absoluteString, @(mbgl::util::default_styles::satellite.url)); XCTAssertEqualObjects([MGLStyle satelliteStreetsStyleURL].absoluteString, @(mbgl::util::default_styles::satelliteStreets.url)); - -#pragma clang diagnostic push -#pragma clang diagnostic ignored "-Wdeprecated-declarations" - XCTAssertEqualObjects([MGLStyle emeraldStyleURL].absoluteString, @"mapbox://styles/mapbox/emerald-v8"); - XCTAssertEqualObjects([MGLStyle hybridStyleURL].absoluteString, @"mapbox://styles/mapbox/satellite-hybrid-v8"); -#pragma clang diagnostic pop } - (void)testVersionedStyleURLs { @@ -99,19 +93,8 @@ @(mbgl::util::default_styles::satelliteStreets.url)); XCTAssertEqualObjects([MGLStyle satelliteStreetsStyleURLWithVersion:99].absoluteString, @"mapbox://styles/mapbox/satellite-streets-v99"); -#pragma clang diagnostic push -#pragma clang diagnostic ignored "-Wdeprecated-declarations" - XCTAssertEqualObjects([MGLStyle trafficDayStyleURLWithVersion:mbgl::util::default_styles::trafficDay.currentVersion].absoluteString, - @(mbgl::util::default_styles::trafficDay.url)); - XCTAssertEqualObjects([MGLStyle trafficDayStyleURLWithVersion:99].absoluteString, - @"mapbox://styles/mapbox/traffic-day-v99"); - XCTAssertEqualObjects([MGLStyle trafficNightStyleURLWithVersion:mbgl::util::default_styles::trafficNight.currentVersion].absoluteString, - @(mbgl::util::default_styles::trafficNight.url)); - XCTAssertEqualObjects([MGLStyle trafficNightStyleURLWithVersion:99].absoluteString, - @"mapbox://styles/mapbox/traffic-night-v99"); -#pragma clang diagnostic pop - - static_assert(8 == mbgl::util::default_styles::numOrderedStyles, + + static_assert(6 == mbgl::util::default_styles::numOrderedStyles, "MGLStyleTests isn’t testing all the styles in mbgl::util::default_styles."); } @@ -143,7 +126,7 @@ 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*\b)RE"); + NSString *versionedMethodExpressionString = @(R"RE(^\+\s*\(NSURL\s*\*\s*\)\s*(?!traffic)\w+StyleURLWithVersion\s*:\s*\(\s*NSInteger\s*\)\s*version\s*\b)RE"); NSRegularExpression *versionedMethodExpression = [NSRegularExpression regularExpressionWithPattern:versionedMethodExpressionString options:NSRegularExpressionAnchorsMatchLines error:&versionedMethodError]; XCTAssertNil(versionedMethodError, @"Error compiling regular expression to search for versioned methods."); NSUInteger numVersionedMethodDeclarations = [versionedMethodExpression numberOfMatchesInString:styleHeader options:0 range:NSMakeRange(0, styleHeader.length)]; @@ -383,13 +366,6 @@ return styleHeader; } -- (void)testClasses { -#pragma clang diagnostic push -#pragma clang diagnostic ignored "-Wdeprecated-declarations" - XCTAssertEqual(self.style.styleClasses.count, 0); -#pragma clang diagnostic pop -} - - (void)testImages { NSString *imageName = @"TrackingLocationMask"; #if TARGET_OS_IPHONE |