Skip to content

[google_maps_flutter] Implement polyline patterns in google maps ios#5757

Merged
auto-submit[bot] merged 48 commits intoflutter:mainfrom
Hari-07:polyline-pattern-ios
May 28, 2024
Merged

[google_maps_flutter] Implement polyline patterns in google maps ios#5757
auto-submit[bot] merged 48 commits intoflutter:mainfrom
Hari-07:polyline-pattern-ios

Conversation

@Hari-07
Copy link
Contributor

@Hari-07 Hari-07 commented Dec 26, 2023

This PR Implements patterns in google maps ios polylines. Currently the patterns param is simply ignored on ios, despite the official google maps SDK for ios having instructions on how to achieve repeated patterns: https://developers.google.com/maps/documentation/ios-sdk/shapes#add-a-repeating-color-pattern-to-a-polyline

List which issues are fixed by this PR. You must list at least one issue.
flutter/flutter#60083

If you had to change anything in the flutter/tests repo, include a link to the migration guide as per the breaking change policy.
Nil

Pre-launch Checklist

  • I read the Contributor Guide and followed the process outlined there for submitting PRs.
  • I read the Tree Hygiene wiki page, which explains my responsibilities.
  • I read and followed the relevant style guides and ran the auto-formatter. (Unlike the flutter/flutter repo, the flutter/packages repo does use dart format.)
  • I signed the CLA.
  • The title of the PR starts with the name of the package surrounded by square brackets, e.g. [shared_preferences]
  • I listed at least one issue that this PR fixes in the description above.
  • I updated pubspec.yaml with an appropriate new version according to the pub versioning philosophy, or this PR is exempt from version changes.
  • I updated CHANGELOG.md to add a description of the change, following repository CHANGELOG style.
  • I updated/added relevant documentation (doc comments with ///).
  • I added new tests to check the change I am making, or this PR is test-exempt.
  • All existing and new tests are passing.

If you need help, consider asking for advice on the #hackers-new channel on Discord.

@flutter-dashboard
Copy link

It looks like this pull request may not have tests. Please make sure to add tests before merging. If you need an exemption to this rule, contact "@test-exemption-reviewer" in the #hackers channel in Chat (don't just cc them here, they won't see it! Use Discord!).

If you are not sure if you need tests, consider this rule of thumb: the purpose of a test is to make sure someone doesn't accidentally revert the fix. Ask yourself, is there anything in your PR that you feel it is important we not accidentally revert back to how it was before your fix?

Reviewers: Read the Tree Hygiene page and make sure this patch meets those guidelines before LGTMing.

@Hari-07
Copy link
Contributor Author

Hari-07 commented Dec 26, 2023

I don't currently have any tests, however that is because looking at the existing tests, since I only made changes to the ios package, it didn't seem right to author tests in the google_maps_flutter package.

But looking at tests in google_maps_flutter_ios it seemed like they do not test things like what this PR covers

Open to authoring tests, if someone could let me know what the tests should test

@Hari-07 Hari-07 force-pushed the polyline-pattern-ios branch from 8334dd1 to 348b17f Compare December 26, 2023 09:40
@stuartmorgan-g
Copy link
Collaborator

Marking as a draft for now since this needs native unit tests before it will be ready for review (per discussion in Discord).

@stuartmorgan-g stuartmorgan-g marked this pull request as draft January 2, 2024 14:32
@Hari-07
Copy link
Contributor Author

Hari-07 commented Jan 4, 2024

I implemented tests for 2 out of 3 functions I wrote. For the 3rd function, the test should look something like

- (void)testStrokeStylesFromPatterns {
    NSArray* patterns = @ [@[@"gap", @10], @[@"dash", @10]];
    UIColor* strokeColor = [UIColor redColor];
    
    NSArray<GMSStrokeStyle*> *patternStrokeStyle = [FLTGoogleMapJSONConversions strokeStylesFromPatterns:patterns strokeColor:strokeColor];
    
    XCTAssertEqual([patternStrokeStyle count], 2);
    
    GMSStrokeStyle* firstStrokeStyle = patternStrokeStyle[0];
    GMSStrokeStyle* secondStrokeStyle = patternStrokeStyle[1];
    
    // XCTAssertEqualObjects(firstStrokeStyle, [GMSStrokeStyle solidColor:[UIColor clearColor]]);
    // XCTAssertEqualObjects(secondStrokeStyle, [GMSStrokeStyle solidColor:strokeColor]);
}

However, the color property is not readable so I couldn't get this to work.

@stuartmorgan-g
Copy link
Collaborator

@Hari-07 Is this ready for review again?

@Hari-07
Copy link
Contributor Author

Hari-07 commented May 25, 2024

I've updated for all your comments other than this thread. Have left a comment on that too.

Apologies about the delay

@Hari-07
Copy link
Contributor Author

Hari-07 commented May 25, 2024

One of the test failure is that the new _Test header isn't in the umbrella header. Do we need to put test headers into it tho?

@stuartmorgan-g
Copy link
Collaborator

One of the test failure is that the new _Test header isn't in the umbrella header. Do we need to put test headers into it tho?

Yes, unfortunately the way our builds are structured we have to make the test headers public currently. (Longer term, moving to Swift will resolve this problem.)

Copy link
Collaborator

@stuartmorgan-g stuartmorgan-g left a comment

Choose a reason for hiding this comment

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

Just minor nits, other than that, LGTM once it passes CI!

@Hari-07
Copy link
Contributor Author

Hari-07 commented May 28, 2024

@stuartmorgan Thank you so much for the detailed reviews, and the back and forth. This was a long one. I didn't have prior experience with Obj-C and was figuring it out as we went hence the many beginner mistakes.

Have fixed your latest round of suggestions as well, the only CI failure is its expecting a changelog change in google_maps_flutter but as per this conversation that's not required.

Hope this can get merged in soon 🙏

@stuartmorgan-g
Copy link
Collaborator

CHANGELOG override: updating non-main examples to not check for iOS in other packages doesn't warrant client-facing commenting.

Copy link
Collaborator

@stuartmorgan-g stuartmorgan-g left a comment

Choose a reason for hiding this comment

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

LGTM, thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

autosubmit Merge PR when tree becomes green via auto submit App override: no changelog needed Override the check requiring CHANGELOG updates for most changes p: google_maps_flutter platform-android platform-ios

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants