diff options
Diffstat (limited to 'platform/darwin/src/MGLAttributionInfo.mm')
-rw-r--r-- | platform/darwin/src/MGLAttributionInfo.mm | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/platform/darwin/src/MGLAttributionInfo.mm b/platform/darwin/src/MGLAttributionInfo.mm index 52a83fd18e..e8d6a203d0 100644 --- a/platform/darwin/src/MGLAttributionInfo.mm +++ b/platform/darwin/src/MGLAttributionInfo.mm @@ -16,7 +16,7 @@ @implementation MGLAttributionInfo -+ (NS_ARRAY_OF(MGLAttributionInfo *) *)attributionInfosFromHTMLString:(nullable NSString *)htmlString fontSize:(CGFloat)fontSize linkColor:(nullable MGLColor *)linkColor { ++ (NSArray<MGLAttributionInfo *> *)attributionInfosFromHTMLString:(nullable NSString *)htmlString fontSize:(CGFloat)fontSize linkColor:(nullable MGLColor *)linkColor { if (!htmlString) { return @[]; } @@ -49,7 +49,12 @@ CGFloat blue; CGFloat alpha; #if !TARGET_OS_IPHONE - linkColor = [linkColor colorUsingColorSpaceName:NSCalibratedRGBColorSpace]; + // CSS uses the sRGB color space. + if ([NSColor redColor].colorSpaceName == NSCalibratedRGBColorSpace) { + linkColor = [linkColor colorUsingColorSpaceName:NSCalibratedRGBColorSpace]; + } else { + linkColor = [linkColor colorUsingColorSpace:[NSColorSpace sRGBColorSpace]]; + } #endif [linkColor getRed:&red green:&green blue:&blue alpha:&alpha]; [css appendFormat: @@ -107,7 +112,7 @@ return infos; } -+ (NSAttributedString *)attributedStringForAttributionInfos:(NS_ARRAY_OF(MGLAttributionInfo *) *)attributionInfos { ++ (NSAttributedString *)attributedStringForAttributionInfos:(NSArray<MGLAttributionInfo *> *)attributionInfos { NSMutableArray *titles = [NSMutableArray arrayWithCapacity:attributionInfos.count]; for (MGLAttributionInfo *info in attributionInfos) { NSMutableAttributedString *title = info.title.mutableCopy; @@ -160,6 +165,7 @@ [NSURLQueryItem queryItemWithName:@"owner" value:stylePathComponents[1]], [NSURLQueryItem queryItemWithName:@"id" value:stylePathComponents[2]], [NSURLQueryItem queryItemWithName:@"access_token" value:[MGLAccountManager accessToken]], + [NSURLQueryItem queryItemWithName:@"map_sdk_version" value:[NSBundle mgl_frameworkInfoDictionary][@"MGLSemanticVersionString"]], ]]; } } @@ -253,7 +259,7 @@ } } -- (void)growArrayByAddingAttributionInfosFromArray:(NS_ARRAY_OF(MGLAttributionInfo *) *)infos { +- (void)growArrayByAddingAttributionInfosFromArray:(NSArray<MGLAttributionInfo *> *)infos { for (MGLAttributionInfo *info in infos) { [self growArrayByAddingAttributionInfo:info]; } |