Skip to content
This repository has been archived by the owner on Aug 8, 2023. It is now read-only.

[ios] iOS 13 cherry-picks for ios-v5.3.1 (queso) #15612

Merged
merged 3 commits into from
Sep 16, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions platform/ios/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@

Mapbox welcomes participation and contributions from everyone. Please read [CONTRIBUTING.md](../../CONTRIBUTING.md) to get started.

## master
## 5.3.1

* Fixed an issue that caused the tilt gesture to trigger too easily and conflict with pinch or pan gestures. ([#15349](https://github.com/mapbox/mapbox-gl-native/pull/15349))
* Fixed a bug with annotation view positions after camera transitions. ([#15122](https://github.com/mapbox/mapbox-gl-native/pull/15122/))
* Fixed an issue where the scale bar text would become illegible if iOS 13 dark mode was enabled. ([#15524](https://github.com/mapbox/mapbox-gl-native/pull/15524))
* Fixed an issue with the appearance of the compass text in iOS 13. ([#15547](https://github.com/mapbox/mapbox-gl-native/pull/15547))

## 5.3.0 - August 28, 2019

Expand Down
9 changes: 8 additions & 1 deletion platform/ios/src/MGLCompassButton.mm
Original file line number Diff line number Diff line change
Expand Up @@ -63,9 +63,16 @@ - (UIImage *)compassImage {
UIImage *scaleImage = [UIImage mgl_resourceImageNamed:@"Compass"];
UIGraphicsBeginImageContextWithOptions(scaleImage.size, NO, UIScreen.mainScreen.scale);
[scaleImage drawInRect:{CGPointZero, scaleImage.size}];

UIFont *northFont;
if (@available(iOS 13.0, *)) {
northFont = [UIFont systemFontOfSize:11 weight:UIFontWeightLight];
} else {
northFont = [UIFont systemFontOfSize:11 weight:UIFontWeightUltraLight];
}

NSAttributedString *north = [[NSAttributedString alloc] initWithString:NSLocalizedStringWithDefaultValue(@"COMPASS_NORTH", nil, nil, @"N", @"Compass abbreviation for north") attributes:@{
NSFontAttributeName: [UIFont systemFontOfSize:11 weight:UIFontWeightUltraLight],
NSFontAttributeName: northFont,
NSForegroundColorAttributeName: [UIColor whiteColor],
}];
CGRect stringRect = CGRectMake((scaleImage.size.width - north.size.width) / 2,
Expand Down
48 changes: 21 additions & 27 deletions platform/ios/src/MGLMapView.mm
Original file line number Diff line number Diff line change
Expand Up @@ -5291,35 +5291,29 @@ - (void)validateLocationServices

if (shouldEnableLocationServices)
{
if (self.locationManager.authorizationStatus == kCLAuthorizationStatusNotDetermined)
{
BOOL requiresWhenInUseUsageDescription = [NSProcessInfo.processInfo isOperatingSystemAtLeastVersion:(NSOperatingSystemVersion){11,0,0}];
if (self.locationManager.authorizationStatus == kCLAuthorizationStatusNotDetermined) {
BOOL hasWhenInUseUsageDescription = !![[NSBundle mainBundle] objectForInfoDictionaryKey:@"NSLocationWhenInUseUsageDescription"];
BOOL hasAlwaysUsageDescription;
if (requiresWhenInUseUsageDescription)
{
hasAlwaysUsageDescription = !![[NSBundle mainBundle] objectForInfoDictionaryKey:@"NSLocationAlwaysAndWhenInUseUsageDescription"] && hasWhenInUseUsageDescription;
}
else
{
hasAlwaysUsageDescription = !![[NSBundle mainBundle] objectForInfoDictionaryKey:@"NSLocationAlwaysUsageDescription"];
}

if (hasAlwaysUsageDescription)
{
[self.locationManager requestAlwaysAuthorization];
}
else if (hasWhenInUseUsageDescription)
{
[self.locationManager requestWhenInUseAuthorization];
}
else
{
NSString *suggestedUsageKeys = requiresWhenInUseUsageDescription ?
@"NSLocationWhenInUseUsageDescription and (optionally) NSLocationAlwaysAndWhenInUseUsageDescription" :
@"NSLocationWhenInUseUsageDescription and/or NSLocationAlwaysUsageDescription";
[NSException raise:MGLMissingLocationServicesUsageDescriptionException
format:@"This app must have a value for %@ in its Info.plist.", suggestedUsageKeys];
if (@available(iOS 11.0, *)) {
// A WhenInUse string is required in iOS 11+ and the map never has any need for Always, so it's enough to just ask for WhenInUse.
if (hasWhenInUseUsageDescription) {
[self.locationManager requestWhenInUseAuthorization];
} else {
[NSException raise:MGLMissingLocationServicesUsageDescriptionException
format:@"To use location services this app must have a NSLocationWhenInUseUsageDescription string in its Info.plist."];
}
} else {
// We might have to ask for Always if the app does not provide a WhenInUse string.
BOOL hasAlwaysUsageDescription = !![[NSBundle mainBundle] objectForInfoDictionaryKey:@"NSLocationAlwaysUsageDescription"];

if (hasWhenInUseUsageDescription) {
[self.locationManager requestWhenInUseAuthorization];
} else if (hasAlwaysUsageDescription) {
[self.locationManager requestAlwaysAuthorization];
} else {
[NSException raise:MGLMissingLocationServicesUsageDescriptionException
format:@"To use location services this app must have a NSLocationWhenInUseUsageDescription and/or NSLocationAlwaysUsageDescription string in its Info.plist."];
}
}
}

Expand Down
3 changes: 1 addition & 2 deletions platform/ios/src/MGLScaleBar.mm
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,6 @@ @implementation MGLScaleBarLabel

- (void)drawTextInRect:(CGRect)rect {
CGSize shadowOffset = self.shadowOffset;
UIColor *textColor = self.textColor;

CGContextRef context = UIGraphicsGetCurrentContext();
CGContextSetLineWidth(context, 2);
Expand All @@ -112,7 +111,7 @@ - (void)drawTextInRect:(CGRect)rect {
[super drawTextInRect:rect];

CGContextSetTextDrawingMode(context, kCGTextFill);
self.textColor = textColor;
self.textColor = [UIColor blackColor];
self.shadowOffset = CGSizeMake(0, 0);
[super drawTextInRect:rect];

Expand Down