Skip to content

Commit

Permalink
Follow up from #2452 (#2458)
Browse files Browse the repository at this point in the history
* make configure router http interface parameter nullable

* add nn uncertain route state

* expose nn cache last route api in mapbox navigator

* remove lat long workaround not needed anymore as nn master-SNAPSHOT-0 includes the fix

* bump mapbox-navigation-native version to ms-bearing-from-shape-on-interpolation-SNAPSHOT-2
  • Loading branch information
Guardiola31337 authored Feb 11, 2020
1 parent 3ab6921 commit 0c2d15f
Show file tree
Hide file tree
Showing 7 changed files with 17 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -127,14 +127,7 @@ class SimpleMapboxNavigationKt : AppCompatActivity(), OnMapReadyCallback {
keyPoints: List<Location>
) {
if (keyPoints.isNotEmpty()) {
locationComponent?.forceLocationUpdate(keyPoints.map {
// workaround for https://github.com/mapbox/mapbox-location-native/pull/65#discussion_r375777857
val lat = it.latitude
val lon = it.longitude
it.latitude = lon
it.longitude = lat
it
}, true)
locationComponent?.forceLocationUpdate(keyPoints, true)
} else {
locationComponent?.forceLocationUpdate(enhancedLocation)
}
Expand Down
2 changes: 1 addition & 1 deletion gradle/dependencies.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ ext {
mapboxSdkDirectionsModels : '5.1.0-beta.1',
mapboxEvents : '4.5.1',
mapboxCore : '1.3.0',
mapboxNavigator : 'sf-keypoints-SNAPSHOT-8',
mapboxNavigator : 'ms-bearing-from-shape-on-interpolation-SNAPSHOT-2',
mapboxCrashMonitor : '2.0.0',
mapboxAnnotationPlugin : '0.7.0',
mapboxAccounts : '0.3.1',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,5 +37,7 @@ enum class RouteProgressState {
* A lack of [android.location.Location] updates from the phone has caused lack of confidence in the
* progress updates being sent.
*/
LOCATION_STALE
LOCATION_STALE,

ROUTE_UNCERTAIN
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ class RouteProgressStateMap : HashMap<RouteState, RouteProgressState?>() {
put(RouteState.COMPLETE, RouteProgressState.ROUTE_ARRIVED)
put(RouteState.TRACKING, RouteProgressState.LOCATION_TRACKING)
put(RouteState.STALE, RouteProgressState.LOCATION_STALE)
put(RouteState.UNCERTAIN, RouteProgressState.ROUTE_UNCERTAIN)
put(RouteState.OFFROUTE, null) // Ignore off-route (info already provided via listener)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,6 @@ enum class RouteProgressState {
ROUTE_INITIALIZED,
ROUTE_ARRIVED,
LOCATION_TRACKING,
LOCATION_STALE
LOCATION_STALE,
ROUTE_UNCERTAIN
}
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,9 @@ interface MapboxNativeNavigator {

// Offline

fun configureRouter(routerParams: RouterParams, httpClient: HttpInterface): Long
fun cacheLastRoute()

fun configureRouter(routerParams: RouterParams, httpClient: HttpInterface?): Long
fun getRoute(url: String): RouterResult
fun unpackTiles(tarPath: String, destinationPath: String): Long
fun removeTiles(tilePath: String, southwest: Point, northeast: Point): Long
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,11 @@ object MapboxNativeNavigatorImpl : MapboxNativeNavigator {

// Offline

override fun configureRouter(routerParams: RouterParams, httpClient: HttpInterface): Long =
override fun cacheLastRoute() {
navigator.cacheLastRoute()
}

override fun configureRouter(routerParams: RouterParams, httpClient: HttpInterface?): Long =
navigator.configureRouter(routerParams, httpClient)

override fun getRoute(url: String): RouterResult = navigator.getRoute(url)
Expand Down Expand Up @@ -312,5 +316,6 @@ private fun RouteState.convertState(): RouteProgressState? {
RouteState.COMPLETE -> RouteProgressState.ROUTE_ARRIVED
RouteState.OFFROUTE -> null // send in a callback instead
RouteState.STALE -> RouteProgressState.LOCATION_STALE
RouteState.UNCERTAIN -> RouteProgressState.ROUTE_UNCERTAIN
}
}

0 comments on commit 0c2d15f

Please sign in to comment.