Skip to content
This repository was archived by the owner on Feb 22, 2023. It is now read-only.

[google_maps_flutter] Define clang module for iOS, fix analyzer warnings #2182

Merged
merged 2 commits into from
Nov 13, 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
4 changes: 4 additions & 0 deletions packages/google_maps_flutter/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## 0.5.21+11

* Define clang module for iOS, fix analyzer warnings.

## 0.5.21+10

* Cast error.code to unsigned long to avoid using NSInteger as %ld format warnings.
Expand Down
7 changes: 4 additions & 3 deletions packages/google_maps_flutter/example/ios/Runner/AppDelegate.m
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#include "AppDelegate.h"
#include "GeneratedPluginRegistrant.h"
#import "GoogleMaps/GoogleMaps.h"
#import "AppDelegate.h"
#import "GeneratedPluginRegistrant.h"

@import GoogleMaps;

@implementation AppDelegate

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,17 +73,17 @@ static CLLocationDistance ToDistance(NSNumber* data) {
static void InterpretCircleOptions(NSDictionary* data, id<FLTGoogleMapCircleOptionsSink> sink,
NSObject<FlutterPluginRegistrar>* registrar) {
NSNumber* consumeTapEvents = data[@"consumeTapEvents"];
if (consumeTapEvents) {
if (consumeTapEvents != nil) {
[sink setConsumeTapEvents:ToBool(consumeTapEvents)];
}

NSNumber* visible = data[@"visible"];
if (visible) {
if (visible != nil) {
[sink setVisible:ToBool(visible)];
}

NSNumber* zIndex = data[@"zIndex"];
if (zIndex) {
if (zIndex != nil) {
[sink setZIndex:ToInt(zIndex)];
}

Expand All @@ -93,22 +93,22 @@ static void InterpretCircleOptions(NSDictionary* data, id<FLTGoogleMapCircleOpti
}

NSNumber* radius = data[@"radius"];
if (radius) {
if (radius != nil) {
[sink setRadius:ToDistance(radius)];
}

NSNumber* strokeColor = data[@"strokeColor"];
if (strokeColor) {
if (strokeColor != nil) {
[sink setStrokeColor:ToColor(strokeColor)];
}

NSNumber* strokeWidth = data[@"strokeWidth"];
if (strokeWidth) {
if (strokeWidth != nil) {
[sink setStrokeWidth:ToInt(strokeWidth)];
}

NSNumber* fillColor = data[@"fillColor"];
if (fillColor) {
if (fillColor != nil) {
[sink setFillColor:ToColor(fillColor)];
}
}
Expand Down
10 changes: 5 additions & 5 deletions packages/google_maps_flutter/ios/Classes/GoogleMapController.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ NS_ASSUME_NONNULL_BEGIN

// Defines map UI options writable from Flutter.
@protocol FLTGoogleMapOptionsSink
- (void)setCameraTargetBounds:(GMSCoordinateBounds *)bounds;
- (void)setCameraTargetBounds:(nullable GMSCoordinateBounds *)bounds;
- (void)setCompassEnabled:(BOOL)enabled;
- (void)setIndoorEnabled:(BOOL)enabled;
- (void)setTrafficEnabled:(BOOL)enabled;
Expand All @@ -27,26 +27,26 @@ NS_ASSUME_NONNULL_BEGIN
- (void)setZoomGesturesEnabled:(BOOL)enabled;
- (void)setMyLocationEnabled:(BOOL)enabled;
- (void)setMyLocationButtonEnabled:(BOOL)enabled;
- (NSString *)setMapStyle:(NSString *)mapStyle;
- (nullable NSString *)setMapStyle:(NSString *)mapStyle;
@end

// Defines map overlay controllable from Flutter.
@interface FLTGoogleMapController
: NSObject <GMSMapViewDelegate, FLTGoogleMapOptionsSink, FlutterPlatformView>
- (instancetype)initWithFrame:(CGRect)frame
viewIdentifier:(int64_t)viewId
arguments:(id _Nullable)args
arguments:(nullable id)args
registrar:(NSObject<FlutterPluginRegistrar> *)registrar;
- (void)showAtX:(CGFloat)x Y:(CGFloat)y;
- (void)hide;
- (void)animateWithCameraUpdate:(GMSCameraUpdate *)cameraUpdate;
- (void)moveWithCameraUpdate:(GMSCameraUpdate *)cameraUpdate;
- (GMSCameraPosition *)cameraPosition;
- (nullable GMSCameraPosition *)cameraPosition;
@end

// Allows the engine to create new Google Map instances.
@interface FLTGoogleMapFactory : NSObject <FlutterPlatformViewFactory>
- (instancetype)initWithRegistrar:(NSObject<FlutterPluginRegistrar> *)registrar;
@end

NS_ASSUME_NONNULL_END
NS_ASSUME_NONNULL_END
18 changes: 9 additions & 9 deletions packages/google_maps_flutter/ios/Classes/GoogleMapController.m
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ - (instancetype)initWithFrame:(CGRect)frame
viewIdentifier:(int64_t)viewId
arguments:(id _Nullable)args
registrar:(NSObject<FlutterPluginRegistrar>*)registrar {
if ([super init]) {
if (self = [super init]) {
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

😬

_viewId = viewId;

GMSCameraPosition* camera = ToOptionalCameraPosition(args[@"initialCameraPosition"]);
Expand Down Expand Up @@ -543,7 +543,7 @@ static void InterpretMapOptions(NSDictionary* data, id<FLTGoogleMapOptionsSink>
[sink setCameraTargetBounds:ToOptionalBounds(cameraTargetBounds)];
}
NSNumber* compassEnabled = data[@"compassEnabled"];
if (compassEnabled) {
if (compassEnabled != nil) {
[sink setCompassEnabled:ToBool(compassEnabled)];
}
id indoorEnabled = data[@"indoorEnabled"];
Expand Down Expand Up @@ -574,31 +574,31 @@ static void InterpretMapOptions(NSDictionary* data, id<FLTGoogleMapOptionsSink>
}

NSNumber* rotateGesturesEnabled = data[@"rotateGesturesEnabled"];
if (rotateGesturesEnabled) {
if (rotateGesturesEnabled != nil) {
[sink setRotateGesturesEnabled:ToBool(rotateGesturesEnabled)];
}
NSNumber* scrollGesturesEnabled = data[@"scrollGesturesEnabled"];
if (scrollGesturesEnabled) {
if (scrollGesturesEnabled != nil) {
[sink setScrollGesturesEnabled:ToBool(scrollGesturesEnabled)];
}
NSNumber* tiltGesturesEnabled = data[@"tiltGesturesEnabled"];
if (tiltGesturesEnabled) {
if (tiltGesturesEnabled != nil) {
[sink setTiltGesturesEnabled:ToBool(tiltGesturesEnabled)];
}
NSNumber* trackCameraPosition = data[@"trackCameraPosition"];
if (trackCameraPosition) {
if (trackCameraPosition != nil) {
[sink setTrackCameraPosition:ToBool(trackCameraPosition)];
}
NSNumber* zoomGesturesEnabled = data[@"zoomGesturesEnabled"];
if (zoomGesturesEnabled) {
if (zoomGesturesEnabled != nil) {
[sink setZoomGesturesEnabled:ToBool(zoomGesturesEnabled)];
}
NSNumber* myLocationEnabled = data[@"myLocationEnabled"];
if (myLocationEnabled) {
if (myLocationEnabled != nil) {
[sink setMyLocationEnabled:ToBool(myLocationEnabled)];
}
NSNumber* myLocationButtonEnabled = data[@"myLocationButtonEnabled"];
if (myLocationButtonEnabled) {
if (myLocationButtonEnabled != nil) {
[sink setMyLocationButtonEnabled:ToBool(myLocationButtonEnabled)];
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -95,15 +95,15 @@ static CLLocationCoordinate2D ToLocation(NSArray* data) {
static void InterpretMarkerOptions(NSDictionary* data, id<FLTGoogleMapMarkerOptionsSink> sink,
NSObject<FlutterPluginRegistrar>* registrar) {
NSNumber* alpha = data[@"alpha"];
if (alpha) {
if (alpha != nil) {
[sink setAlpha:ToFloat(alpha)];
}
NSArray* anchor = data[@"anchor"];
if (anchor) {
[sink setAnchor:ToPoint(anchor)];
}
NSNumber* draggable = data[@"draggable"];
if (draggable) {
if (draggable != nil) {
[sink setDraggable:ToBool(draggable)];
}
NSArray* icon = data[@"icon"];
Expand All @@ -112,11 +112,11 @@ static void InterpretMarkerOptions(NSDictionary* data, id<FLTGoogleMapMarkerOpti
[sink setIcon:image];
}
NSNumber* flat = data[@"flat"];
if (flat) {
if (flat != nil) {
[sink setFlat:ToBool(flat)];
}
NSNumber* consumeTapEvents = data[@"consumeTapEvents"];
if (consumeTapEvents) {
if (consumeTapEvents != nil) {
[sink setConsumeTapEvents:ToBool(consumeTapEvents)];
}
InterpretInfoWindow(sink, data);
Expand All @@ -125,15 +125,15 @@ static void InterpretMarkerOptions(NSDictionary* data, id<FLTGoogleMapMarkerOpti
[sink setPosition:ToLocation(position)];
}
NSNumber* rotation = data[@"rotation"];
if (rotation) {
if (rotation != nil) {
[sink setRotation:ToDouble(rotation)];
}
NSNumber* visible = data[@"visible"];
if (visible) {
if (visible != nil) {
[sink setVisible:ToBool(visible)];
}
NSNumber* zIndex = data[@"zIndex"];
if (zIndex) {
if (zIndex != nil) {
[sink setZIndex:ToInt(zIndex)];
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,17 +70,17 @@ - (void)setStrokeWidth:(CGFloat)width {
static void InterpretPolygonOptions(NSDictionary* data, id<FLTGoogleMapPolygonOptionsSink> sink,
NSObject<FlutterPluginRegistrar>* registrar) {
NSNumber* consumeTapEvents = data[@"consumeTapEvents"];
if (consumeTapEvents) {
if (consumeTapEvents != nil) {
[sink setConsumeTapEvents:ToBool(consumeTapEvents)];
}

NSNumber* visible = data[@"visible"];
if (visible) {
if (visible != nil) {
[sink setVisible:ToBool(visible)];
}

NSNumber* zIndex = data[@"zIndex"];
if (zIndex) {
if (zIndex != nil) {
[sink setZIndex:ToInt(zIndex)];
}

Expand All @@ -90,17 +90,17 @@ static void InterpretPolygonOptions(NSDictionary* data, id<FLTGoogleMapPolygonOp
}

NSNumber* fillColor = data[@"fillColor"];
if (fillColor) {
if (fillColor != nil) {
[sink setFillColor:ToColor(fillColor)];
}

NSNumber* strokeColor = data[@"strokeColor"];
if (strokeColor) {
if (strokeColor != nil) {
[sink setStrokeColor:ToColor(strokeColor)];
}

NSNumber* strokeWidth = data[@"strokeWidth"];
if (strokeWidth) {
if (strokeWidth != nil) {
[sink setStrokeWidth:ToInt(strokeWidth)];
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,17 +67,17 @@ - (void)setStrokeWidth:(CGFloat)width {
static void InterpretPolylineOptions(NSDictionary* data, id<FLTGoogleMapPolylineOptionsSink> sink,
NSObject<FlutterPluginRegistrar>* registrar) {
NSNumber* consumeTapEvents = data[@"consumeTapEvents"];
if (consumeTapEvents) {
if (consumeTapEvents != nil) {
[sink setConsumeTapEvents:ToBool(consumeTapEvents)];
}

NSNumber* visible = data[@"visible"];
if (visible) {
if (visible != nil) {
[sink setVisible:ToBool(visible)];
}

NSNumber* zIndex = data[@"zIndex"];
if (zIndex) {
if (zIndex != nil) {
[sink setZIndex:ToInt(zIndex)];
}

Expand All @@ -87,12 +87,12 @@ static void InterpretPolylineOptions(NSDictionary* data, id<FLTGoogleMapPolyline
}

NSNumber* strokeColor = data[@"color"];
if (strokeColor) {
if (strokeColor != nil) {
[sink setColor:ToColor(strokeColor)];
}

NSNumber* strokeWidth = data[@"width"];
if (strokeWidth) {
if (strokeWidth != nil) {
[sink setStrokeWidth:ToInt(strokeWidth)];
}
}
Expand Down
4 changes: 2 additions & 2 deletions packages/google_maps_flutter/ios/google_maps_flutter.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ A new flutter plugin project.
s.public_header_files = 'Classes/**/*.h'
s.dependency 'Flutter'
s.dependency 'GoogleMaps'
s.compiler_flags = '-fno-modules'
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

With this change I'm able to use module imports in a Swift and Objective-C app (building with libraries and frameworks). @iskakaushik I believe that's enough to prove I didn't regress #1734?

@import GoogleMapsBase;
@import google_maps_flutter;

s.static_framework = true
s.ios.deployment_target = '8.0'
s.platform = :ios, '8.0'
s.pod_target_xcconfig = { 'DEFINES_MODULE' => 'YES', 'VALID_ARCHS[sdk=iphonesimulator*]' => 'x86_64' }
end
2 changes: 1 addition & 1 deletion packages/google_maps_flutter/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: google_maps_flutter
description: A Flutter plugin for integrating Google Maps in iOS and Android applications.
author: Flutter Team <[email protected]>
homepage: https://github.com/flutter/plugins/tree/master/packages/google_maps_flutter
version: 0.5.21+10
version: 0.5.21+11

dependencies:
flutter:
Expand Down
10 changes: 1 addition & 9 deletions script/lint_darwin_plugins.sh
Original file line number Diff line number Diff line change
Expand Up @@ -70,16 +70,8 @@ function lint_packages() {
return
fi

# TODO: These packages have linter errors. Remove plugins from this list as linter issues are fixed.
local skipped_packages=(
'google_maps_flutter'
)

local failure_count=0
for package_name in "$@"; do
if [[ "${skipped_packages[*]}" =~ "${package_name}" ]]; then
continue
fi
for package_name in "$@"; do
lint_package "${package_name}"
failure_count+="$?"
done
Expand Down