Skip to content
3 changes: 3 additions & 0 deletions changelog/unreleased/bugfixes/7137.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
- Improved quality of continuous alternatives, now the mechanism respects routes from current navigation session.
- Improved EV offline navigation, now it fallbacks to a regular onboard routing.
- Improved location simulation when DR ends, i.e. when a driver leaves a tunnel.
6 changes: 3 additions & 3 deletions gradle/dependencies.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,15 @@ ext {
// version which we should use in this build
def mapboxNavigatorVersion = System.getenv("FORCE_MAPBOX_NAVIGATION_NATIVE_VERSION")
if (mapboxNavigatorVersion == null || mapboxNavigatorVersion == '') {
mapboxNavigatorVersion = '131.0.0'
mapboxNavigatorVersion = '132.0.0'
}
println("Navigation Native version: " + mapboxNavigatorVersion)

version = [
mapboxMapSdk : '10.13.0-beta.1',
mapboxMapSdk : '10.13.0-rc.1',
mapboxSdkServices : '6.11.0',
mapboxNavigator : "${mapboxNavigatorVersion}",
mapboxCommonNative : '23.5.0-beta.1',
mapboxCommonNative : '23.5.0-rc.1',
mapboxCrashMonitor : '2.0.0',
mapboxAnnotationPlugin : '0.8.0',
mapboxBaseAndroid : '0.8.0',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,14 @@ object RoadObjectFactory {
List<UpcomingRoadObject> {
return this
.filter { SUPPORTED_ROAD_OBJECTS.contains(it.roadObject.type) }
.map {
buildUpcomingRoadObject(
buildRoadObject(it.roadObject),
it.distanceToStart,
null
)
.mapNotNull { upcomingRouteAlert ->
buildRoadObject(upcomingRouteAlert.roadObject)?.let { roadObject ->
buildUpcomingRoadObject(
roadObject,
upcomingRouteAlert.distanceToStart,
null
)
}
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -276,6 +276,7 @@ internal fun RoadObjectType.mapToRoadObjectType(): Int {
RoadObjectType.RAILWAY_CROSSING -> SDKRoadObjectType.RAILWAY_CROSSING
RoadObjectType.IC -> SDKRoadObjectType.IC
RoadObjectType.JCT -> SDKRoadObjectType.JCT
RoadObjectType.NOTIFICATION -> SDKRoadObjectType.NOTIFICATION
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ internal typealias SDKTunnelInfo =
internal typealias SDKRailwayCrossingInfo =
com.mapbox.navigation.base.trip.model.roadobject.railwaycrossing.RailwayCrossingInfo

internal fun com.mapbox.navigator.RoadObject.mapToRoadObject(): RoadObject {
internal fun com.mapbox.navigator.RoadObject.mapToRoadObject(): RoadObject? {
val provider = provider.mapToRoadObjectProvider()
return when (type) {
RoadObjectType.INCIDENT ->
Expand Down Expand Up @@ -145,6 +145,7 @@ internal fun com.mapbox.navigator.RoadObject.mapToRoadObject(): RoadObject {
isUrban,
this,
)
RoadObjectType.NOTIFICATION -> null
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,11 @@ object RoadObjectType {
*/
const val JCT = 10

/**
* Not finished yet, see https://mapbox.atlassian.net/browse/NAVAND-1311
*/
internal const val NOTIFICATION = 11
Comment on lines +78 to +81
Copy link
Contributor Author

Choose a reason for hiding this comment

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

@dzinad , @averkhaturau , as I know the notification feature isn't stable on server side and the API may change. Do I understand correctly that current implementation in NN works for current design and just stop working in case of changes on server side without crashes?

Copy link
Contributor

Choose a reason for hiding this comment

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


/**
* Retention policy for the RoadObjectType
*/
Expand All @@ -91,6 +96,7 @@ object RoadObjectType {
RAILWAY_CROSSING,
IC,
JCT,
NOTIFICATION
)
annotation class Type
}
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ import com.mapbox.navigator.match.openlr.Standard
import io.mockk.mockk
import org.junit.Assert.assertEquals
import org.junit.Assert.assertNotNull
import org.junit.Assert.assertNull
import org.junit.Assert.assertTrue
import org.junit.Test
import java.util.Date
Expand Down Expand Up @@ -68,7 +69,7 @@ class RoadObjectFactoryTest {
nativeObject
)

val roadObject = RoadObjectFactory.buildRoadObject(nativeObject)
val roadObject = RoadObjectFactory.buildRoadObject(nativeObject)!!

assertEquals(expected, roadObject)
assertEquals(expected.hashCode(), roadObject.hashCode())
Expand All @@ -92,7 +93,7 @@ class RoadObjectFactoryTest {
nativeObject
)

val roadObject = RoadObjectFactory.buildRoadObject(nativeObject)
val roadObject = RoadObjectFactory.buildRoadObject(nativeObject)!!

assertEquals(expected, roadObject)
assertEquals(expected.hashCode(), roadObject.hashCode())
Expand Down Expand Up @@ -219,7 +220,7 @@ class RoadObjectFactoryTest {
nativeObject
)

val roadObject = RoadObjectFactory.buildRoadObject(nativeObject)
val roadObject = RoadObjectFactory.buildRoadObject(nativeObject)!!

assertEquals(expected, roadObject)
assertEquals(expected.hashCode(), roadObject.hashCode())
Expand Down Expand Up @@ -285,14 +286,23 @@ class RoadObjectFactoryTest {
nativeObject
)

val roadObject = RoadObjectFactory.buildRoadObject(nativeObject)
val roadObject = RoadObjectFactory.buildRoadObject(nativeObject)!!

assertEquals(expected, roadObject)
assertEquals(expected.hashCode(), roadObject.hashCode())
assertEquals(expected.toString(), roadObject.toString())
assertEquals(RoadObjectType.RAILWAY_CROSSING, roadObject.objectType)
}

@Test
fun `buildRoadObject - unsupported notification`() {
val nativeObject = notification

val roadObject = RoadObjectFactory.buildRoadObject(nativeObject)

assertNull(roadObject)
}

@Test
fun `toUpcomingRoadObjects - should map native to SDK UpcomingRoadObjects`() {
val nativeObjects: List<com.mapbox.navigator.UpcomingRouteAlert> = listOf(
Expand All @@ -306,14 +316,18 @@ class RoadObjectFactoryTest {
incident,
railwayCrossing,
ic,
jct
jct,
notification
).mapIndexed { distanceToStart, roadObject ->
UpcomingRouteAlert(roadObject, distanceToStart.toDouble())
}
// notification object isn't supported yet,
// see https://mapbox.atlassian.net/browse/NAVAND-1311
val unsupportedObjectsCount = 1

val sdkObjects = nativeObjects.toUpcomingRoadObjects()

assertEquals(nativeObjects.size, sdkObjects.size)
assertEquals(nativeObjects.size - unsupportedObjectsCount, sdkObjects.size)
assertTrue(sdkObjects[0].roadObject is Tunnel)
assertTrue(sdkObjects[1].roadObject is CountryBorderCrossing)
assertTrue(sdkObjects[2].roadObject is TollCollection)
Expand All @@ -325,7 +339,7 @@ class RoadObjectFactoryTest {
assertTrue(sdkObjects[8].roadObject is RailwayCrossing)
assertTrue(sdkObjects[9].roadObject is Interchange)
assertTrue(sdkObjects[10].roadObject is Junction)
sdkObjects.forEachIndexed { distanceToStart, obj ->
sdkObjects.dropLast(unsupportedObjectsCount).forEachIndexed { distanceToStart, obj ->
assertEquals(distanceToStart.toDouble(), obj.distanceToStart)
}
}
Expand Down Expand Up @@ -495,6 +509,11 @@ class RoadObjectFactoryTest {
location = matchedRoadObjectLocation(location.shape),
)

private val notification = createRoadObject(
type = com.mapbox.navigator.RoadObjectType.NOTIFICATION,
location = matchedRoadObjectLocation(location.shape)
)

private fun createRoadObject(
type: com.mapbox.navigator.RoadObjectType,
location: MatchedRoadObjectLocation,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,18 +56,18 @@ class RoadObjectMatcher internal constructor(
override fun onRoadObjectMatched(
roadObject: Expected<RoadObjectMatcherError, RoadObject>
) {
val result: Expected<SDKRoadObjectMatcherError, SDKRoadObject> =
val result: Expected<SDKRoadObjectMatcherError, SDKRoadObject>? =
if (roadObject.isValue) {
ExpectedFactory.createValue(
RoadObjectFactory.buildRoadObject(roadObject.value!!)
)
RoadObjectFactory.buildRoadObject(roadObject.value!!)?.let {
ExpectedFactory.createValue(it)
}
} else {
ExpectedFactory.createError(
RoadObjectFactory.buildRoadObjectMatchingError(roadObject.error!!)
)
}

notifyMatchingObservers(result)
result?.let(::notifyMatchingObservers)
}

override fun onMatchingCancelled(id: String) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,14 @@ package com.mapbox.navigation.testing.factories
import com.mapbox.api.directions.v5.models.StepManeuver
import com.mapbox.geojson.Point
import com.mapbox.navigator.ActiveGuidanceInfo
import com.mapbox.navigator.AlternativeRouteInfo
import com.mapbox.navigator.BannerInstruction
import com.mapbox.navigator.BannerSection
import com.mapbox.navigator.FixLocation
import com.mapbox.navigator.MapMatcherOutput
import com.mapbox.navigator.NavigationStatus
import com.mapbox.navigator.RoadName
import com.mapbox.navigator.RouteIndices
import com.mapbox.navigator.RouteInfo
import com.mapbox.navigator.RouteInterface
import com.mapbox.navigator.RouteState
Expand Down Expand Up @@ -50,6 +52,7 @@ fun createNavigationStatus(
upcomingRouteAlertUpdates: List<UpcomingRouteAlertUpdate> = emptyList(),
nextWaypointIndex: Int = 0,
layer: Int = 0,
alternativeRouteIndices: List<RouteIndices> = emptyList()
): NavigationStatus {
return NavigationStatus(
routeState,
Expand All @@ -65,6 +68,7 @@ fun createNavigationStatus(
geometryIndex,
shapeIndex,
intersectionIndex,
alternativeRouteIndices,
roads,
voiceInstruction,
bannerInstruction,
Expand Down