diff --git a/CHANGELOG.md b/CHANGELOG.md index d13f45e1427..683dd7afcb9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,11 @@ # Changes to the Mapbox Navigation SDK for iOS +## main + +### Routing + +* `NavigationRouteOptions` and `NavigationMatchOptions` no longer include `.numericCongestionLevel` attribute by default for profiles other than `.automobileAvoidingTraffic`. + ## v2.17.0 ### Packaging diff --git a/Sources/MapboxCoreNavigation/NavigationRouteOptions.swift b/Sources/MapboxCoreNavigation/NavigationRouteOptions.swift index 4fc6387a632..77d5641317d 100644 --- a/Sources/MapboxCoreNavigation/NavigationRouteOptions.swift +++ b/Sources/MapboxCoreNavigation/NavigationRouteOptions.swift @@ -26,10 +26,7 @@ open class NavigationRouteOptions: RouteOptions, OptimizedForNavigation { queryItems: queryItems) includesAlternativeRoutes = true attributeOptions = [.expectedTravelTime, .maximumSpeedLimit] - if profileIdentifier == .cycling { - // https://github.com/mapbox/mapbox-navigation-ios/issues/3495 - attributeOptions.update(with: .congestionLevel) - } else { + if profileIdentifier == .automobileAvoidingTraffic { attributeOptions.update(with: .numericCongestionLevel) } includesExitRoundaboutManeuver = true @@ -91,7 +88,10 @@ open class NavigationMatchOptions: MatchOptions, OptimizedForNavigation { }, profileIdentifier: profileIdentifier, queryItems: queryItems) - attributeOptions = [.numericCongestionLevel, .expectedTravelTime] + attributeOptions = [.expectedTravelTime] + if profileIdentifier == .automobileAvoidingTraffic { + attributeOptions.update(with: .numericCongestionLevel) + } if profileIdentifier == .automobile || profileIdentifier == .automobileAvoidingTraffic { attributeOptions.insert(.maximumSpeedLimit) } diff --git a/Tests/MapboxCoreNavigationTests/OptionsTests.swift b/Tests/MapboxCoreNavigationTests/OptionsTests.swift index cf346e639bd..31b2c2bef46 100644 --- a/Tests/MapboxCoreNavigationTests/OptionsTests.swift +++ b/Tests/MapboxCoreNavigationTests/OptionsTests.swift @@ -30,15 +30,15 @@ class OptionsTests: TestCase { XCTAssertEqual(NavigationRouteOptions(coordinates: coordinates).attributeOptions, [.numericCongestionLevel, .expectedTravelTime, .maximumSpeedLimit]) XCTAssertEqual(NavigationRouteOptions(coordinates: coordinates, profileIdentifier: .automobile).attributeOptions, - [.numericCongestionLevel, .expectedTravelTime, .maximumSpeedLimit]) + [.expectedTravelTime, .maximumSpeedLimit]) XCTAssertEqual(NavigationRouteOptions(coordinates: coordinates, profileIdentifier: .automobileAvoidingTraffic).attributeOptions, [.numericCongestionLevel, .expectedTravelTime, .maximumSpeedLimit]) // https://github.com/mapbox/mapbox-navigation-ios/issues/3495 XCTAssertEqual(NavigationRouteOptions(coordinates: coordinates, profileIdentifier: .cycling).attributeOptions, - [.congestionLevel, .expectedTravelTime, .maximumSpeedLimit]) + [.expectedTravelTime, .maximumSpeedLimit]) XCTAssertEqual(NavigationRouteOptions(coordinates: coordinates, profileIdentifier: .walking).attributeOptions, - [.numericCongestionLevel, .expectedTravelTime, .maximumSpeedLimit]) + [.expectedTravelTime, .maximumSpeedLimit]) XCTAssertEqual(NavigationRouteOptions(coordinates: coordinates, profileIdentifier: .init(rawValue: "mapbox/unicycling")).attributeOptions, - [.numericCongestionLevel, .expectedTravelTime, .maximumSpeedLimit]) + [.expectedTravelTime, .maximumSpeedLimit]) } }