Skip to content

Commit

Permalink
Upgrade to MapboxMaps v10.4.0-rc.1, MapboxNavigationNative `v92.0.0…
Browse files Browse the repository at this point in the history
…`. (#3765)

* Update to Mapbox Maps `v10.4.0-beta.1`.

* Update changelog.

* Update to Mapbox Navigation Native `v90.0.0`.

* Update `CocoaPodsTest` target to the latest dependencies.

* Fix failing tests.

* MapboxCommon v21.2.0, Polyline v5.0.3

* Added railroad crossing road objects

* Suppressed unused variable warning

* Updated changelog

* Migrated Navigator from Routes to NavigationRoutes

* Update Maps SDK to `v10.4.0-rc.1` and Navigation Native to `v92.0.0`.

* Update `Package.resolved`.

* Fix compilation issues in `RouteController.swift`.

* Update to Mapbox Common `v21.2.0-rc.1`.

* applied new NN route parsing stage for setting a route using RouteInterface; fixed route refreshing in MapboxRoutingProvider by applying updated annotations to the original route.

* RoutesCoordinator unit tests updated

* fixed keeping unneccessary RouteController retained

* removed explicit main thread forcing for set routes callbacks

* Updated changelog

* removed parsing route in background thread

* limited NN log level to 'info'

* Bumped Directions to 2.4.0.-beta.1

* Depend on exact pre-release version of Directions

* Disable testPuck3DLayerPosition

* Update CHANGELOG about version of Directions

* Update testLatestDescriptorsAreFromGlobalNavigatorCacheHandle

Co-authored-by: Minh Nguyễn <[email protected]>
Co-authored-by: udumft <[email protected]>
Co-authored-by: Nikolay Volosatov <[email protected]>
  • Loading branch information
4 people authored Mar 18, 2022
1 parent 9e42a85 commit f8198e3
Show file tree
Hide file tree
Showing 21 changed files with 231 additions and 140 deletions.
24 changes: 24 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,30 @@

## v2.4.0

### Packaging

* MapboxNavigation now requires [MapboxMaps v10.4.0-rc.1](https://github.com/mapbox/mapbox-maps-ios/releases/tag/v10.4.0-rc.1). ([#3765](https://github.com/mapbox/mapbox-navigation-ios/pull/3765))
* MapboxCoreNavigation now requires [MapboxNavigationNative v92._x_](https://github.com/mapbox/mapbox-navigation-native-ios/releases/tag/92.0.0). ([#3765](https://github.com/mapbox/mapbox-navigation-ios/pull/3765))
* MapboxCoreNavigation now requires [MapboxDirections v2.4.0-beta.1](https://github.com/mapbox/mapbox-directions-swift/releases/tag/v2.4.0-beta.1). ([#3765](https://github.com/mapbox/mapbox-navigation-ios/pull/3765))

### Location tracking

* Added the `RoadObject.Kind.railroadCrossing` enumeration case to represent a railroad crossing along the route. ([#3765](https://github.com/mapbox/mapbox-navigation-ios/pull/3765))
* Throttled requests to the Mapbox Directions API while the user moves around in a parking lot that has not been mapped in detail. ([#3765](https://github.com/mapbox/mapbox-navigation-ios/pull/3765))
* If the user backtracks from the beginning of one leg of the route to the end of the previous leg, the user is no longer considered to be off-route; instead, `RouteProgress.currentLegProgress` decrements and other properties follow suit. ([#3765](https://github.com/mapbox/mapbox-navigation-ios/pull/3765))
* Fixed a crash starting turn-by-turn navigation on some routes that included bridges and restricted-access roads. ([#3765](https://github.com/mapbox/mapbox-navigation-ios/pull/3765))

### Offline routing

* In [bilingual and multilingual areas](https://wiki.openstreetmap.org/wiki/Multilingual_names), spoken and visual instructions include street names and destinations in the user’s preferred language when that language is signposted. ([#3765](https://github.com/mapbox/mapbox-navigation-ios/pull/3765))
* Fixed `Intersection.outletIndex` values that were off by one. ([#3765](https://github.com/mapbox/mapbox-navigation-ios/pull/3765))
* High-occupancy vehicle roads in OpenStreetMap that lack a [`hov:minimum`](https://wiki.openstreetmap.org/wiki/Key:hov:minimum) tag are now assumed to be HOV&nbsp;2+ roads, requiring one or more passengers. ([#3765](https://github.com/mapbox/mapbox-navigation-ios/pull/3765))
* Decreased memory usage when starting turn-by-turn navigation along a long-distance route. ([#3765](https://github.com/mapbox/mapbox-navigation-ios/pull/3765))
* Fixed an issue where street names in spoken instructions could be go unpronounced if tagged with a [pronunciation](https://wiki.openstreetmap.org/wiki/Key:name:pronunciation). ([#3765](https://github.com/mapbox/mapbox-navigation-ios/pull/3765))
* Added support for [the workaround](https://github.com/mapbox/mapbox-directions-swift/issues/662) for requesting a route that avoids an arbitrary set of coordinates. ([#3765](https://github.com/mapbox/mapbox-navigation-ios/pull/3765))

* MapboxNavigationNative now sends messages to the Unified Logging subsystem `com.mapbox` for easier filtering. ([#3765](https://github.com/mapbox/mapbox-navigation-ios/pull/3765))

### User interface

* `FeedbackViewController` now supports changing styles based on `StyleManager`. ([#3764](https://github.com/mapbox/mapbox-navigation-ios/pull/3764))
Expand Down
6 changes: 3 additions & 3 deletions Cartfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
binary "https://api.mapbox.com/downloads/v2/carthage/mapbox-common/MapboxCommon.json" ~> 21.1.0
binary "https://api.mapbox.com/downloads/v2/carthage/mobile-navigation-native/MapboxNavigationNative.xcframework.json" ~> 88.0
github "mapbox/mapbox-directions-swift" ~> 2.3
binary "https://api.mapbox.com/downloads/v2/carthage/mapbox-common/MapboxCommon.json" == 21.2.0-rc.1
binary "https://api.mapbox.com/downloads/v2/carthage/mobile-navigation-native/MapboxNavigationNative.xcframework.json" ~> 92.0
github "mapbox/mapbox-directions-swift" == 2.4.0-beta.1
github "mapbox/mapbox-events-ios" ~> 1.0.0
8 changes: 4 additions & 4 deletions Cartfile.resolved
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
binary "https://api.mapbox.com/downloads/v2/carthage/mapbox-common/MapboxCommon.json" "21.1.1"
binary "https://api.mapbox.com/downloads/v2/carthage/mobile-navigation-native/MapboxNavigationNative.xcframework.json" "88.0.0"
binary "https://api.mapbox.com/downloads/v2/carthage/mapbox-common/MapboxCommon.json" "21.2.0-rc.1"
binary "https://api.mapbox.com/downloads/v2/carthage/mobile-navigation-native/MapboxNavigationNative.xcframework.json" "92.0.0"
github "Quick/Nimble" "v9.2.1"
github "Quick/Quick" "v3.1.2"
github "mapbox/mapbox-directions-swift" "v2.3.0"
github "mapbox/mapbox-directions-swift" "v2.4.0-beta.1"
github "mapbox/mapbox-events-ios" "v1.0.7"
github "mapbox/turf-swift" "v2.3.0"
github "pointfreeco/swift-snapshot-testing" "1.9.0"
github "raphaelmor/Polyline" "v5.0.2"
github "raphaelmor/Polyline" "v5.0.3"
4 changes: 2 additions & 2 deletions MapboxCoreNavigation.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,8 @@ Pod::Spec.new do |s|
s.requires_arc = true
s.module_name = "MapboxCoreNavigation"

s.dependency "MapboxNavigationNative", "~> 88.0"
s.dependency "MapboxDirections", "~> 2.3"
s.dependency "MapboxNavigationNative", "~> 92.0"
s.dependency "MapboxDirections-pre", "2.4.0-beta.1"
s.dependency "MapboxMobileEvents", "~> 1.0"

s.swift_version = "5.0"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,26 +24,26 @@
"repositoryURL": "https://github.com/mapbox/mapbox-common-ios.git",
"state": {
"branch": null,
"revision": "d0adb996dfad19ed1edc611ee640e6c7506951a0",
"version": "21.1.0"
"revision": "2a1c1a6bd3e1d0c66d384c4dfbd0a03d60f3f877",
"version": "21.2.0-rc.1"
}
},
{
"package": "MapboxCoreMaps",
"repositoryURL": "https://github.com/mapbox/mapbox-core-maps-ios.git",
"state": {
"branch": null,
"revision": "f346a9880cf92ea5e8bc15a4034bb18d3d4c079c",
"version": "10.3.2"
"revision": "c6aac72620f97c28a4475b62b050c69c3a589da1",
"version": "10.4.0-rc.1"
}
},
{
"package": "MapboxDirections",
"repositoryURL": "https://github.com/mapbox/mapbox-directions-swift.git",
"state": {
"branch": null,
"revision": "2b14b8c276523a01dc730897593990ef83c71320",
"version": "2.3.0"
"revision": "f40fcea9d26fa2cb59570f21546abeffb643a02b",
"version": "2.4.0-beta.1"
}
},
{
Expand All @@ -60,17 +60,17 @@
"repositoryURL": "https://github.com/mapbox/mapbox-maps-ios.git",
"state": {
"branch": null,
"revision": "47f9d2da9acea04e79244949328c3a9d10f39945",
"version": "10.3.0"
"revision": "8cf3f937cfd0df60fe741ce83a089296c85b2546",
"version": "10.4.0-rc.1"
}
},
{
"package": "MapboxNavigationNative",
"repositoryURL": "https://github.com/mapbox/mapbox-navigation-native-ios.git",
"state": {
"branch": null,
"revision": "921b60a08375832088d69d023c1a7e1b4cac2231",
"version": "88.0.0"
"revision": "5aae54182a7d4d829e4f458483df44cf13dcde03",
"version": "92.0.0"
}
},
{
Expand Down Expand Up @@ -114,8 +114,8 @@
"repositoryURL": "https://github.com/raphaelmor/Polyline.git",
"state": {
"branch": null,
"revision": "36f7b1222aaf8fa741d0d179c12e186998d97f42",
"version": "5.0.2"
"revision": "554a15b15ff33cf6757f4cb693c5c285fe58694e",
"version": "5.0.3"
}
},
{
Expand All @@ -141,8 +141,8 @@
"repositoryURL": "https://github.com/apple/swift-argument-parser",
"state": {
"branch": null,
"revision": "e394bf350e38cb100b6bc4172834770ede1b7232",
"version": "1.0.3"
"revision": "82905286cc3f0fa8adc4674bf49437cab65a8373",
"version": "1.1.1"
}
},
{
Expand All @@ -159,8 +159,8 @@
"repositoryURL": "https://github.com/mapbox/turf-swift.git",
"state": {
"branch": null,
"revision": "436682278bd65a1dbfbad53902af6f4cc0af1a33",
"version": "2.2.0"
"revision": "a7db78a2281ffe79966443ebe5687766d6c024c7",
"version": "2.3.0"
}
}
]
Expand Down
2 changes: 1 addition & 1 deletion MapboxNavigation.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ Pod::Spec.new do |s|
s.module_name = "MapboxNavigation"

s.dependency "MapboxCoreNavigation", "#{s.version.to_s}"
s.dependency "MapboxMaps", "~> 10.3"
s.dependency "MapboxMaps", "10.4.0-rc.1"
s.dependency "Solar-dev", "~> 3.0"
s.dependency "MapboxSpeech", "~> 2.0"
s.dependency "MapboxMobileEvents", "~> 1.0"
Expand Down
32 changes: 16 additions & 16 deletions Package.resolved
Original file line number Diff line number Diff line change
Expand Up @@ -24,26 +24,26 @@
"repositoryURL": "https://github.com/mapbox/mapbox-common-ios.git",
"state": {
"branch": null,
"revision": "d0adb996dfad19ed1edc611ee640e6c7506951a0",
"version": "21.1.0"
"revision": "2a1c1a6bd3e1d0c66d384c4dfbd0a03d60f3f877",
"version": "21.2.0-rc.1"
}
},
{
"package": "MapboxCoreMaps",
"repositoryURL": "https://github.com/mapbox/mapbox-core-maps-ios.git",
"state": {
"branch": null,
"revision": "f346a9880cf92ea5e8bc15a4034bb18d3d4c079c",
"version": "10.3.2"
"revision": "c6aac72620f97c28a4475b62b050c69c3a589da1",
"version": "10.4.0-rc.1"
}
},
{
"package": "MapboxDirections",
"repositoryURL": "https://github.com/mapbox/mapbox-directions-swift.git",
"state": {
"branch": null,
"revision": "2b14b8c276523a01dc730897593990ef83c71320",
"version": "2.3.0"
"revision": "f40fcea9d26fa2cb59570f21546abeffb643a02b",
"version": "2.4.0-beta.1"
}
},
{
Expand All @@ -60,17 +60,17 @@
"repositoryURL": "https://github.com/mapbox/mapbox-maps-ios.git",
"state": {
"branch": null,
"revision": "47f9d2da9acea04e79244949328c3a9d10f39945",
"version": "10.3.0"
"revision": "8cf3f937cfd0df60fe741ce83a089296c85b2546",
"version": "10.4.0-rc.1"
}
},
{
"package": "MapboxNavigationNative",
"repositoryURL": "https://github.com/mapbox/mapbox-navigation-native-ios.git",
"state": {
"branch": null,
"revision": "921b60a08375832088d69d023c1a7e1b4cac2231",
"version": "88.0.0"
"revision": "5aae54182a7d4d829e4f458483df44cf13dcde03",
"version": "92.0.0"
}
},
{
Expand Down Expand Up @@ -105,8 +105,8 @@
"repositoryURL": "https://github.com/raphaelmor/Polyline.git",
"state": {
"branch": null,
"revision": "36f7b1222aaf8fa741d0d179c12e186998d97f42",
"version": "5.0.2"
"revision": "554a15b15ff33cf6757f4cb693c5c285fe58694e",
"version": "5.0.3"
}
},
{
Expand All @@ -132,8 +132,8 @@
"repositoryURL": "https://github.com/apple/swift-argument-parser",
"state": {
"branch": null,
"revision": "e394bf350e38cb100b6bc4172834770ede1b7232",
"version": "1.0.3"
"revision": "82905286cc3f0fa8adc4674bf49437cab65a8373",
"version": "1.1.1"
}
},
{
Expand All @@ -150,8 +150,8 @@
"repositoryURL": "https://github.com/mapbox/turf-swift.git",
"state": {
"branch": null,
"revision": "436682278bd65a1dbfbad53902af6f4cc0af1a33",
"version": "2.2.0"
"revision": "a7db78a2281ffe79966443ebe5687766d6c024c7",
"version": "2.3.0"
}
}
]
Expand Down
6 changes: 3 additions & 3 deletions Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,10 @@ let package = Package(
)
],
dependencies: [
.package(name: "MapboxDirections", url: "https://github.com/mapbox/mapbox-directions-swift.git", from: "2.3.0"),
.package(name: "MapboxDirections", url: "https://github.com/mapbox/mapbox-directions-swift.git", .exact("2.4.0-beta.1")),
.package(name: "MapboxMobileEvents", url: "https://github.com/mapbox/mapbox-events-ios.git", from: "1.0.0"),
.package(name: "MapboxNavigationNative", url: "https://github.com/mapbox/mapbox-navigation-native-ios.git", from: "88.0.0"),
.package(name: "MapboxMaps", url: "https://github.com/mapbox/mapbox-maps-ios.git", from: "10.3.0"),
.package(name: "MapboxNavigationNative", url: "https://github.com/mapbox/mapbox-navigation-native-ios.git", from: "92.0.0"),
.package(name: "MapboxMaps", url: "https://github.com/mapbox/mapbox-maps-ios.git", .exact("10.4.0-rc.1")),
.package(name: "Solar", url: "https://github.com/ceeK/Solar.git", from: "3.0.0"),
.package(name: "MapboxSpeech", url: "https://github.com/mapbox/mapbox-speech-swift.git", from: "2.0.0"),
.package(name: "Quick", url: "https://github.com/Quick/Quick.git", from: "3.1.2"),
Expand Down
17 changes: 8 additions & 9 deletions Sources/MapboxCoreNavigation/CoreNavigationNavigator.swift
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@ class Navigator {
}

private lazy var routeCoordinator: RoutesCoordinator = {
.init(setRoutesHandler: { [weak self] routes, completion in
self?.navigator.setRoutesFor(routes) { result in
.init(setRoutesHandler: { [weak self] route, legIndex, completion in
self?.navigator.setPrimaryRouteForRoute(route, legIndex: legIndex) { [weak self] result in
if result.isValue() {
let routeInfo = result.value as! RouteInfo
os_log("Navigator has been updated",
Expand Down Expand Up @@ -209,13 +209,12 @@ class Navigator {

// MARK: - Navigator Updates

func setRoutes(_ routes: Routes?, uuid: UUID, completion: @escaping (Result<RouteInfo, Error>) -> Void) {
if let routes = routes {
routeCoordinator.beginActiveNavigation(with: routes, uuid: uuid, completion: completion)
}
else {
routeCoordinator.endActiveNavigation(with: uuid, completion: completion)
}
func setRoutes(_ route: RouteInterface, uuid: UUID, legIndex: UInt32, completion: @escaping (Result<RouteInfo, Error>) -> Void) {
routeCoordinator.beginActiveNavigation(with: route, uuid: uuid, legIndex: legIndex, completion: completion)
}

func unsetRoutes(uuid: UUID, completion: @escaping (Result<RouteInfo, Error>) -> Void) {
routeCoordinator.endActiveNavigation(with: uuid, completion: completion)
}

func updateLocation(_ location: CLLocation, completion: @escaping (Bool) -> Void) {
Expand Down
9 changes: 9 additions & 0 deletions Sources/MapboxCoreNavigation/EHorizon/RoadObjectKind.swift
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,11 @@ extension RoadObject {
*/
case bridge

/**
An alert about an railroad crossing at grade, also known as a level crossing.
*/
case railroadCrossing

/**
Reserved for future use.
*/
Expand All @@ -76,6 +81,8 @@ extension RoadObject {
self = .restrictedArea
case .bridge:
self = .bridge
case .railwayCrossing:
self = .railroadCrossing
case .custom:
self = .userDefined
@unknown default:
Expand All @@ -99,6 +106,8 @@ extension RoadObject {
self = .restrictedArea
case .bridge:
self = .bridge
case .railwayCrossing:
self = .railroadCrossing
case .custom:
self = .userDefined
@unknown default:
Expand Down
40 changes: 26 additions & 14 deletions Sources/MapboxCoreNavigation/MapboxRoutingProvider.swift
Original file line number Diff line number Diff line change
Expand Up @@ -295,33 +295,45 @@ public class MapboxRoutingProvider: RoutingProvider {
return nil
}

let encoder = JSONEncoder()
encoder.userInfo[.options] = routeOptions

let routeIndex = UInt32(indexedRouteResponse.routeIndex)

guard let routeData = try? encoder.encode(indexedRouteResponse.routeResponse),
let routeJSONString = String(data: routeData, encoding: .utf8) else {
preconditionFailure("Could not serialize route data for refreshing.")
}

var requestId: RequestId!
let refreshOptions = RouteRefreshOptions(requestId: responseIdentifier,
routeIndex: routeIndex,
legIndex: startLegIndex,
routingProfile: routeOptions.profileIdentifier.nativeProfile)

requestId = router.getRouteRefresh(for: refreshOptions,
route: routeJSONString) { [weak self] result, _ in
requestId = router.getRouteRefresh(for: refreshOptions, callback: { [weak self] result, _ in
guard let self = self else { return }

self.parseResponse(requestId: requestId,
userInfo: [.options: routeOptions,
userInfo: [.responseIdentifier: responseIdentifier,
.routeIndex: indexedRouteResponse.routeIndex,
.startLegIndex: Int(startLegIndex),
.credentials: self.settings.directions.credentials],
result: result) { (response: Result<RouteResponse, DirectionsError>) in
completionHandler(session, response)
result: result) { (response: Result<RouteRefreshResponse, DirectionsError>) in
switch response {
case .failure(let error):
DispatchQueue.main.async {
completionHandler(session, .failure(error))
}
case .success(let routeRefreshResponse):
DispatchQueue.global().async {
do {
let routeResponse = try indexedRouteResponse.routeResponse.copy(with: routeOptions)
routeResponse.routes?[indexedRouteResponse.routeIndex].refreshLegAttributes(from: routeRefreshResponse.route)
DispatchQueue.main.async {
completionHandler(session, .success(routeResponse))
}
} catch {
DispatchQueue.main.async {
completionHandler(session, .failure(.unknown(response: nil, underlying: error, code: nil, message: nil)))
}
}
}
}
}
}
})
let request = Request(requestIdentifier: requestId,
routingProvider: self)
requestsLock {
Expand Down
Loading

0 comments on commit f8198e3

Please sign in to comment.