Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
30022f4
Update to Mapbox Maps `v10.0.0-rc.8`.
MaximAlien Sep 8, 2021
f93d216
Update Mapbox Navigation Native to `66.0.0`. Fix compilation issues.
MaximAlien Sep 15, 2021
5682ff8
Merge branch 'main' into maxim/update-dependencies
MaximAlien Sep 15, 2021
914c85f
Adapt code to the latest APIs, which allows to manually change location.
MaximAlien Sep 15, 2021
0dbf5c7
Update MapboxCommon to `18.0.0`.
MaximAlien Sep 16, 2021
5814035
Make sure to check whether there are valid `RoadObjectsStoreObserver`…
MaximAlien Sep 16, 2021
5564bdc
Improve variable naming.
MaximAlien Sep 16, 2021
fd5b250
Update Mapbox Navigation Native to `66.0.1`.
MaximAlien Sep 16, 2021
61342f5
Update `Router.advanceLegIndex()` protocol to use completion handler.
MaximAlien Sep 16, 2021
bf2e9be
Update `RoadObjectLocation` to use switch/case instead of it/else sta…
MaximAlien Sep 16, 2021
40ca2d9
Use switch/case instead of if/else statements in `OrnamentsController…
MaximAlien Sep 16, 2021
61fae97
Update `DistancedRoadObject` to use switch/case instead of it/else st…
MaximAlien Sep 16, 2021
9f89bec
Temporarily allow warnings while running CocoaPods linter to prevent …
MaximAlien Sep 16, 2021
579bf3d
Merge branch 'main' into maxim/update-dependencies
MaximAlien Sep 16, 2021
f23a6d6
Merge branch 'main' into maxim/update-dependencies
MaximAlien Sep 17, 2021
9f74c76
Remove deprecated Navigation Native method usage while setting route.
MaximAlien Sep 17, 2021
b949109
Fix failing `testRerouteAfterArrival` by providing list of waypoints.
MaximAlien Sep 17, 2021
86f8f18
Fix failing `testRerouteAfterArrival`.
MaximAlien Sep 17, 2021
8efbd08
Attempt to fix `testNewStep` by increasing time interval.
MaximAlien Sep 17, 2021
229c531
Temporarily disable `testReroutingFromALocationSendsEvents` and `test…
MaximAlien Sep 17, 2021
246a7e1
Modify `UpdateLocationCompletionHandler` and `AdvanceLegCompletionHan…
MaximAlien Sep 17, 2021
4642c57
Remove boilerplate code from `RouteControllerError`.
MaximAlien Sep 17, 2021
c896970
Update changelog.
MaximAlien Sep 17, 2021
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@

* The Mapbox Navigation SDK for iOS license has changed from the ISC License to the Mapbox Terms of Service. ([#2808](https://github.com/mapbox/mapbox-navigation-ios/pull/2808))
* You can now install MapboxNavigation using Swift Package Manager, but you can no longer install it using Carthage. If you previously installed MapboxNavigation using Carthage, use Swift Package Manager instead. ([#2808](https://github.com/mapbox/mapbox-navigation-ios/pull/2808))
* MapboxNavigation now depends on [MapboxMaps v10.0.0-rc.7](https://github.com/mapbox/mapbox-maps-ios/). ([#3297](https://github.com/mapbox/mapbox-navigation-ios/pull/3297))
* MapboxNavigation now depends on MapboxNavigationNative v65.0.1. ([#3320](https://github.com/mapbox/mapbox-navigation-ios/pull/3320))
* MapboxNavigation now depends on MapboxCommon v17.1.0. ([#3297](https://github.com/mapbox/mapbox-navigation-ios/pull/3297))
* MapboxNavigation now depends on MapboxMobileEvents v1.0.3. ([#3320](https://github.com/mapbox/mapbox-navigation-ios/pull/3320))
* MapboxNavigation now depends on [MapboxMaps v10.0.0-rc.8](https://github.com/mapbox/mapbox-maps-ios/). ([#3342](https://github.com/mapbox/mapbox-navigation-ios/pull/3342))
* MapboxNavigation now depends on MapboxNavigationNative v66.0.0. ([#3342](https://github.com/mapbox/mapbox-navigation-ios/pull/3342))
Comment thread
1ec5 marked this conversation as resolved.
* MapboxNavigation now depends on MapboxCommon v18.0.0. ([#3342](https://github.com/mapbox/mapbox-navigation-ios/pull/3342))
* MapboxCoreNavigation depends on MapboxDirections v2.0.0-rc.1. ([#3325](https://github.com/mapbox/mapbox-navigation-ios/pull/3325))
* MapboxCoreNavigation no longer depends on MapboxAccounts. ([#2829](https://github.com/mapbox/mapbox-navigation-ios/pull/2829))
* MapboxNavigation now depends on Turf v2.0.0-rc.1. ([#3248](https://github.com/mapbox/mapbox-navigation-ios/pull/3248))
Expand Down Expand Up @@ -178,6 +178,7 @@
* Feedback categories and subcategories for active navigation were changed. "Incorrect visual" category was renamed to "Looks Incorrect". For the full updated list of supported categories see enum `ActiveNavigationFeedbackType`. ([#3339]((https://github.com/mapbox/mapbox-navigation-ios/pull/3339))
* Fixed bundle names retrieval in `URLSession.userAgent`. ([#3335]((https://github.com/mapbox/mapbox-navigation-ios/pull/3335))
* Fixed IndexedRouteResponse handling after rerouting. ([#3344]((https://github.com/mapbox/mapbox-navigation-ios/pull/3344))
* Renamed the `Router.advanceLegIndex()` method to `Router.advanceLegIndex(completionHandler:)` and the `PassiveLocationDataSource.updateLocation(_:)` method to `PassiveLocationManager.updateLocation(_:completionHandler:)`. These methods are now asynchronous, and their completion handlers indicate whether the operation succeeded. ([#3344](https://github.com/mapbox/mapbox-navigation-ios/pull/3344))

## v1.4.1

Expand Down
4 changes: 2 additions & 2 deletions Cartfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
binary "https://api.mapbox.com/downloads/v2/carthage/mapbox-common/MapboxCommon.json" ~> 17.1.0
binary "https://api.mapbox.com/downloads/v2/carthage/mobile-navigation-native/MapboxNavigationNative.xcframework.json" ~> 65.0
binary "https://api.mapbox.com/downloads/v2/carthage/mapbox-common/MapboxCommon.json" ~> 18.0.0
binary "https://api.mapbox.com/downloads/v2/carthage/mobile-navigation-native/MapboxNavigationNative.xcframework.json" ~> 66.0
github "mapbox/mapbox-directions-swift" "v2.0.0-rc.1"
github "mapbox/turf-swift" "v2.0.0-rc.1"
github "mapbox/mapbox-events-ios" ~> 1.0.0
4 changes: 2 additions & 2 deletions Cartfile.resolved
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
binary "https://api.mapbox.com/downloads/v2/carthage/mapbox-common/MapboxCommon.json" "17.1.0"
binary "https://api.mapbox.com/downloads/v2/carthage/mobile-navigation-native/MapboxNavigationNative.xcframework.json" "65.0.2"
binary "https://api.mapbox.com/downloads/v2/carthage/mapbox-common/MapboxCommon.json" "18.0.0"
binary "https://api.mapbox.com/downloads/v2/carthage/mobile-navigation-native/MapboxNavigationNative.xcframework.json" "66.0.1"
github "Quick/Nimble" "v9.2.1"
github "Quick/Quick" "v3.1.2"
github "Udumft/SwiftCLI" "da19d2a16cd5aa838d8fb7256e28c171bc67dd82"
Expand Down
2 changes: 1 addition & 1 deletion Example/ViewController+FreeDrive.swift
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ extension ViewController {
var layer = LineLayer(id: styledFeature.layerIdentifier)
layer.source = styledFeature.sourceIdentifier
layer.lineWidth = .constant(styledFeature.lineWidth)
layer.lineColor = .constant(.init(color: styledFeature.color))
layer.lineColor = .constant(.init(styledFeature.color))
try style.addLayer(layer)
} catch {
NSLog("Failed to perform operation with error: \(error.localizedDescription).")
Expand Down
2 changes: 1 addition & 1 deletion MapboxCoreNavigation.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ Pod::Spec.new do |s|
s.requires_arc = true
s.module_name = "MapboxCoreNavigation"

s.dependency "MapboxNavigationNative", "~> 65.0"
s.dependency "MapboxNavigationNative", "~> 66.0"
s.dependency "MapboxDirections-pre", "2.0.0-rc.1"
s.dependency "MapboxMobileEvents", "~> 1.0.0" # Always specify a patch release if pre-v1.0
s.dependency "Turf", "2.0.0-rc.1"
Expand Down
4 changes: 2 additions & 2 deletions MapboxNavigation-Documentation.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,9 @@ Pod::Spec.new do |s|
s.frameworks = ['CarPlay']

s.dependency "MapboxDirections-pre", "2.0.0-rc.1"
s.dependency "MapboxMaps", "10.0.0-rc.7"
s.dependency "MapboxMaps", "10.0.0-rc.8"
s.dependency "MapboxMobileEvents", "~> 1.0.0"
s.dependency "MapboxNavigationNative", "~> 65.0"
s.dependency "MapboxNavigationNative", "~> 66.0"
s.dependency "Solar-dev", "~> 3.0"
s.dependency "Turf", "2.0.0-rc.1"
s.dependency "MapboxSpeech-pre", "2.0.0-rc.1"
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

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.0.0-rc.7"
s.dependency "MapboxMaps", "10.0.0-rc.8"
s.dependency "Solar-dev", "~> 3.0"
s.dependency "MapboxSpeech-pre", "2.0.0-rc.1"
s.dependency "MapboxMobileEvents", "~> 1.0.0" # Always specify a patch release if pre-v1.0
Expand Down
24 changes: 12 additions & 12 deletions Package.resolved

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ let package = Package(
dependencies: [
.package(name: "MapboxDirections", url: "https://github.com/mapbox/mapbox-directions-swift.git", .exact("2.0.0-rc.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: "65.0.0"),
.package(name: "MapboxMaps", url: "https://github.com/mapbox/mapbox-maps-ios.git", .exact("10.0.0-rc.7")),
.package(name: "MapboxNavigationNative", url: "https://github.com/mapbox/mapbox-navigation-native-ios.git", from: "66.0.0"),
.package(name: "MapboxMaps", url: "https://github.com/mapbox/mapbox-maps-ios.git", .exact("10.0.0-rc.8")),
.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-rc.1"),
.package(name: "Quick", url: "https://github.com/Quick/Quick.git", from: "3.1.2"),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,9 @@ class Navigator {
cache: cacheHandle,
historyRecorder: historyRecorder)
}()


var mostRecentNavigationStatus: NavigationStatus? = nil

private(set) var tileStore: TileStore

/**
Expand Down Expand Up @@ -272,5 +274,7 @@ extension Navigator: NavigatorObserver {
.statusKey: status,
]
NotificationCenter.default.post(name: .navigationStatusDidChange, object: nil, userInfo: userInfo)

mostRecentNavigationStatus = status
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -102,31 +102,32 @@ public enum DistancedRoadObject {
}

init(_ native: MapboxNavigationNative.RoadObjectDistance) {
if native.distanceInfo.isPointDistanceInfo() {
switch native.distanceInfo.type {
case .pointDistanceInfo:
let info = native.distanceInfo.getPointDistanceInfo()
self = .point(identifier: native.roadObjectId,
kind: RoadObject.Kind(native.type),
distance: info.distance)
} else if native.distanceInfo.isGantryDistanceInfo() {
case .gantryDistanceInfo:
let info = native.distanceInfo.getGantryDistanceInfo()
self = .gantry(identifier: native.roadObjectId,
kind: RoadObject.Kind(native.type),
distance: info.distance)
} else if native.distanceInfo.isPolygonDistanceInfo() {
case .polygonDistanceInfo:
let info = native.distanceInfo.getPolygonDistanceInfo()
self = .polygon(identifier: native.roadObjectId,
kind: RoadObject.Kind(native.type),
distanceToNearestEntry: info.entrances.first?.distance,
distanceToNearestExit: info.exits.first?.distance,
isInside: info.isInside)
} else if native.distanceInfo.isSubGraphDistanceInfo() {
case .subGraphDistanceInfo:
let info = native.distanceInfo.getSubGraphDistanceInfo()
self = .subgraph(identifier: native.roadObjectId,
kind: RoadObject.Kind(native.type),
distanceToNearestEntry: info.entrances.first?.distance,
distanceToNearestExit: info.exits.first?.distance,
isInside: info.isInside)
} else if native.distanceInfo.isLineDistanceInfo() {
case .lineDistanceInfo:
let info = native.distanceInfo.getLineDistanceInfo()
self = .line(identifier: native.roadObjectId,
kind: RoadObject.Kind(native.type),
Expand All @@ -135,7 +136,7 @@ public enum DistancedRoadObject {
distanceToEnd: info.distanceToEnd,
isEntryFromStart: info.isEntryFromStart,
length: info.length)
} else {
@unknown default:
preconditionFailure("DistancedRoadObject can't be constructed. Unknown type.")
}
}
Expand Down
25 changes: 13 additions & 12 deletions Sources/MapboxCoreNavigation/EHorizon/RoadObjectLocation.swift
Original file line number Diff line number Diff line change
Expand Up @@ -77,45 +77,46 @@ extension RoadObject {
case routeAlert(shape: Turf.Geometry)

init(_ native: MapboxNavigationNative.MatchedRoadObjectLocation) {
if native.isOpenLRLineLocation() {
switch native.type {
case .openLRLineLocation:
let location = native.getOpenLRLineLocation()
self = .openLRLine(path: RoadGraph.Path(location.getPath()),
shape: Geometry(location.getShape()))
} else if native.isOpenLRPointAlongLineLocation() {
case .openLRPointAlongLineLocation:
let location = native.getOpenLRPointAlongLineLocation()
self = .openLRPoint(position: RoadGraph.Position(location.getPosition()),
sideOfRoad: OpenLRSideOfRoad(location.getSideOfRoad()),
orientation: OpenLROrientation(location.getOrientation()),
coordinate: location.getCoordinate())
} else if native.isMatchedPolylineLocation() {
case .matchedPolylineLocation:
let location = native.getMatchedPolylineLocation()
self = .polyline(path: RoadGraph.Path(location.getPath()),
shape: Geometry(location.getShape()))
} else if native.isMatchedGantryLocation() {
case .matchedGantryLocation:
let location = native.getMatchedGantryLocation()
self = .gantry(positions: location.getPositions().map(RoadObject.Position.init),
shape: Geometry(location.getShape()))
} else if native.isMatchedPolygonLocation() {
case .matchedPolygonLocation:
let location = native.getMatchedPolygonLocation()
self = .polygon(entries: location.getEntries().map(RoadObject.Position.init),
exits: location.getExits().map(RoadObject.Position.init),
shape: Geometry(location.getShape()))
} else if native.isMatchedPointLocation() {
case .matchedPointLocation:
let location = native.getMatchedPointLocation()
self = .point(position: RoadObject.Position(location.getPosition()))
} else if native.isRouteAlert() {
let location = native.getRouteAlert()
self = .routeAlert(shape: Geometry(location.getShape()))
} else if native.isMatchedSubgraphLocation() {
case .matchedSubgraphLocation:
let location = native.getMatchedSubgraphLocation()
let edges = location.getEdges()
.map { (id, edge) in (UInt(truncating: id), RoadGraph.SubgraphEdge(edge)) }
self = .subgraph(enters: location.getEnters().map(RoadObject.Position.init),
exits: location.getExits().map(RoadObject.Position.init),
shape: Geometry(location.getShape()),
edges: .init(uniqueKeysWithValues: edges))
} else {
preconditionFailure("RoadObject.Location can't be constructed. Unknown type.")
case .routeAlertLocation:
let routeAlertLocation = native.getRouteAlert()
self = .routeAlert(shape: Geometry(routeAlertLocation.getShape()))
@unknown default:
preconditionFailure("RoadObjectLocation can't be constructed. Unknown type.")
}
}
}
Expand Down
10 changes: 7 additions & 3 deletions Sources/MapboxCoreNavigation/EHorizon/RoadObjectStore.swift
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,9 @@ public final class RoadObjectStore {
}

deinit {
native.setObserverForOptions(nil)
if native.hasObservers() {
native.removeObserver(for: self)
}
}

var native: MapboxNavigationNative.RoadObjectsStore {
Expand All @@ -100,9 +102,11 @@ public final class RoadObjectStore {

private func updateObserver() {
if delegate != nil {
native.setObserverForOptions(self)
native.addObserver(for: self)
} else {
native.setObserverForOptions(nil)
if native.hasObservers() {
native.removeObserver(for: self)
}
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion Sources/MapboxCoreNavigation/LegacyRouteController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,7 @@ open class LegacyRouteController: NSObject, Router, InternalRouter, CLLocationMa
return isCloseToCurrentStep
}

public func advanceLegIndex() {
public func advanceLegIndex(completionHandler: AdvanceLegCompletionHandler? = nil) {
precondition(!routeProgress.isFinalLeg, "Can not increment leg index beyond final leg.")
routeProgress.legIndex += 1
}
Expand Down
Loading