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

DirectionsProfile for reroutes in NavigationView #575

Merged
merged 2 commits into from
Dec 8, 2017

Conversation

danesfeder
Copy link
Contributor

  • Add directions profile to navigation view options for reroute scenarios
  • If no profile is provided, and the UI was launched with a DirectionsRoute the default for reroutes will be the profile from the route used to launch the UI
  • If no profile is provided, and the UI was launched with Position coordinates, the default will be DirectionsCriteria.PROFILE_DRIVING_TRAFFIC

cc @ericrwolfe

@@ -157,6 +159,8 @@ private boolean launchWithRoute(NavigationViewOptions options) {
private void extractRoute(NavigationViewOptions options) {
DirectionsRoute route = options.directionsRoute();
if (route != null) {
String profile = options.directionsProfile();
routeProfile = profile != null ? profile : route.routeOptions().profile();
Copy link

Choose a reason for hiding this comment

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

Several checks are already in place to ensure this is never null including the MAS Directions builder and the server response itself. I've opened mapbox/mapbox-java#683 to change the annotation for this to a NonNull

Copy link
Contributor Author

@danesfeder danesfeder Dec 8, 2017

Choose a reason for hiding this comment

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

@cammace awesome, thanks for the heads up on this. The options.directionsProfile() is actually the nullable profile from the NavigationViewOptions. If it's null, we fall back to the RouteOptions profile used from the original DirectionsRoute passed in at initialization of the drop-in UI.

Choose a reason for hiding this comment

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

Hey, it is posible to pass Locale when reroute? seems to be the answer for issue #633

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@darkwizzard PR is waiting for review #635

@danesfeder danesfeder merged commit 03ddd2c into master Dec 8, 2017
@danesfeder danesfeder deleted the dan-profile-options branch December 8, 2017 21:16
@danesfeder danesfeder mentioned this pull request Dec 20, 2017
15 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature New feature request.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants