Skip to content

Commit b404b9f

Browse files
Udumft1ec5
andauthored
Switching to Online Route (#4127)
* vk-1802-1830-mm-switch: updated public API to use IndexedRouteResponse as route source; updated RoutingProvider to return correctly set up IndexedROuteResponse; Added support for switching to online route feature; added support of navigation using MapMatching response; Unit tests updated for deprecated methods; Added MapMatching requesting option to Example App. added unit tst for switching to online route. CHNAGELOG updated; updated Jazzy table of contents Co-authored-by: Minh Nguyễn <[email protected]>
1 parent 6704dfa commit b404b9f

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

48 files changed

+852
-402
lines changed

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,11 @@
88
* MapboxCoreNavigation now requires [MapboxDirections v2.8.0-alpha.1](https://github.com/mapbox/mapbox-directions-swift/releases/tag/v2.8.0-alpha.1). ([#4142](https://github.com/mapbox/mapbox-navigation-ios/pull/4142))
99
* MapboxNavigation now requires [MapboxSpeech v2._x_](https://github.com/mapbox/mapbox-speech-swift/releases/tag/v2.1.0). ([#4142](https://github.com/mapbox/mapbox-navigation-ios/pull/4142))
1010

11+
### Routing
12+
13+
* Added the `RouteController.prefersOnlineRoute` property, which lets you automatically switch from a route generated on the device to one generated by the Mapbox Directions API if the geometries match. Use `NavigationViewControllerDelegate.navigationViewController(_:didSwitchToCoincidentOnlineRoute:)`, `NavigationServiceDelegate.navigationService(_:didSwitchToCoincidentOnlineRoute:)`, `RouterDelegate.router(_:didSwitchToCoincidentOnlineRoute:)` or `.routeControllerDidSwitchToCoincidentOnlineRoute` notification to track such events. ([#4127](https://github.com/mapbox/mapbox-navigation-ios/pull/4127))
14+
* Added the `NavigationViewController(for:routeIndex:navigationOptions:)` initializer to start turn-by-turn navigation using map matching response. ([#4127](https://github.com/mapbox/mapbox-navigation-ios/pull/4127))
15+
1116
### Map
1217

1318
* `NavigationMapView.removeAlternativeRoutes()` and `NavigationMapView.removeContinuousAlternativeRoutesDurations()` were made public to provide a way to remove previously shown alternative routes and alternative routes duration annotations, respectively. ([#4134](https://github.com/mapbox/mapbox-navigation-ios/pull/4134))
@@ -19,6 +24,7 @@
1924
### Other changes
2025

2126
* Additional parameters were added to `FloatingButton.rounded(image:selectedImage:size:type:imageEdgeInsets:cornerRadius)` to be able to provide button type, button image edge insets and corner radius. ([#4060](https://github.com/mapbox/mapbox-navigation-ios/pull/4060), [#4157](https://github.com/mapbox/mapbox-navigation-ios/pull/4157))
27+
* `IndexedRouteResponse` is now the preferred way for setting up routing information for navigation. `NavigationViewController`, `MapboxNavigationService`, `Router` and `RoutingProvider` are updated to accomodate this change. ([#4127](https://github.com/mapbox/mapbox-navigation-ios/pull/4127))
2228
* `FloatingButton` no longer contains corner radius shadow, border is applied instead. ([#4060](https://github.com/mapbox/mapbox-navigation-ios/pull/4060))
2329

2430
## v2.8.0

Example/AppDelegate+CarPlay.swift

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -71,19 +71,15 @@ extension AppDelegate: CPApplicationDelegate {
7171
extension AppDelegate: CarPlayManagerDelegate {
7272

7373
func carPlayManager(_ carPlayManager: CarPlayManager,
74-
navigationServiceFor routeResponse: RouteResponse,
75-
routeIndex: Int,
76-
routeOptions: RouteOptions,
74+
navigationServiceFor indexedRouteResponse: IndexedRouteResponse,
7775
desiredSimulationMode: SimulationMode) -> NavigationService? {
7876
if let navigationViewController = self.window?.rootViewController?.presentedViewController as? NavigationViewController,
7977
let navigationService = navigationViewController.navigationService {
8078
// Do not set simulation mode if we already have an active navigation session.
8179
return navigationService
8280
}
8381

84-
return MapboxNavigationService(routeResponse: routeResponse,
85-
routeIndex: routeIndex,
86-
routeOptions: routeOptions,
82+
return MapboxNavigationService(indexedRouteResponse: indexedRouteResponse,
8783
customRoutingProvider: nil,
8884
credentials: NavigationSettings.shared.directions.credentials,
8985
simulating: desiredSimulationMode)

Example/CustomViewController.swift

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,6 @@ class CustomViewController: UIViewController {
1919
var currentLegIndex: Int = 0
2020

2121
var indexedUserRouteResponse: IndexedRouteResponse?
22-
23-
var userRouteOptions: RouteOptions?
2422

2523
var stepsViewController: StepsViewController?
2624

@@ -47,9 +45,7 @@ class CustomViewController: UIViewController {
4745
navigationMapView.userLocationStyle = .courseView()
4846

4947
let locationManager = simulateLocation ? SimulatedLocationManager(route: indexedUserRouteResponse!.routeResponse.routes!.first!) : NavigationLocationManager()
50-
navigationService = MapboxNavigationService(routeResponse: indexedUserRouteResponse!.routeResponse,
51-
routeIndex: indexedUserRouteResponse!.routeIndex,
52-
routeOptions: userRouteOptions!,
48+
navigationService = MapboxNavigationService(indexedRouteResponse: indexedUserRouteResponse!,
5349
customRoutingProvider: nil,
5450
credentials: NavigationSettings.shared.directions.credentials,
5551
locationSource: locationManager,

0 commit comments

Comments
 (0)