Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
116 changes: 91 additions & 25 deletions LICENSE.md

Large diffs are not rendered by default.

14 changes: 14 additions & 0 deletions changelog/unreleased/features/6833.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
- Added `RoadComponent.language` value.
- :warning: Changed `EHorizonEdgeMetadata.names` class from `RoadName` to `RoadComponent`.
Comment on lines +1 to +2

Choose a reason for hiding this comment

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

Suggested change
- Added `RoadComponent.language` value.
- :warning: Changed `EHorizonEdgeMetadata.names` class from `RoadName` to `RoadComponent`.
- :warning: Changed `EHorizonEdgeMetadata.names` class from `RoadName` to `RoadComponent`.
- Added `RoadComponent.language` value.

nit, this way it will be easier to read.

Choose a reason for hiding this comment

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

I see we're done with CI, in this case we can skip this. We can always address when composing final changelog.

To migrate change your code from:
```kotlin
val shielded = roadName.shielded
```
into:
```kotlin
val shielded = roadComponent.shield != null
```
- Added support for continuous EV alternatives in `NavigationRouteAlternativesObserver`.
- Fixed issues with map-matching to HOV-only roads.
- Set a limit of simultaneously running onboard route requests to avoid too many tasks blocking too much of the device's computing resources.
- Fixed an issue with Road Access Policy ignoring the setting to map-match to closed road sections, when enabled.
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 = '123.2.0'
mapboxNavigatorVersion = '124.0.1'
}
println("Navigation Native version: " + mapboxNavigatorVersion)

version = [
mapboxMapSdk : '10.10.0',
mapboxMapSdk : '10.11.0-beta.1',
mapboxSdkServices : '6.10.0',
mapboxNavigator : "${mapboxNavigatorVersion}",
mapboxCommonNative : '23.2.1',
mapboxCommonNative : '23.3.0-beta.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 @@ -53,7 +53,7 @@ class WaypointsTest : BaseTest<EmptyTestActivity>(EmptyTestActivity::class.java)
)

