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

Conversation

jmagman
Copy link
Member

@jmagman jmagman commented Oct 11, 2019

Description

GoogleMapMarkerController.m:98:7: Converting a pointer value of type 'NSNumber *' to a primitive boolean value; instead, either compare the pointer to nil or call -boolValue
GoogleMapMarkerController.m:106:7: Converting a pointer value of type 'NSNumber *' to a primitive boolean value; instead, either compare the pointer to nil or call -boolValue
GoogleMapMarkerController.m:115:7: Converting a pointer value of type 'NSNumber *' to a primitive boolean value; instead, either compare the pointer to nil or call -boolValue
GoogleMapMarkerController.m:119:7: Converting a pointer value of type 'NSNumber *' to a primitive boolean value; instead, either compare the pointer to nil or call -boolValue
GoogleMapMarkerController.m:128:7: Converting a pointer value of type 'NSNumber *' to a primitive boolean value; instead, either compare the pointer to nil or call -boolValue
GoogleMapMarkerController.m:132:7: Converting a pointer value of type 'NSNumber *' to a primitive boolean value; instead, either compare the pointer to nil or call -boolValue
GoogleMapMarkerController.m:136:7: Converting a pointer value of type 'NSNumber *' to a primitive boolean value; instead, either compare the pointer to nil or call -boolValue
GoogleMapPolylineController.m:70:7: warning: Converting a pointer value of type 'NSNumber *' to a primitive boolean value; instead, either compare the pointer to nil or call -boolValue
  if (consumeTapEvents) {
  ~~~~^~~~~~~~~~~~~~~~~~~
GoogleMapPolylineController.m:75:7: warning: Converting a pointer value of type 'NSNumber *' to a primitive boolean value; instead, either compare the pointer to nil or call -boolValue
  if (visible) {
  ~~~~^~~~~~~~~~
GoogleMapPolylineController.m:80:7: warning: Converting a pointer value of type 'NSNumber *' to a primitive boolean value; instead, either compare the pointer to nil or call -boolValue
  if (zIndex) {
  ~~~~^~~~~~~~~
GoogleMapPolylineController.m:90:7: warning: Converting a pointer value of type 'NSNumber *' to a primitive boolean value; instead, either compare the pointer to nil or call -boolValue
  if (strokeColor) {
  ~~~~^~~~~~~~~~~~~~
GoogleMapPolylineController.m:95:7: warning: Converting a pointer value of type 'NSNumber *' to a primitive boolean value; instead, either compare the pointer to nil or call -boolValue
  if (strokeWidth) {
  ~~~~^~~~~~~~~~~~~~

GoogleMapPolygonController.m:73:7: warning: Converting a pointer value of type 'NSNumber *' to a primitive boolean value; instead, either compare the pointer to nil or call -boolValue
  if (consumeTapEvents) {
  ~~~~^~~~~~~~~~~~~~~~~~~
GoogleMapPolygonController.m:78:7: warning: Converting a pointer value of type 'NSNumber *' to a primitive boolean value; instead, either compare the pointer to nil or call -boolValue
  if (visible) {
  ~~~~^~~~~~~~~~
GoogleMapPolygonController.m:83:7: warning: Converting a pointer value of type 'NSNumber *' to a primitive boolean value; instead, either compare the pointer to nil or call -boolValue
  if (zIndex) {
  ~~~~^~~~~~~~~
GoogleMapPolygonController.m:93:7: warning: Converting a pointer value of type 'NSNumber *' to a primitive boolean value; instead, either compare the pointer to nil or call -boolValue
  if (fillColor) {
  ~~~~^~~~~~~~~~~~
GoogleMapPolygonController.m:98:7: warning: Converting a pointer value of type 'NSNumber *' to a primitive boolean value; instead, either compare the pointer to nil or call -boolValue
  if (strokeColor) {
  ~~~~^~~~~~~~~~~~~~
GoogleMapPolygonController.m:103:7: warning: Converting a pointer value of type 'NSNumber *' to a primitive boolean value; instead, either compare the pointer to nil or call -boolValue
  if (strokeWidth) {
  ~~~~^~~~~~~~~~~~~~
GoogleMapCircleController.m:76:7: warning: Converting a pointer value of type 'NSNumber *' to a primitive boolean value; instead, either compare the pointer to nil or call -boolValue
  if (consumeTapEvents) {
  ~~~~^~~~~~~~~~~~~~~~~~~
GoogleMapCircleController.m:81:7: warning: Converting a pointer value of type 'NSNumber *' to a primitive boolean value; instead, either compare the pointer to nil or call -boolValue
  if (visible) {
  ~~~~^~~~~~~~~~
GoogleMapCircleController.m:86:7: warning: Converting a pointer value of type 'NSNumber *' to a primitive boolean value; instead, either compare the pointer to nil or call -boolValue
  if (zIndex) {
  ~~~~^~~~~~~~~
GoogleMapCircleController.m:96:7: warning: Converting a pointer value of type 'NSNumber *' to a primitive boolean value; instead, either compare the pointer to nil or call -boolValue
  if (radius) {
  ~~~~^~~~~~~~~
GoogleMapCircleController.m:101:7: warning: Converting a pointer value of type 'NSNumber *' to a primitive boolean value; instead, either compare the pointer to nil or call -boolValue
  if (strokeColor) {
  ~~~~^~~~~~~~~~~~~~
GoogleMapCircleController.m:106:7: warning: Converting a pointer value of type 'NSNumber *' to a primitive boolean value; instead, either compare the pointer to nil or call -boolValue
  if (strokeWidth) {
  ~~~~^~~~~~~~~~~~~~
GoogleMapCircleController.m:111:7: warning: Converting a pointer value of type 'NSNumber *' to a primitive boolean value; instead, either compare the pointer to nil or call -boolValue
  if (fillColor) {
  ~~~~^~~~~~~~~~~~
GoogleMapController.m:69:5: warning: Instance variable used while 'self' is not set to the result of '[(super or self) init...]'
    _viewId = viewId;
    ^~~~~~~
GoogleMapController.m:118:3: warning: Returning 'self' while it is not set to the result of '[(super or self) init...]'
  return self;
  ^~~~~~~~~~~
GoogleMapController.m:546:7: warning: Converting a pointer value of type 'NSNumber *' to a primitive boolean value; instead, either compare the pointer to nil or call -boolValue
  if (compassEnabled) {
  ~~~~^~~~~~~~~~~~~~~~~
GoogleMapController.m:577:7: warning: Converting a pointer value of type 'NSNumber *' to a primitive boolean value; instead, either compare the pointer to nil or call -boolValue
  if (rotateGesturesEnabled) {
  ~~~~^~~~~~~~~~~~~~~~~~~~~~~~
GoogleMapController.m:581:7: warning: Converting a pointer value of type 'NSNumber *' to a primitive boolean value; instead, either compare the pointer to nil or call -boolValue
  if (scrollGesturesEnabled) {
  ~~~~^~~~~~~~~~~~~~~~~~~~~~~~
GoogleMapController.m:585:7: warning: Converting a pointer value of type 'NSNumber *' to a primitive boolean value; instead, either compare the pointer to nil or call -boolValue
  if (tiltGesturesEnabled) {
  ~~~~^~~~~~~~~~~~~~~~~~~~~~
GoogleMapController.m:589:7: warning: Converting a pointer value of type 'NSNumber *' to a primitive boolean value; instead, either compare the pointer to nil or call -boolValue
  if (trackCameraPosition) {
  ~~~~^~~~~~~~~~~~~~~~~~~~~~
GoogleMapController.m:593:7: warning: Converting a pointer value of type 'NSNumber *' to a primitive boolean value; instead, either compare the pointer to nil or call -boolValue
  if (zoomGesturesEnabled) {
  ~~~~^~~~~~~~~~~~~~~~~~~~~~
GoogleMapController.m:597:7: warning: Converting a pointer value of type 'NSNumber *' to a primitive boolean value; instead, either compare the pointer to nil or call -boolValue
  if (myLocationEnabled) {
  ~~~~^~~~~~~~~~~~~~~~~~~~
GoogleMapController.m:601:7: warning: Converting a pointer value of type 'NSNumber *' to a primitive boolean value; instead, either compare the pointer to nil or call -boolValue
  if (myLocationButtonEnabled) {
  ~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~

Related Issues

See flutter/flutter#41007.
Might fix flutter/flutter#34042 (though I can't reproduce it)

Tests

  • Remove google_maps_flutter from the list of packages to skip when linting the podspec. This will at minimum make sure google_maps_flutter can be imported into a project without compilation errors.

Checklist

  • I read the [Contributor Guide] and followed the process outlined there for submitting PRs.
  • My PR includes unit or integration tests for all changed/updated/fixed behaviors (See [Contributor Guide]).
  • All existing and new tests are passing.
  • I updated/added relevant documentation (doc comments with ///).
  • The analyzer (flutter analyze) does not report any problems on my PR.
  • I read and followed the [Flutter Style Guide].
  • The title of the PR starts with the name of the plugin surrounded by square brackets, e.g. [shared_preferences]
  • I updated pubspec.yaml with an appropriate new version according to the [pub versioning philosophy].
  • I updated CHANGELOG.md to add a description of the change.
  • I signed the [CLA].
  • I am willing to follow-up on review comments in a timely manner.

Breaking Change

  • Yes, this is a breaking change (please indicate a breaking change in CHANGELOG.md and increment major revision).
  • No, this is not a breaking change.

@@ -9,9 +9,11 @@
#import "GoogleMapPolygonController.h"
#import "GoogleMapPolylineController.h"

NS_ASSUME_NONNULL_BEGIN
Copy link
Member Author

@jmagman jmagman Oct 11, 2019

Choose a reason for hiding this comment

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

The id _Nullable below had opted this entire header into nullability, but it wasn't specified anywhere, which caused the analyzer warnings.

Ideally all headers would declare nullability, but I wanted to limit the scope of this change.

@@ -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.

😬

@@ -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;

Copy link
Contributor

@cyanglaz cyanglaz left a comment

Choose a reason for hiding this comment

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

LGTM!
@iskakaushik might want to chime in for the comment about using module imports.

Copy link
Contributor

@iskakaushik iskakaushik left a comment

Choose a reason for hiding this comment

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

LGTM

@jmagman jmagman merged commit 56e46ac into flutter:master Nov 13, 2019
@jmagman jmagman deleted the module-gmf branch November 13, 2019 21:06
mormih pushed a commit to mormih/plugins that referenced this pull request Nov 17, 2019
hjc22 pushed a commit to hjc22/plugins that referenced this pull request Dec 13, 2019
* newCache/blackVideos: (105 commits)
  [connectivity] Fix reachability stream for iOS (flutter#2281)
  [google_sign_in] Port plugin to use the federated Platform Interface (flutter#2266)
  [webview_flutter] Add async NavigationDelegates (flutter#2257)
  Update cirrus to create IOS simulator on 13.2 an xCode 11 (flutter#2275)
  [battery] Update and migrate iOS example project (flutter#2089)
  [url_launcher] DartDoc and test improvements (flutter#2274)
  [google_maps_flutter] Define clang module for iOS, fix analyzer warnings (flutter#2182)
  [video_player] Add v2 embedding support (flutter#2226)
  [path_provider] Update and migrate iOS example project (flutter#2099)
  [sensors] Documentation and test improvements (flutter#2272)
  [image_picker] Lint for public DartDocs (flutter#2270)
  [connectivity] Lint for public DartDocs (flutter#2269)
  [shared_preferences] Update and migrate iOS example project (flutter#2103)
  [quick_actions] Update and migrate iOS example project (flutter#2100)
  [infra] Ignore analyzer issues in CI (flutter#2271)
  [android_intent] Add missing DartDocs (flutter#2268)
  Bump google_maps_flutter pubspec to match CHANGELOG (flutter#2267)
  [google_sign_in] Handle new style URLs in GoogleUserCircleAvatar (flutter#2252)
  [google_sign_in] Move plugin to its subdir to allow for federated implementations. Add platform interface. (flutter#2244)
  Make setMockInitialValues handle non-prefixed keys (flutter#2260)
  ...

# Conflicts:
#	packages/video_player/CHANGELOG.md
#	packages/video_player/android/src/main/java/io/flutter/plugins/videoplayer/VideoPlayerPlugin.java
#	packages/video_player/ios/video_player.podspec
#	packages/video_player/pubspec.yaml
#	packages/video_player/test/video_player_test.dart
sungmin-park pushed a commit to sungmin-park/flutter-plugins that referenced this pull request Dec 17, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Map plugin iOS example does not build
4 participants