Skip to content

Commit 2dad181

Browse files
[google_maps_flutter] Fix iOS analysis for newer Xcode (#9415)
Fixes analysis failures that fail CI in newer versions of the toolchain. Currently these are surfaced in the Xcode UI, but not the command-line analysis run done in CI. This unblocks future CI updates. Fixes flutter/flutter#170354 ## Pre-Review Checklist [^1]: Regular contributors who have demonstrated familiarity with the repository guidelines only need to comment if the PR is not auto-exempted by repo tooling.
1 parent 3c7859f commit 2dad181

File tree

5 files changed

+26
-23
lines changed

5 files changed

+26
-23
lines changed

packages/google_maps_flutter/google_maps_flutter_ios/CHANGELOG.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
1-
## NEXT
1+
## 2.15.3
22

3+
* Fixes new analysis warnings.
34
* Updates minimum supported SDK version to Flutter 3.27/Dart 3.6.
45

56
## 2.15.2

packages/google_maps_flutter/google_maps_flutter_ios/ios/Classes/FGMImageUtils.h

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,9 @@
99
NS_ASSUME_NONNULL_BEGIN
1010

1111
/// Creates a UIImage from Pigeon bitmap.
12-
UIImage *FGMIconFromBitmap(FGMPlatformBitmap *platformBitmap,
13-
NSObject<FlutterPluginRegistrar> *registrar, CGFloat screenScale);
12+
UIImage *_Nullable FGMIconFromBitmap(FGMPlatformBitmap *platformBitmap,
13+
NSObject<FlutterPluginRegistrar> *registrar,
14+
CGFloat screenScale);
1415
/// Returns a BOOL indicating whether image is considered scalable with the given scale factor from
1516
/// size.
1617
BOOL FGMIsScalableWithScaleFactorFromSize(CGSize originalSize, CGSize targetSize);

packages/google_maps_flutter/google_maps_flutter_ios/ios/Classes/FGMImageUtils.m

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -191,18 +191,18 @@
191191

192192
UIImage *scaledImageWithWidthHeight(UIImage *image, NSNumber *width, NSNumber *height,
193193
CGFloat screenScale) {
194-
if (!width && !height) {
194+
if ((width == nil) && (height == nil)) {
195195
return image;
196196
}
197197

198-
CGFloat targetWidth = width ? width.doubleValue : image.size.width;
199-
CGFloat targetHeight = height ? height.doubleValue : image.size.height;
198+
CGFloat targetWidth = width == nil ? image.size.width : width.doubleValue;
199+
CGFloat targetHeight = height == nil ? image.size.height : height.doubleValue;
200200

201-
if (width && !height) {
201+
if ((width != nil) && (height == nil)) {
202202
// Calculate height based on aspect ratio if only width is provided.
203203
double aspectRatio = image.size.height / image.size.width;
204204
targetHeight = round(targetWidth * aspectRatio);
205-
} else if (!width && height) {
205+
} else if ((width == nil) && (height != nil)) {
206206
// Calculate width based on aspect ratio if only height is provided.
207207
double aspectRatio = image.size.width / image.size.height;
208208
targetWidth = round(targetHeight * aspectRatio);

packages/google_maps_flutter/google_maps_flutter_ios/ios/Classes/GoogleMapController.m

Lines changed: 15 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -436,19 +436,19 @@ - (void)interpretMapConfiguration:(FGMPlatformMapConfiguration *)config {
436436
: nil];
437437
}
438438
NSNumber *compassEnabled = config.compassEnabled;
439-
if (compassEnabled) {
439+
if (compassEnabled != nil) {
440440
[self setCompassEnabled:compassEnabled.boolValue];
441441
}
442442
NSNumber *indoorEnabled = config.indoorViewEnabled;
443-
if (indoorEnabled) {
443+
if (indoorEnabled != nil) {
444444
[self setIndoorEnabled:indoorEnabled.boolValue];
445445
}
446446
NSNumber *trafficEnabled = config.trafficEnabled;
447-
if (trafficEnabled) {
447+
if (trafficEnabled != nil) {
448448
[self setTrafficEnabled:trafficEnabled.boolValue];
449449
}
450450
NSNumber *buildingsEnabled = config.buildingsEnabled;
451-
if (buildingsEnabled) {
451+
if (buildingsEnabled != nil) {
452452
[self setBuildingsEnabled:buildingsEnabled.boolValue];
453453
}
454454
FGMPlatformMapTypeBox *mapType = config.mapType;
@@ -457,8 +457,8 @@ - (void)interpretMapConfiguration:(FGMPlatformMapConfiguration *)config {
457457
}
458458
FGMPlatformZoomRange *zoomData = config.minMaxZoomPreference;
459459
if (zoomData) {
460-
float minZoom = zoomData.min ? zoomData.min.floatValue : kGMSMinZoomLevel;
461-
float maxZoom = zoomData.max ? zoomData.max.floatValue : kGMSMaxZoomLevel;
460+
float minZoom = zoomData.min != nil ? zoomData.min.floatValue : kGMSMinZoomLevel;
461+
float maxZoom = zoomData.max != nil ? zoomData.max.floatValue : kGMSMaxZoomLevel;
462462
[self setMinZoom:minZoom maxZoom:maxZoom];
463463
}
464464
FGMPlatformEdgeInsets *padding = config.padding;
@@ -467,31 +467,31 @@ - (void)interpretMapConfiguration:(FGMPlatformMapConfiguration *)config {
467467
}
468468

469469
NSNumber *rotateGesturesEnabled = config.rotateGesturesEnabled;
470-
if (rotateGesturesEnabled) {
470+
if (rotateGesturesEnabled != nil) {
471471
[self setRotateGesturesEnabled:rotateGesturesEnabled.boolValue];
472472
}
473473
NSNumber *scrollGesturesEnabled = config.scrollGesturesEnabled;
474-
if (scrollGesturesEnabled) {
474+
if (scrollGesturesEnabled != nil) {
475475
[self setScrollGesturesEnabled:scrollGesturesEnabled.boolValue];
476476
}
477477
NSNumber *tiltGesturesEnabled = config.tiltGesturesEnabled;
478-
if (tiltGesturesEnabled) {
478+
if (tiltGesturesEnabled != nil) {
479479
[self setTiltGesturesEnabled:tiltGesturesEnabled.boolValue];
480480
}
481481
NSNumber *trackCameraPosition = config.trackCameraPosition;
482-
if (trackCameraPosition) {
482+
if (trackCameraPosition != nil) {
483483
[self setTrackCameraPosition:trackCameraPosition.boolValue];
484484
}
485485
NSNumber *zoomGesturesEnabled = config.zoomGesturesEnabled;
486-
if (zoomGesturesEnabled) {
486+
if (zoomGesturesEnabled != nil) {
487487
[self setZoomGesturesEnabled:zoomGesturesEnabled.boolValue];
488488
}
489489
NSNumber *myLocationEnabled = config.myLocationEnabled;
490-
if (myLocationEnabled) {
490+
if (myLocationEnabled != nil) {
491491
[self setMyLocationEnabled:myLocationEnabled.boolValue];
492492
}
493493
NSNumber *myLocationButtonEnabled = config.myLocationButtonEnabled;
494-
if (myLocationButtonEnabled) {
494+
if (myLocationButtonEnabled != nil) {
495495
[self setMyLocationButtonEnabled:myLocationButtonEnabled.boolValue];
496496
}
497497
NSString *style = config.style;
@@ -665,7 +665,8 @@ - (void)animateCameraWithUpdate:(nonnull FGMPlatformCameraUpdate *)cameraUpdate
665665
details:nil];
666666
return;
667667
}
668-
FGMCATransactionWrapper *transaction = durationMilliseconds ? self.transactionWrapper : nil;
668+
FGMCATransactionWrapper *transaction =
669+
durationMilliseconds != nil ? self.transactionWrapper : nil;
669670
[transaction begin];
670671
[transaction setAnimationDuration:[durationMilliseconds doubleValue] / 1000];
671672
[self.controller.mapView animateWithCameraUpdate:update];

packages/google_maps_flutter/google_maps_flutter_ios/pubspec.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ name: google_maps_flutter_ios
22
description: iOS implementation of the google_maps_flutter plugin.
33
repository: https://github.com/flutter/packages/tree/main/packages/google_maps_flutter/google_maps_flutter_ios
44
issue_tracker: https://github.com/flutter/flutter/issues?q=is%3Aissue+is%3Aopen+label%3A%22p%3A+maps%22
5-
version: 2.15.2
5+
version: 2.15.3
66

77
environment:
88
sdk: ^3.6.0

0 commit comments

Comments
 (0)