From fc5789717eaef22436d6cfc03d2457cdc5c9542d Mon Sep 17 00:00:00 2001 From: Nastassia Makaranka Date: Thu, 17 Oct 2024 17:02:42 +0200 Subject: [PATCH] Fix the rawLocation used for the user puck (#7021) --- CHANGELOG.md | 4 ++++ Examples/CoreSDKExample/Navigation.swift | 5 +++-- .../CarPlay/CarPlayMapViewController.swift | 2 +- .../CarPlay/CarPlayNavigationViewController.swift | 4 ++-- 4 files changed, 10 insertions(+), 5 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 45cd4b84f8f..03f9bce7c7e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -13,6 +13,10 @@ * Fixed a possible case when `.relativeDurationsOnAlternativeManuever` annotations can be visible even if they were hidden previously. * Added the support for specifying the custom route line layer position for map styles without slots support by `NavigationMapView.customRouteLineLayerPosition`. +### Location + +* Fixed the case when a raw, non-map-matched location was used in CarPlay. + ### Other changes * `NavigationViewController` transitions navigation to the `idle` state when it is dismissed. diff --git a/Examples/CoreSDKExample/Navigation.swift b/Examples/CoreSDKExample/Navigation.swift index 70adc3889e1..7d558f24c71 100644 --- a/Examples/CoreSDKExample/Navigation.swift +++ b/Examples/CoreSDKExample/Navigation.swift @@ -22,7 +22,8 @@ final class Navigation: ObservableObject { init() { let config = CoreConfig( - credentials: .init() // You can pass a custom token if you need to + credentials: .init(), // You can pass a custom token if you need to, + locationSource: .live ) let navigationProvider = MapboxNavigationProvider(coreConfig: config) self.core = navigationProvider.mapboxNavigation @@ -54,7 +55,7 @@ final class Navigation: ObservableObject { .assign(to: &$activeNavigationRoutes) core.navigation().locationMatching - .map { $0.location } + .map { $0.enhancedLocation } .assign(to: &$currentLocation) } diff --git a/Sources/MapboxNavigationUIKit/CarPlay/CarPlayMapViewController.swift b/Sources/MapboxNavigationUIKit/CarPlay/CarPlayMapViewController.swift index 59cf539973e..427d769b572 100644 --- a/Sources/MapboxNavigationUIKit/CarPlay/CarPlayMapViewController.swift +++ b/Sources/MapboxNavigationUIKit/CarPlay/CarPlayMapViewController.swift @@ -286,7 +286,7 @@ open class CarPlayMapViewController: UIViewController { speedLimitView.signStandard = state.speedLimit.signStandard speedLimitView.speedLimit = state.speedLimit.value - speedLimitView.currentSpeed = state.location.speed + speedLimitView.currentSpeed = state.enhancedLocation.speed } if let wayNameView { diff --git a/Sources/MapboxNavigationUIKit/CarPlay/CarPlayNavigationViewController.swift b/Sources/MapboxNavigationUIKit/CarPlay/CarPlayNavigationViewController.swift index e29b94d4ee0..e912c7fcd45 100644 --- a/Sources/MapboxNavigationUIKit/CarPlay/CarPlayNavigationViewController.swift +++ b/Sources/MapboxNavigationUIKit/CarPlay/CarPlayNavigationViewController.swift @@ -705,7 +705,7 @@ open class CarPlayNavigationViewController: UIViewController { func progressDidChange(_ routeProgress: RouteProgress?) { guard let routeProgress, - let location = core.navigation().currentLocationMatching?.location + let location = core.navigation().currentLocationMatching?.enhancedLocation else { return } @@ -1015,7 +1015,7 @@ open class CarPlayNavigationViewController: UIViewController { extension CarPlayNavigationViewController: StyleManagerDelegate { public func location(for styleManager: StyleManager) -> CLLocation? { - if let location = core.navigation().currentLocationMatching?.location { + if let location = core.navigation().currentLocationMatching?.enhancedLocation { return location } else { return nil