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

Subclasses of DirectionsOptions cannot override urlQueryItems #460

Closed
1ec5 opened this issue Sep 15, 2020 · 1 comment · Fixed by #461
Closed

Subclasses of DirectionsOptions cannot override urlQueryItems #460

1ec5 opened this issue Sep 15, 2020 · 1 comment · Fixed by #461

Comments

@1ec5
Copy link
Contributor

1ec5 commented Sep 15, 2020

#343 added an overridable DirectionsOptions.urlQueryItems property for the purpose of enabling applications to take advantage of not-yet-ready-for-primetime Directions API parameters. Unfortunately, 593efd3 for #382 made the property internal. It was probably an oversight, and I think we can safely reexpose the property. MatchOptions is unaffected; its urlQueryItems property remains open.

Until we reexpose DirectionsOptions.urlQueryItems publicly, the workaround would be to take the result of Directions.url(forCalculating:) or similar, use URLComponents to parse the URL and add more urlQueryItems, get the URL back out, request that URL using URLSession, and use JSONDecoder to decode the response as a RouteResponse – basically, everything that Directions.calculate(_:completionHandler:) normally does for you.

/cc @mapbox/navigation-ios

@1ec5
Copy link
Contributor Author

1ec5 commented Sep 15, 2020

Some of the unit tests supposedly exercise this functionality from an application point of view, but they have access to the property anyways because MapboxDirections is imported as @testable, giving the test bundle access to even fileprivate and internal symbols.

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

Successfully merging a pull request may close this issue.

1 participant