mapbox / mapbox/mapbox-navigation-ios-examples

Example for refreshing a route on a preview map

Open
#75 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

new example
Dominant language
Swift
Stars
63
Forks
32
Avg merge
5m
Merged PRs (30d)
1

Description

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

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the preview-map example and the listed Directions.refreshRoute, Route.refreshLegAttributes, and NavigationMapView.show entry points. Decide whether the example refreshes only the selected route or chains all routes, then demonstrate refreshing after two minutes of inactivity and verify that the displayed route reflects the refreshed data.

Written by the indexing model from the issue text.

Assessment

Tech stack
swift
Domain
documentation, mobile
Issue type
Documentation
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.