Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[google_maps_flutter_android] Add PlatformCap pigeon type. #7639

Open
wants to merge 10 commits into
base: main
Choose a base branch
from

Conversation

yaakovschectman
Copy link
Contributor

@yaakovschectman yaakovschectman commented Sep 12, 2024

Replace old JSON implementation of polyline start/end cap with a structured Pigeon.

flutter/flutter#154737

Pre-launch Checklist

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

@yaakovschectman yaakovschectman requested a review from a team September 12, 2024 18:49
@yaakovschectman yaakovschectman marked this pull request as ready for review September 12, 2024 18:50
/// Converts platform interface's Cap to Pigeon's PlatformCap.
@visibleForTesting
PlatformCap platformCapFromCap(Cap cap) {
final List<Object> json = cap.toJson() as List<Object>;
Copy link
Contributor

Choose a reason for hiding this comment

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

My comment here applies to this as well (as does Reid's comment about needing to document the source of what's being interpreted).

It would be fine to use a single issue to cover both, since it's basically the same issue, and we could fix both at once pretty easily.

PlatformCap({required this.type, this.bitmapDescriptor, this.refWidth});

final PlatformCapType type;
final Object? bitmapDescriptor;
Copy link
Contributor

Choose a reason for hiding this comment

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

This needs a version of the same comment that you removed for startCap/endCap, and a tracking issue. (It looks like this will be another annoying one like CameraUpdate.)

@@ -2102,6 +2110,124 @@ ArrayList<Object> toList() {
}
}

/**
* Pigeon equivalent of the Cap class.
Copy link
Contributor

Choose a reason for hiding this comment

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

Instead of saying "the Cap class" consider linking to the source of that class.

I believe this is the correct class. https://developers.google.com/maps/documentation/android-sdk/reference/com/google/android/libraries/maps/model/Cap

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Should this link to google map's SDK's Cap? I would have thought a link to the platform interface's Cap would be more appropriate, but do you disagree?

Copy link
Contributor

@reidbaker reidbaker Sep 13, 2024

Choose a reason for hiding this comment

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

I think the fact that you and I were thinking of different classes is a great explanation of why "the cap class" is not the right level of documentation.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I've linked here to the platform interface Cap, and from a couple other comments in this PR to the Maps SDK's Cap. Let me know if you agree with my choice of links.

PlatformJointType jointType;

/// The pattern data, as JSON. Each element in this list should be set only from PatternItem.toJson, and the native code must interpret it according to the internal implementation details of that method.
List<Object?> patterns;

List<PlatformLatLng?> points;

/// The start and end cap data, as JSON. These should be set only from Cap.toJson, and the native code must interpret it according to the internal implementation details of that method.
Object startCap;
/// The start and end cap data.
Copy link
Contributor

Choose a reason for hiding this comment

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

Link to documentation so that someone can better understand these values.

@@ -1166,6 +1166,37 @@ PlatformJointType platformJointTypeFromJointType(JointType jointType) {
return PlatformJointType.mitered;
}

/// Converts platform interface's Cap to Pigeon's PlatformCap.
Copy link
Contributor

Choose a reason for hiding this comment

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

No action required: You are following the pattern of the rest of this file but both this method name and documentation do not help me understand what is being converted here or how to learn about either the to or from object.

final bool visible;
final int width;
final int zIndex;
}

/// Enumeration of possible types of Cap.
Copy link
Contributor

Choose a reason for hiding this comment

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

Link to cap documentation.

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

Successfully merging this pull request may close these issues.

3 participants