Skip to content

Commit b490cbb

Browse files
authored
alternative-delta-fix cherry pick (#4178)
1 parent 8fdba15 commit b490cbb

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,7 @@
7878
* Routes now respect conditional access restrictions that depend on the year. ([#4144](https://github.com/mapbox/mapbox-navigation-ios/pull/4144))
7979
* Routes now respect conditional access restrictions that apply to [all vehicles](https://wiki.openstreetmap.org/wiki/Key:vehicle). ([#4144](https://github.com/mapbox/mapbox-navigation-ios/pull/4144))
8080
* Fixed an issue where the `Intersection.outletRoadClasses` and `Intersection.outletMapboxStreetsRoadClass` properties were set to `RoadClasses.restricted` for an entrance to a rest area because of its “[local traffic only](https://wiki.openstreetmap.org/wiki/Tag:access%3Ddestination)” restriction. ([#4144](https://github.com/mapbox/mapbox-navigation-ios/pull/4144))
81+
* Fixed an issue where continuous alternative time travel delta was displayed as 0 in a callout after manually switching to an alternative route. ([#4177](https://github.com/mapbox/mapbox-navigation-ios/pull/4177))
8182

8283
### CarPlay
8384

Sources/MapboxCoreNavigation/RouteController.swift

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -281,7 +281,8 @@ open class RouteController: NSObject {
281281

282282
let encoder = JSONEncoder()
283283
encoder.userInfo[.options] = routeOptions
284-
guard let routeData = try? encoder.encode(indexedRouteResponse.routeResponse),
284+
guard let newMainRoute = indexedRouteResponse.currentRoute,
285+
let routeData = try? encoder.encode(indexedRouteResponse.routeResponse),
285286
let routeJSONString = String(data: routeData, encoding: .utf8) else {
286287
completion?(.failure(RouteControllerError.failedToSerializeRoute))
287288
return
@@ -305,7 +306,7 @@ open class RouteController: NSObject {
305306
switch result {
306307
case .success(let info):
307308
let alternativeRoutes = info.1.compactMap {
308-
AlternativeRoute(mainRoute: self.route,
309+
AlternativeRoute(mainRoute: newMainRoute,
309310
alternativeRoute: $0)
310311
}
311312
completion?(.success((info.0, alternativeRoutes)))

0 commit comments

Comments
 (0)