private lateinit var mapboxNavigation: MapboxNavigation
private val tolerance = 0.00001
private val tolerance = 0.0001
private val expectedEvWaypointsNamesAndLocations = listOf(
"Leopoldstraße" to ApproximateCoordinates(48.176099, 11.585226, tolerance),
"" to ApproximateCoordinates(48.39023, 11.063842, tolerance),
Expand Down
13 changes: 4 additions & 9 deletions libnavigation-base/api/current.txt
Original file line number Diff line number Diff line change
Expand Up @@ -615,9 +615,11 @@ package com.mapbox.navigation.base.road.model {

public final class RoadComponent {
method public String? getImageBaseUrl();
method public String getLanguage();
method public com.mapbox.api.directions.v5.models.MapboxShield? getShield();
method public String getText();
property public final String? imageBaseUrl;
property public final String language;
property public final com.mapbox.api.directions.v5.models.MapboxShield? shield;
property public final String text;
}
Expand Down Expand Up @@ -1020,7 +1022,7 @@ package com.mapbox.navigation.base.trip.model.eh {
method public double getLength();
method public Double? getMeanElevation();
method public boolean getMotorway();
method public java.util.List<com.mapbox.navigation.base.trip.model.eh.RoadName> getNames();
method public java.util.List<com.mapbox.navigation.base.road.model.RoadComponent> getNames();
method public boolean getRamp();
method public String getRoadSurface();
method public double getSpeed();
Expand All @@ -1044,7 +1046,7 @@ package com.mapbox.navigation.base.trip.model.eh {
property public final double length;
property public final Double? meanElevation;
property public final boolean motorway;
property public final java.util.List<com.mapbox.navigation.base.trip.model.eh.RoadName> names;
property public final java.util.List<com.mapbox.navigation.base.road.model.RoadComponent> names;
property public final boolean ramp;
property public final String roadSurface;
property public final double speed;
Expand Down Expand Up @@ -1156,13 +1158,6 @@ package com.mapbox.navigation.base.trip.model.eh {
@StringDef({com.mapbox.navigation.base.trip.model.eh.RoadClass.MOTORWAY, com.mapbox.navigation.base.trip.model.eh.RoadClass.TRUNK, com.mapbox.navigation.base.trip.model.eh.RoadClass.PRIMARY, com.mapbox.navigation.base.trip.model.eh.RoadClass.SECONDARY, com.mapbox.navigation.base.trip.model.eh.RoadClass.TERTIARY, com.mapbox.navigation.base.trip.model.eh.RoadClass.UNCLASSIFIED, com.mapbox.navigation.base.trip.model.eh.RoadClass.RESIDENTIAL, com.mapbox.navigation.base.trip.model.eh.RoadClass.SERVICE_OTHER}) @kotlin.annotation.Retention(kotlin.annotation.AnnotationRetention.BINARY) public static @interface RoadClass.Type {
}

public final class RoadName {
method public String getName();
method public boolean getShielded();
property public final String name;
property public final boolean shielded;
}

Comment on lines -1159 to -1165
Copy link
Contributor

Choose a reason for hiding this comment

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

Are we fine with these breaking changes?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

it's EHorizon only, and it's in beta, so I think we are ok
cc @LukasPaczos @Guardiola31337

Copy link
Contributor

Choose a reason for hiding this comment

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

It's not experimental. I don't think it's OK.

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 we don't have @Experimental annotations for EHorizon classes, but all of them have the next comment

* **NOTE**: The Mapbox Electronic Horizon feature of the Mapbox Navigation SDK is in public beta
 * and is subject to changes, including its pricing.

Copy link
Contributor

Choose a reason for hiding this comment

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

Alright then. We should have added the annotation.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

public final class RoadSurface {
field public static final String COMPACTED = "COMPACTED";
field public static final String DIRT = "DIRT";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ object RoadFactory {
text = road.text,
shield = road.shield.toMapboxShield(),
imageBaseUrl = road.imageBaseUrl,
language = road.language,
)
}
return Road(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,19 @@ import com.mapbox.api.directions.v5.models.MapboxShield

/**
* Object that holds road components
* @property text of the road
* @property text contains the current road name user is on, based on the [language] available.
* In certain situations there can be [RoadComponent] that contain [text] as `/` separator.
* The purpose of these separators is to separate the current road name in cases they have a primary
* and secondary name. If you are using [MapboxRoadNameView], then these separators are used to
* separate these names. However if you don't want to use them, you are can directly get access to
* [RoadComponent] from [LocationMatcherResult] and filter the names without `/` separators.
* @property language 2 letters language code or "Unspecified" or empty string
* @property shield mapbox designed shield if available otherwise null
* @property imageBaseUrl url for the route shield if available otherwise null
*/
class RoadComponent internal constructor(
val text: String,
val language: String,
val shield: MapboxShield? = null,
val imageBaseUrl: String? = null
) {
Expand All @@ -23,6 +30,7 @@ class RoadComponent internal constructor(
other as RoadComponent

if (text != other.text) return false
if (language != other.language) return false
if (shield != other.shield) return false
if (imageBaseUrl != other.imageBaseUrl) return false

Expand All @@ -34,6 +42,7 @@ class RoadComponent internal constructor(
*/
override fun hashCode(): Int {
var result = text.hashCode()
result = 31 * result + language.hashCode()
result = 31 * result + (shield?.hashCode() ?: 0)
result = 31 * result + (imageBaseUrl?.hashCode() ?: 0)
return result
Expand All @@ -43,6 +52,11 @@ class RoadComponent internal constructor(
* Returns a string representation of the object.
*/
override fun toString(): String {
return "RoadComponent(text='$text', shield=$shield, imageBaseUrl=$imageBaseUrl)"
return "RoadComponent(" +
"text='$text', " +
"language='$language', " +
"shield=$shield, " +
"imageBaseUrl=$imageBaseUrl" +
")"
}
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
package com.mapbox.navigation.base.trip.model.eh

import com.mapbox.navigation.base.road.model.RoadComponent

/**
* Edge metadata
*
Expand Down Expand Up @@ -45,7 +47,7 @@ class EHorizonEdgeMetadata internal constructor(
val bridge: Boolean,
val tunnel: Boolean,
val toll: Boolean,
val names: List<RoadName>,
val names: List<RoadComponent>,
val laneCount: Byte?,
val meanElevation: Double?,
val curvature: Byte,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
package com.mapbox.navigation.base.trip.model.eh

import com.mapbox.navigation.base.internal.extensions.toMapboxShield
import com.mapbox.navigation.base.road.model.RoadComponent
import com.mapbox.navigation.base.trip.model.roadobject.RoadObjectPosition
import com.mapbox.navigation.base.trip.model.roadobject.distanceinfo.GantryDistanceInfo
import com.mapbox.navigation.base.trip.model.roadobject.distanceinfo.Gate
Expand Down Expand Up @@ -408,18 +410,20 @@ private fun FunctionalRoadClass.mapToRoadClass(): String {
}
}

private fun mapNames(names: List<com.mapbox.navigator.RoadName>): List<RoadName> {
val namesNames = mutableListOf<RoadName>()
private fun mapNames(names: List<com.mapbox.navigator.RoadName>): List<RoadComponent> {
val roadComponents = mutableListOf<RoadComponent>()
names.forEach {
namesNames.add(it.mapToRoadName())
roadComponents.add(it.mapToRoadComponent())
}
return namesNames.toList()
return roadComponents.toList()
}

private fun com.mapbox.navigator.RoadName.mapToRoadName(): RoadName {
return RoadName(
name,
shielded
private fun com.mapbox.navigator.RoadName.mapToRoadComponent(): RoadComponent {
return RoadComponent(
text,
language,
shield.toMapboxShield(),
imageBaseUrl,
)
}

Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,9 @@ class RoadFactoryTest {

private fun createNavigationStatus(): NavigationStatus = mockk {
every { roads } returns listOf(
com.mapbox.navigator.Road(
com.mapbox.navigator.RoadName(
"roadName1",
"en",
"legacyUrl1",
com.mapbox.navigator.Shield(
"designUrl",
Expand All @@ -54,8 +55,9 @@ class RoadFactoryTest {
"color"
)
),
com.mapbox.navigator.Road(
com.mapbox.navigator.RoadName(
"roadName2",
"en",
null,
null
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ class NavigatorMapperTest {
private val route: NavigationRoute = mockk(relaxed = true) {
every { directionsRoute } returns this@NavigatorMapperTest.directionsRoute
}
private val roadName = com.mapbox.navigator.RoadName("Central Av", "en", null, null)

@OptIn(ExperimentalMapboxNavigationAPI::class)
@Test
Expand Down Expand Up @@ -128,7 +129,7 @@ class NavigatorMapperTest {
)
}
every { layer } returns null
every { roads } returns listOf(com.mapbox.navigator.Road("Central Av", null, null))
every { roads } returns listOf(roadName)
every { isFallback } returns false
every { inTunnel } returns false
}
Expand Down Expand Up @@ -174,7 +175,7 @@ class NavigatorMapperTest {
)
}
every { layer } returns null
every { roads } returns listOf(com.mapbox.navigator.Road("Central Av", null, null))
every { roads } returns listOf(roadName)
every { isFallback } returns false
every { inTunnel } returns false
}
Expand Down Expand Up @@ -220,7 +221,7 @@ class NavigatorMapperTest {
)
}
every { layer } returns null
every { roads } returns listOf(com.mapbox.navigator.Road("Central Av", null, null))
every { roads } returns listOf(roadName)
every { isFallback } returns true
every { inTunnel } returns false
}
Expand Down Expand Up @@ -266,7 +267,7 @@ class NavigatorMapperTest {
)
}
every { layer } returns null
every { roads } returns listOf(com.mapbox.navigator.Road("Central Av", null, null))
every { roads } returns listOf(roadName)
every { isFallback } returns false
every { inTunnel } returns false
}
Expand Down Expand Up @@ -305,7 +306,7 @@ class NavigatorMapperTest {
every { matches } returns listOf()
}
every { layer } returns null
every { roads } returns listOf(com.mapbox.navigator.Road("Central Av", null, null))
every { roads } returns listOf(roadName)
every { isFallback } returns false
every { inTunnel } returns false
}
Expand Down Expand Up @@ -355,7 +356,7 @@ class NavigatorMapperTest {
)
}
every { layer } returns 2
every { roads } returns listOf(com.mapbox.navigator.Road("Central Av", null, null))
every { roads } returns listOf(roadName)
every { isFallback } returns false
every { inTunnel } returns false
}
Expand Down Expand Up @@ -401,7 +402,7 @@ class NavigatorMapperTest {
)
}
every { layer } returns null
every { roads } returns listOf(com.mapbox.navigator.Road("Central Av", null, null))
every { roads } returns listOf(roadName)
every { isFallback } returns false
every { inTunnel } returns true
}
Expand Down Expand Up @@ -608,7 +609,7 @@ class NavigatorMapperTest {
every { voiceInstruction } returns nativeVoiceInstructions
every { inTunnel } returns true
every { upcomingRouteAlerts } returns emptyList()
every { roads } returns listOf(com.mapbox.navigator.Road("Central Av", null, null))
every { roads } returns listOf(roadName)
every { locatedAlternativeRouteId } returns "alternative_id"
every { geometryIndex } returns routeGeometryIndex
every { shapeIndex } returns legGeometryIndex
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1419,12 +1419,14 @@ class MapboxNavigationTelemetryTest {
every { telephonyManager.dataNetworkType } returns 5
every { telephonyManager.networkType } returns 6

val activityManager = mockk<ActivityManager>()
val activityManager = mockk<ActivityManager> {
every { runningAppProcesses } returns listOf()
every { getRunningTasks(any()) } returns listOf()
every { getRunningServices(any()) } returns listOf()
}
every {
applicationContext.getSystemService(Context.ACTIVITY_SERVICE)
} returns activityManager
every { activityManager.runningAppProcesses } returns listOf()
every { activityManager.getRunningTasks(any()) } returns listOf()
}

private fun initTelemetry() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ import com.mapbox.maps.Style
import com.mapbox.maps.StyleObjectInfo
import com.mapbox.maps.extension.style.layers.properties.generated.IconAnchor
import com.mapbox.maps.extension.style.layers.properties.generated.IconPitchAlignment
import com.mapbox.maps.extension.style.sources.generated.GeoJsonSource
import com.mapbox.maps.plugin.locationcomponent.LocationComponentConstants
import com.mapbox.navigation.base.ExperimentalPreviewMapboxNavigationAPI
import com.mapbox.navigation.base.route.NavigationRoute
Expand Down Expand Up @@ -58,7 +57,6 @@ import com.mapbox.navigation.ui.maps.route.line.model.RouteLineColorResources
import com.mapbox.navigation.ui.maps.testing.TestingUtil.loadNavigationRoute
import io.mockk.every
import io.mockk.mockk
import io.mockk.mockkObject
import io.mockk.mockkStatic
import io.mockk.slot
import io.mockk.unmockkAll
Expand Down Expand Up @@ -93,8 +91,6 @@ class MapboxRouteLineUtilsRoboTest {
@OptIn(ExperimentalPreviewMapboxNavigationAPI::class)
@Test
fun initializeLayers() {
mockkObject(GeoJsonSource)
every { GeoJsonSource.directSetterEnabled() } returns false
mockkStatic("com.mapbox.maps.extension.style.layers.LayerUtils")
val options = MapboxRouteLineOptions.Builder(ctx)
.withRouteLineBelowLayerId(LocationComponentConstants.MODEL_LAYER)
Expand Down
Loading