-
Notifications
You must be signed in to change notification settings - Fork 92
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
Waypoint targets #326
Waypoint targets #326
Conversation
78dbc84
to
6eabc78
Compare
@@ -328,7 +328,7 @@ open class DirectionsOptions: NSObject, NSSecureCoding, NSCopying { | |||
An array of directions query strings to include in the request URL. | |||
*/ | |||
internal var queries: [String] { | |||
return waypoints.compactMap { return "\($0.coordinate.longitude.rounded(to: 1e6)),\($0.coordinate.latitude.rounded(to: 1e6))" } | |||
return waypoints.compactMap{ $0.coordinate.stringForRequestURL } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note the following edge case: if the developer specifies three waypoints and one of them is invalid, this library previously sent a request with all three waypoints, all but guaranteeing an error in the response. Now it sends only two of the waypoints, which may return a valid response (ignoring the invalid coordinate). However, if the invalid waypoint had the name
or targetCoordinate
property set, then there would be a mismatch between the path and query parameters in the request URL, resulting in a different error than before in the response.
6eabc78
to
3257d18
Compare
Added the Waypoint.targetCoordinate property corresponding to the Directions API’s waypoint_targets property. Added unit tests of copying and coding waypoints, as well as specifying waypoint_targets and other waypoint properties in conjunction with a RouteOptions object. Added documentation associating some properties with their API counterparts for discoverability.
3257d18
to
6a2a707
Compare
Tests were failing because of a broken file reference; fixed in 6a2a707. |
Added the
Waypoint.targetCoordinate
property corresponding to the Directions API’swaypoint_targets
property, which specifies a more specific destination location for arrival instructions.Fixed an issue where the
Waypoint.allowsArrivingOnOppositeSide
property was not copied when copying aWaypoint
object. Added unit tests of copying and coding waypoints, as well as specifyingtargetCoordinate
and other waypoint properties in conjunction with a RouteOptions object.Added documentation associating some properties with their API counterparts for discoverability.
/cc @mapbox/navigation-ios @danesfeder @danpaz