Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
42 commits
Select commit Hold shift + click to select a range
80e2f9c
Update nav-native version to 10.0.4.
Jun 6, 2020
b3a3cd7
Update version in podspec.
Jun 6, 2020
3d8ffa7
Update nav-native version to 12.0.3.
Jun 7, 2020
5bbcf1f
Update nav-native version to 12.0.3.
Jun 7, 2020
d9c62bc
Fix compilation issues with hints from bindgen team.
Jun 7, 2020
85ae849
Update CocoaPodsTest to 12.0.3.
MaximAlien Jun 23, 2020
09cb015
Add ability to skip 32-bit arch. by Cocoapods linter.
MaximAlien Jun 23, 2020
b6f9085
Update Cartfile and sources to accommodate changes in MapboxNavigatio…
MaximAlien Jun 23, 2020
7cae104
Update CocoaPods related files to MapboxNavigationNative 14.1.0.
MaximAlien Jun 23, 2020
edbc02a
Fix failing build.
MaximAlien Jun 23, 2020
065da2c
Fix issues with handling CLLocation accuracy properties.
MaximAlien Jun 24, 2020
e60dae9
Update build configuration to support min. Xcode 11.4.1.
MaximAlien Jun 24, 2020
d3201ab
Update build config. to use available iOS devices.
MaximAlien Jun 24, 2020
d84fb7c
Fix crash when unpacking tiles.
MaximAlien Jun 24, 2020
aad1804
Change testDepartRerouteArrive to fail instead of crashing.
MaximAlien Jun 26, 2020
53dc0f9
Fix testReroutingFromALocationSendsEvents by increasing distance thre…
MaximAlien Jun 26, 2020
a0b5f6a
Attempt to fix testSnappedAtEndOfStepLocationWhenMovingSlowly by addi…
MaximAlien Jun 26, 2020
e24302e
Attempt to fix testSnappedLocationForUnqualifiedLocation by decreasin…
MaximAlien Jun 26, 2020
556c6fc
Attempt to fix testSnappedAtEndOfStepLocationWhenCourseIsSimilar by a…
MaximAlien Jun 26, 2020
9499890
Update testCLLocationToFixLocation to use common expected values.
MaximAlien Jun 30, 2020
76f05f6
Remove availability check for speedAccuracy.
MaximAlien Jun 30, 2020
4576761
Remove speedAccuracy verification since it's only available in initia…
MaximAlien Jun 30, 2020
e1fd569
Fix failing testUserIsOffRoute.
MaximAlien Jun 30, 2020
f616d9d
Update to nav. native 14.1.2.
MaximAlien Jun 30, 2020
7967aba
Fix testAdvancingToFutureStepAndNotRerouting by adding verification w…
MaximAlien Jun 30, 2020
449b7ee
Temporarily mark testDepartRerouteArrive as skipped test to verify Ma…
MaximAlien Jul 1, 2020
ae65b54
Add missing fixtures.
MaximAlien Jul 1, 2020
57f3d2c
Use non default shifted timestamp in testTimestampShiftForLocation.
MaximAlien Jul 1, 2020
4ac4d35
Rewrite tests related to snapping location to be more accurate and mi…
MaximAlien Jul 2, 2020
09973b6
Update to nav. native 14.1.3 for Carthage.
MaximAlien Jul 2, 2020
f60cd12
Stop using numberOfTiles completionHandler argument.
MaximAlien Jul 2, 2020
5103d03
Remove empty Fixtures and Templates project groups.
MaximAlien Jul 2, 2020
30ac0c0
Temporarily mark testOfflineDirections as skipped.
MaximAlien Jul 2, 2020
a76de59
Attempt to force CocoaPods to load new version of navigation native 1…
MaximAlien Jul 2, 2020
71413ee
Revert "Stop using numberOfTiles completionHandler argument."
MaximAlien Jul 2, 2020
d4bc153
Upgrade to 14.1.4.
MaximAlien Jul 2, 2020
8c73594
Update OfflineRoutingTests to mirror logic in navigation native (shou…
MaximAlien Jul 2, 2020
d244aaa
Updated changelog
1ec5 Jul 3, 2020
40d9f0f
Upgrade Carthage nav. native dependency to 14.1.5.
MaximAlien Jul 6, 2020
179d8d5
Remove ARCHS, VALID_ARCHS and ONLY_ACTIVE_ARCH flags because nav. nat…
MaximAlien Jul 6, 2020
02d2f26
Upgrade CocoaPods to nav. native 14.1.5.
MaximAlien Jul 6, 2020
694eae3
Add missing CocaPods upgrade after upgrade to nav. native 14.1.5.
MaximAlien Jul 6, 2020
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
39 changes: 20 additions & 19 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ step-library:
run:
name: Build Example
command: |
xcodebuild -sdk iphonesimulator -destination 'platform=iOS Simulator,OS=12.2,name=iPhone 6 Plus' -project MapboxNavigation.xcodeproj -scheme Example clean build | xcpretty
xcodebuild -sdk iphonesimulator -destination 'platform=iOS Simulator,OS=13.4.1,name=iPhone 8 Plus' -project MapboxNavigation.xcodeproj -scheme Example clean build | xcpretty

jobs:
pod-job:
Expand All @@ -84,10 +84,10 @@ jobs:
default: false
iOS:
type: string
default: "12.2"
default: "13.4.1"
xcode:
type: string
default: "10.2.0"
default: "11.4.1"
lint:
type: boolean
default: false
Expand All @@ -110,7 +110,7 @@ jobs:
condition: << parameters.update >>
steps:
- run: cd MapboxCoreNavigationTests/CocoaPodsTest/PodInstall && pod install --repo-update
- run: cd MapboxCoreNavigationTests/CocoaPodsTest/PodInstall && xcodebuild -workspace PodInstall.xcworkspace -scheme PodInstall -destination 'platform=iOS Simulator,OS=<< parameters.iOS >>,name=iPhone 6 Plus' clean build | xcpretty
- run: cd MapboxCoreNavigationTests/CocoaPodsTest/PodInstall && xcodebuild -workspace PodInstall.xcworkspace -scheme PodInstall -destination 'platform=iOS Simulator,OS=<< parameters.iOS >>,name=iPhone 8 Plus' clean build | xcpretty
- when:
condition: << parameters.lint >>
steps:
Expand All @@ -123,13 +123,13 @@ jobs:
parameters:
xcode:
type: string
default: "10.1.0"
default: "11.4.1"
device:
type: string
default: "iPhone 6 Plus"
default: "iPhone 8 Plus"
iOS:
type: string
default: "12.1"
default: "13.4.1"
test:
type: boolean
default: true
Expand Down Expand Up @@ -177,9 +177,9 @@ jobs:
steps:
- run: bash <(curl -s https://codecov.io/bash)

xcode-10-examples:
xcode-11-examples:
macos:
xcode: "10.2.0"
xcode: "11.4.1"
environment:
HOMEBREW_NO_AUTO_UPDATE: 1
steps:
Expand All @@ -201,24 +201,25 @@ workflows:
iOS: "13.5"
device: "iPhone 8 Plus"
- build-job:
name: "Xcode_10.3_iOS_12.1"
xcode: "10.3.0"
iOS: "12.1"
name: "Xcode_11.4.1_iOS_12.2"
xcode: "11.4.1"
iOS: "12.2"
Comment on lines +204 to +206
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Various test fixtures are conditionalized by iOS version, based on their file names. So we’ll need to rename or delete and rerecord a slew of test fixtures, similar to what took place in #2427.

Copy link
Copy Markdown
Contributor Author

@MaximAlien MaximAlien Jul 1, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, fixtures were updated. I've also decided to remove iOS 13.4.1 build job since there is one for 13.5 already (this will allow to speed up build time and prevent adding additional fixtures for 13.4.1).

codecoverage: true
- build-job:
name: "Xcode_10.2_iOS_10.3.1"
xcode: "10.2.1"
name: "Xcode_11.4.1_iOS_10.3.1"
xcode: "11.4.1"
Comment on lines +209 to +210
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We need to continue to test against iOS 10.x somehow, because the SDK still supports iOS 10.x. On the other hand, it’s fine to drop Xcode 10 support, but we should update the readme to make that clear.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've added step to test against iOS 10.3.1. Do you think that's enough? Also another note is that since properties like courseAccuracy were introduced only in iOS 13.4 minimum usable version of Xcode is 11.4.1. Please let me know if that's okay.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, that’s OK.

iOS: "10.3.1"
test: false
device: "iPhone 7 Plus"
- pod-job:
name: "Xcode_10.2_iOS_12.2_CP_install"
name: "Xcode_11.4.1_iOS_12.2_CP_install"
update: false
xcode: "10.2.1"
xcode: "11.4.1"
iOS: "12.2"
- pod-job:
name: "Xcode_10.2_iOS_12.2_CP_update"
name: "Xcode_11.4.1_iOS_12.2_CP_update"
update: true
xcode: "10.2.1"
xcode: "11.4.1"
iOS: "12.2"
lint: true
- xcode-10-examples
- xcode-11-examples
26 changes: 20 additions & 6 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,22 @@

### Packaging

* For the time being, MapboxCoreNavigation.framework depends on a build of MapboxNavigationNative.framework that is only available to authorized beta testers. Please contact your Mapbox sales representative or [support team](https://support.mapbox.com/) to learn more about the beta testing program. ([#2412](https://github.com/mapbox/mapbox-navigation-ios/pull/2412))
* Xcode 11.4.1 or above is now required for building this SDK from source. ([#2417](https://github.com/mapbox/mapbox-navigation-ios/pull/2417))
* Enabled MAU billing by default, so that SDKs usage of Mapbox APIs is [billed](https://www.mapbox.com/pricing/) together based on [monthly active users](https://docs.mapbox.com/help/glossary/monthly-active-users/) rather than individually by HTTP request. If you prefer to still use request-based billing, set the `MBXNavigationBillingMethod` key in Info.plist to `request` ([#2405](https://github.com/mapbox/mapbox-navigation-ios/pull/2405).
* Added a Greek localization. ([#2385](https://github.com/mapbox/mapbox-navigation-ios/pull/2385))

### User location

* Fixed issues where the user puck would sometimes drift away from the route line even though the user was following the route. ([#2404](https://github.com/mapbox/mapbox-navigation-ios/pull/2404))
* Fixed an issue where `RouteController` took longer than usual to detect that the user had gone off-route. ([#2404](https://github.com/mapbox/mapbox-navigation-ios/pull/2404))
* Fixed an issue where `RouteController` would detect that the user had gone off-route due to a single errant location update. ([#2404](https://github.com/mapbox/mapbox-navigation-ios/pull/2404))
* Fixed an issue where various delegate methods omitted `CLLocation.courseAccuracy` and `CLLocation.speedAccuracy` properties from passed-in `CLLocation` objects when using `RouteController`, even when these properties are provided by Core Location on iOS 13.4 and above. ([#2417](https://github.com/mapbox/mapbox-navigation-ios/pull/2417))
* Fixed issues where the user puck would sometimes drift away from the route line even though the user was following the route. ([#2412](https://github.com/mapbox/mapbox-navigation-ios/pull/2412), [#2417](https://github.com/mapbox/mapbox-navigation-ios/pull/2417))
* Fixed an issue where `RouteController` took longer than usual to detect that the user had gone off-route. ([#2412](https://github.com/mapbox/mapbox-navigation-ios/pull/2412))
* Fixed an issue where `RouteController` would detect that the user had gone off-route due to a single errant location update. ([#2412](https://github.com/mapbox/mapbox-navigation-ios/pull/2412), [#2417](https://github.com/mapbox/mapbox-navigation-ios/pull/2417))
* Fixed an issue where the camera and user puck would cut a corner when making a turn at speed. ([#2412](https://github.com/mapbox/mapbox-navigation-ios/pull/2412))
* Fixed an issue where `RouteController` became too sensitive to the user going off-route near “intersections” that the Mapbox Directions API synthesizes at road classification changes, such as at either end of a tunnel. ([#2412](https://github.com/mapbox/mapbox-navigation-ios/pull/2412))
* If the user’s raw course as reported by Core Location differs significantly from the direction of the road ahead, the camera and user puck are oriented according to the raw course. ([#2417](https://github.com/mapbox/mapbox-navigation-ios/pull/2417))
* `RouteController` now tracks the user’s location more accurately within roundabouts. ([#2417](https://github.com/mapbox/mapbox-navigation-ios/pull/2417))
* Fixed an issue where departure instructions were briefly missing when beginning turn-by-turn navigation. ([#2417](https://github.com/mapbox/mapbox-navigation-ios/pull/2417))

### User location

Expand All @@ -27,14 +35,20 @@
* Fixed an issue where the route would sometimes contain duplicate waypoints. ([valhalla/valhalla#1880](https://github.com/valhalla/valhalla/pull/1880))
* Fixed an issue where an exception to a road closure on a public holiday was being ignored. ([valhalla/valhalla#2198](https://github.com/valhalla/valhalla/pull/2198))
* By default, calculated routes follow alleys less often. ([valhalla/valhalla#2231](https://github.com/valhalla/valhalla/pull/2231))
* When `RouteOptions.profileIdentifier` is set to `DirectionsProfileIdentifier.cycling`, the calculated route may now follow paths tagged with [mountain biking difficulty levels](https://wiki.openstreetmap.org/wiki/Key:mtb:scale) in OpenStreetMap. ([valhalla/valhalla#2117](https://github.com/valhalla/valhalla/pull/2117))
* Fixed an issue where floating-point numbers in tags were parsed incorrectly. ([valhalla/valhalla#2355](https://github.com/valhalla/valhalla/pull/2355))
* When two maneuvers are spaced close together, the spoken instruction now describes both maneuvers. ([valhalla/valhalla#2353](https://github.com/valhalla/valhalla/pull/2353))
* Turn lane indications are now shown below the turn banner as when navigating online. ([valhalla/valhalla#1830](https://github.com/valhalla/valhalla/pull/1830), [valhalla/valhalla#1859](https://github.com/valhalla/valhalla/pull/1859))
* Fixed an issue where the `RouteStep.expectedTravelTime` properties of each step did not add up to the `RouteLeg.expectedTravelTime` property. ([valhalla/valhalla#2195](https://github.com/valhalla/valhalla/pull/2195))
* Fixed an issue where a forward- or backward-only speed limit was not considered when calculating some expected travel times. ([valhalla/valhalla#2198](https://github.com/valhalla/valhalla/pull/2198))
* Suppressed extraneous fork instructions. ([valhalla/valhalla#1886](https://github.com/valhalla/valhalla/pull/1886), [valhalla/valhalla#1909](https://github.com/valhalla/valhalla/pull/1909), [valhalla/valhalla#1928](https://github.com/valhalla/valhalla/pull/1928))
* Merge instructions now indicate whether to merge to the left or the right, as when navigating online. ([valhalla/valhalla#1892](https://github.com/valhalla/valhalla/pull/1892), [valhalla/valhalla#1989](https://github.com/valhalla/valhalla/pull/1989))
* Suppressed extraneous `ManeuverType.reachFork` maneuvers. ([valhalla/valhalla#1886](https://github.com/valhalla/valhalla/pull/1886), [valhalla/valhalla#1909](https://github.com/valhalla/valhalla/pull/1909), [valhalla/valhalla#1928](https://github.com/valhalla/valhalla/pull/1928))
* A spoken instruction about a `ManeuverType.merge` maneuver now indicates whether to merge to the left or the right, as when navigating online. ([valhalla/valhalla#1892](https://github.com/valhalla/valhalla/pull/1892), [valhalla/valhalla#1989](https://github.com/valhalla/valhalla/pull/1989))
* Spoken instructions for `ManeuverType.exitRoundabout` and `ManeuverType.exitRotary` maneuvers now indicate the outlet road name or destination if available. ([valhalla/valhalla#2378](https://github.com/valhalla/valhalla/pull/2378))
* Fixed ungrammatical spoken instructions at sharp turns in English. ([valhalla/valhalla#2226](https://github.com/valhalla/valhalla/pull/2226))
* Fixed an issue where spoken and visual instructions sometimes omitted the cardinal direction after a route number in the United States. ([valhalla/valhalla#1917](https://github.com/valhalla/valhalla/pull/1917))
* A spoken instruction about an exit ramp no longer specifies the side of the road if the ramp branches off the slow lane (on the right side in regions that drive on the right). ([valhalla/valhalla#1990](https://github.com/valhalla/valhalla/pull/1990))
* A spoken instruction about a `ManeuverType.takeOffRamp` maneuver no longer specifies the side of the road if the ramp branches off the slow lane (on the right side in regions that drive on the right). ([valhalla/valhalla#1990](https://github.com/valhalla/valhalla/pull/1990))
* Improved the timing of spoken instructions for `ManeuverType.takeOffRamp` maneuvers along high-speed roads. ([#2417](https://github.com/mapbox/mapbox-navigation-ios/pull/2417))
* Improved the timing of visual instructions when two maneuvers are spaced close together. ([#2417](https://github.com/mapbox/mapbox-navigation-ios/pull/2417))

### Feedback
* Updated `FeedbackType` enum to reflect new top level feedback categories and introduced new `FeedbackSubType`s to support a more granular feedback mechanism. ([#2419](https://github.com/mapbox/mapbox-navigation-ios/pull/2419))
Expand Down
4 changes: 2 additions & 2 deletions Cartfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
binary "https://www.mapbox.com/ios-sdk/MapboxAccounts.json" ~> 2.3
binary "https://www.mapbox.com/ios-sdk/MapboxAccounts.json" ~> 2.3.0
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we pin to a patch version like this? It means a future minor version would be incompatible unless we put out a new version that requires it. MapboxAccounts is post-v1.0, so I don’t think we have to be as concerned about backwards-incompatible changes creeping in.

binary "https://mapbox-gl-native-ios.s3.amazonaws.com/public/internal/Mapbox-iOS-SDK.json" == 5.9.1000
binary "https://www.mapbox.com/ios-sdk/MapboxNavigationNative.json" ~> 9.2.1
binary "https://www.mapbox.com/ios-sdk/MapboxNavigationNative.json" ~> 14.1.5
github "mapbox/mapbox-directions-swift" ~> 0.32
github "mapbox/turf-swift" ~> 0.5
github "mapbox/mapbox-events-ios" ~> 0.10
Expand Down
2 changes: 1 addition & 1 deletion Cartfile.resolved
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
binary "https://mapbox-gl-native-ios.s3.amazonaws.com/public/internal/Mapbox-iOS-SDK.json" "5.9.1000"
binary "https://www.mapbox.com/ios-sdk/MapboxAccounts.json" "2.3.0"
binary "https://www.mapbox.com/ios-sdk/MapboxNavigationNative.json" "9.2.1"
binary "https://www.mapbox.com/ios-sdk/MapboxNavigationNative.json" "14.1.5"
github "CedarBDD/Cedar" "v1.0"
github "Quick/Nimble" "v8.1.1"
github "Quick/Quick" "v2.2.1"
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", "~> 9.2.1"
s.dependency "MapboxNavigationNative", "~> 14.1.5"
s.dependency "MapboxAccounts", "~> 2.3.0"
s.dependency "MapboxDirections", "~> 0.32.0"
s.dependency "MapboxMobileEvents", "~> 0.10.2" # Always pin to a patch release if pre-1.0
Expand Down
30 changes: 23 additions & 7 deletions MapboxCoreNavigation/CLLocation.swift
Original file line number Diff line number Diff line change
Expand Up @@ -21,19 +21,35 @@ extension CLLocation {
locationDictionary["timestamp"] = timestamp.ISO8601
locationDictionary["horizontalAccuracy"] = horizontalAccuracy
locationDictionary["verticalAccuracy"] = verticalAccuracy
if #available(iOS 13.4, *) {
locationDictionary["courseAccuracy"] = courseAccuracy
}
locationDictionary["course"] = course
locationDictionary["speed"] = speed
locationDictionary["speedAccuracy"] = speedAccuracy
return locationDictionary
}

convenience init(_ location: FixLocation) {
self.init(coordinate: location.coordinate,
altitude: location.altitude?.doubleValue ?? 0,
horizontalAccuracy: location.accuracyHorizontal?.doubleValue ?? -1,
verticalAccuracy: 0,
course: location.bearing?.doubleValue ?? -1,
speed: location.speed?.doubleValue ?? -1,
timestamp: location.time)
if #available(iOS 13.4, *) {
self.init(coordinate: location.coordinate,
altitude: location.altitude?.doubleValue ?? 0,
horizontalAccuracy: location.accuracyHorizontal?.doubleValue ?? -1,
verticalAccuracy: location.verticalAccuracy?.doubleValue ?? -1,
course: location.bearing?.doubleValue ?? -1,
courseAccuracy: location.bearingAccuracy?.doubleValue ?? -1,
speed: location.speed?.doubleValue ?? -1,
speedAccuracy: location.speedAccuracy?.doubleValue ?? -1,
timestamp: location.time)
} else {
self.init(coordinate: location.coordinate,
altitude: location.altitude?.doubleValue ?? 0,
horizontalAccuracy: location.accuracyHorizontal?.doubleValue ?? -1,
verticalAccuracy: location.verticalAccuracy?.doubleValue ?? -1,
course: location.bearing?.doubleValue ?? -1,
speed: location.speed?.doubleValue ?? -1,
timestamp: location.time)
}
}

/**
Expand Down
10 changes: 9 additions & 1 deletion MapboxCoreNavigation/FixLocation.swift
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,20 @@ import MapboxNavigationNative

extension FixLocation {
convenience init(_ location: CLLocation) {
var bearingAccuracy: NSNumber? = nil
if #available(iOS 13.4, *) {
bearingAccuracy = location.courseAccuracy >= 0 ? location.courseAccuracy as NSNumber : nil
}

self.init(coordinate: location.coordinate,
time: location.timestamp,
speed: location.speed >= 0 ? location.speed as NSNumber : nil,
bearing: location.course >= 0 ? location.course as NSNumber : nil,
altitude: location.altitude as NSNumber,
accuracyHorizontal: location.horizontalAccuracy >= 0 ? location.horizontalAccuracy as NSNumber : nil,
provider: nil)
provider: nil,
bearingAccuracy: bearingAccuracy,
speedAccuracy: location.speedAccuracy >= 0 ? location.speedAccuracy as NSNumber : nil,
verticalAccuracy: location.verticalAccuracy >= 0 ? location.verticalAccuracy as NSNumber : nil)
}
}
13 changes: 10 additions & 3 deletions MapboxCoreNavigation/OfflineDirections.swift
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ public class NavigationDirections: Directions {
public func configureRouter(tilesURL: URL, completionHandler: @escaping NavigationDirectionsCompletionHandler) {
NavigationDirectionsConstants.offlineSerialQueue.sync {
let params = RouterParams(tilesPath: tilesURL.path, inMemoryTileCache: nil, mapMatchingSpatialCache: nil, threadsCount: nil, endpointConfig: nil)
let tileCount = self.navigator.configureRouter(for: params, httpInterface: nil)
let tileCount = self.navigator.configureRouter(for: params)
DispatchQueue.main.async {
completionHandler(tileCount)
}
Expand Down Expand Up @@ -152,7 +152,12 @@ public class NavigationDirections: Directions {
let tilePath = filePathURL.path
let outputPath = outputDirectoryURL.path

let numberOfTiles = Navigator().unpackTiles(forPackedTilesPath: tilePath, outputDirectory: outputPath)
let navigator: Navigator = {
let settingsProfile = SettingsProfile(application: ProfileApplication.kMobile,
platform: ProfilePlatform.KIOS)
return Navigator(profile: settingsProfile, customConfig: "")
}()
Comment on lines +155 to +159
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we use self.navigator here instead of initializing a new one?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In this place navigator is used in static context, probably better to leave it as it is.

let numberOfTiles = navigator.unpackTiles(forPackedTilesPath: tilePath, outputDirectory: outputPath)

// Report 100% progress
progressHandler?(totalPackedBytes, totalPackedBytes)
Expand Down Expand Up @@ -235,7 +240,9 @@ public class NavigationDirections: Directions {
"The offline navigator must be accessed from the dedicated serial queue")

if _navigator == nil {
self._navigator = Navigator()
let settingsProfile = SettingsProfile(application: ProfileApplication.kMobile,
platform: ProfilePlatform.KIOS)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lovely C++→Objective-C→Swift translation there. 😁

self._navigator = Navigator(profile: settingsProfile, customConfig: "")
}

return _navigator
Expand Down
15 changes: 8 additions & 7 deletions MapboxCoreNavigation/RouteController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,12 @@ open class RouteController: NSObject {
public static let shouldPreventReroutesWhenArrivingAtWaypoint: Bool = true
public static let shouldDisableBatteryMonitoring: Bool = true
}

let navigator = Navigator()

lazy var navigator: Navigator = {
let settingsProfile = SettingsProfile(application: ProfileApplication.kMobile,
platform: ProfilePlatform.KIOS)
return Navigator(profile: settingsProfile, customConfig: "")
}()

public var route: Route {
get {
Expand Down Expand Up @@ -316,7 +320,7 @@ open class RouteController: NSObject {
NotificationUserInfoKey.routeProgressKey: progress,
NotificationUserInfoKey.locationKey: location, //guaranteed value
NotificationUserInfoKey.rawLocationKey: rawLocation, //raw
])
])
}
}

Expand Down Expand Up @@ -387,7 +391,7 @@ extension RouteController: Router {
}

let status = status ?? navigator.getStatusForTimestamp(location.timestamp)
let offRoute = status.routeState == .offRoute
let offRoute = status.routeState == .offRoute || status.routeState == .invalid
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As per discussion with @SiarheiFedartsou in Slack, for now it's better to treat invalid state as offRoute.

return !offRoute
}

Expand Down Expand Up @@ -431,9 +435,6 @@ extension RouteController: Router {
])
return
}



}
}
}
Expand Down
Loading