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

Example for refreshing a route on a preview map #75

Open
1ec5 opened this issue Sep 9, 2020 · 1 comment
Open

Example for refreshing a route on a preview map #75

1ec5 opened this issue Sep 9, 2020 · 1 comment

Comments

@1ec5
Copy link
Contributor

1ec5 commented Sep 9, 2020

If the application calculates and displays a route on a preview map, but the user leaves the preview map sitting there for over 2 minutes without starting a trip, the application should ideally refresh the route to reflect current traffic conditions. The process is straightforward but not especially discoverable, so we should add an example of it.

As far as I can tell, refreshing the route would entail:

  1. Call Directions.refreshRoute(responseIdentifier:routeIndex:fromLegAtIndex:completionHandler:) on a timer.
  2. In the completion handler, call Route.refreshLegAttributes(from:).
  3. Call NavigationMapView.show(_:legIndex:).

It’s only possible to refresh a single route at a time. We could chain the refresh calls to refresh all the routes in series, or we could refresh only the currently selected route, restarting the timer when selecting a different route.

/cc @mapbox/navigation-ios

@1ec5 1ec5 added this to the v1.0.0 milestone Sep 9, 2020
@1ec5
Copy link
Contributor Author

1ec5 commented Sep 9, 2020

On the other hand, it would be even more helpful for the application to simply rerequest the routes on a timer, which would effectively implement the proactive rerouting feature during turn-by-turn navigation. After all, the user is less committed to a particular route before having begun the trip.

@1ec5 1ec5 removed this from the v1.0.0 milestone Sep 9, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant