Skip to content

Commit

Permalink
Bump dependencies. Add IncidentInfo length (#7467)
Browse files Browse the repository at this point in the history
* Bump dependencies

* Add IncidentInfo.length

* Changelog

* Fix incident length format in test route response.
  • Loading branch information
DzmitryFomchyn authored Aug 18, 2023
1 parent 1716c56 commit 23e2c92
Show file tree
Hide file tree
Showing 9 changed files with 54,933 additions and 6 deletions.
1 change: 1 addition & 0 deletions changelog/unreleased/features/7467.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
- Added `IncidentInfo#length` property.
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 = '148.0.1'
mapboxNavigatorVersion = '155.0.0'
}
println("Navigation Native version: " + mapboxNavigatorVersion)

version = [
mapboxMapSdk : '10.15.0',
mapboxMapSdk : '10.16.0-beta.1',
mapboxSdkServices : '6.13.0',
mapboxNavigator : "${mapboxNavigatorVersion}",
mapboxCommonNative : '23.7.0',
mapboxCommonNative : '23.8.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 @@ -184,6 +184,29 @@ class UpcomingRouteObjectsTest : BaseCoreNoCleanUpTest() {
)
}

@Test
fun incidentLengthTest() = sdkTest {
mapboxNavigation = createMapboxNavigation()
mapboxNavigation.startTripSession()
val origin = Point.fromLngLat(137.52814, 34.837394)
stayOnPosition(origin)
setUpRoutes(
R.raw.route_with_length,
"137.5281542766699,34.83741480073306;137.53072840419628,34.83636637489471"
)

val upcomingIncidents = mapboxNavigation.routeProgressUpdates()
.first { it.navigationRoute.id.startsWith("route_with_length") }
.upcomingRoadObjects
.filter { it.roadObject.objectType == RoadObjectType.INCIDENT }
assertEquals(1, upcomingIncidents.size)
val incident = upcomingIncidents[0].roadObject as Incident
assertEquals(
1784,
incident.info.length
)
}

@Test
fun distanceToIncidentDoesNotChangeAfterAddingNewWaypointOnTheRouteGeometry() = sdkTest {
mapboxNavigation = createMapboxNavigation()
Expand Down
54,680 changes: 54,679 additions & 1 deletion instrumentation-tests/src/main/res/raw/route_with_duplicate_incidents.json

Large diffs are not rendered by default.

214 changes: 214 additions & 0 deletions instrumentation-tests/src/main/res/raw/route_with_length.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,214 @@
{
"routes": [
{
"weight_typical": 11.135,
"duration_typical": 11.421,
"weight_name": "auto",
"weight": 11.271,
"duration": 11.56,
"distance": 263.003,
"legs": [
{
"via_waypoints": [],
"admins": [
{
"iso_3166_1_alpha3": "JPN",
"iso_3166_1": "JP"
}
],
"incidents": [
{
"id": "8197267209395880",
"type": "construction",
"creation_time": "2023-07-27T15:45:00Z",
"start_time": "2023-07-27T15:45:00Z",
"end_time": "2023-07-27T16:00:00Z",
"iso_3166_1_alpha2": "JP",
"iso_3166_1_alpha3": "JPN",
"description": "1st driving lane restriction",
"sub_type": "construction",
"sub_type_description": "Construction",
"alertc_codes": [
449,
31
],
"traffic_codes": {
"jartic_cause_code": 449,
"jartic_regulation_code": 31
},
"lanes_blocked": [],
"length": 1784,
"south": 34.837169,
"west": 137.513519,
"north": 34.845829,
"east": 137.528656,
"congestion": {
"value": 101
},
"geometry_index_start": 0,
"geometry_index_end": 2,
"affected_road_names": [
"Tomei Expwy"
]
}
],
"weight_typical": 11.135,
"duration_typical": 11.421,
"weight": 11.271,
"duration": 11.56,
"steps": [
{
"voiceInstructions": [
{
"ssmlAnnouncement": "<speak><amazon:effect name=\"drc\"><prosody rate=\"1.08\">Drive southeast on <say-as interpret-as=\"address\">Tomei Expwy</say-as>. Then You will arrive at your destination.</prosody></amazon:effect></speak>",
"announcement": "Drive southeast on Tomei Expwy. Then You will arrive at your destination.",
"distanceAlongGeometry": 263.003
},
{
"ssmlAnnouncement": "<speak><amazon:effect name=\"drc\"><prosody rate=\"1.08\">You have arrived at your destination.</prosody></amazon:effect></speak>",
"announcement": "You have arrived at your destination.",
"distanceAlongGeometry": 118.056
}
],
"intersections": [
{
"classes": [
"toll",
"motorway"
],
"entry": [
true
],
"bearings": [
120
],
"duration": 8.98,
"mapbox_streets_v8": {
"class": "motorway"
},
"is_urban": false,
"admin_index": 0,
"out": 0,
"weight": 8.756,
"geometry_index": 0,
"location": [
137.52814,
34.837394
]
},
{
"bearings": [
119,
294
],
"entry": [
true,
false
],
"classes": [
"toll",
"motorway"
],
"in": 1,
"mapbox_streets_v8": {
"class": "motorway"
},
"is_urban": false,
"admin_index": 0,
"out": 0,
"geometry_index": 5,
"location": [
137.530165,
34.836621
]
}
],
"maneuver": {
"type": "depart",
"instruction": "Drive southeast on Tomei Expwy.",
"bearing_after": 120,
"bearing_before": 0,
"location": [
137.52814,
34.837394
]
},
"name": "Tomei Expwy",
"weight_typical": 11.135,
"duration_typical": 11.421,
"duration": 11.56,
"distance": 263.003,
"driving_side": "left",
"weight": 11.271,
"mode": "driving",
"geometry": "cxhmaAws`ieGxFoOfE{N|HiXrJk`@tKob@vNib@"
},
{
"voiceInstructions": [],
"intersections": [
{
"bearings": [
299
],
"entry": [
true
],
"in": 0,
"admin_index": 0,
"geometry_index": 6,
"location": [
137.53073,
34.836369
]
}
],
"maneuver": {
"type": "arrive",
"instruction": "You have arrived at your destination.",
"bearing_after": 0,
"bearing_before": 119,
"location": [
137.53073,
34.836369
]
},
"name": "Tomei Expwy",
"weight_typical": 0,
"duration_typical": 0,
"duration": 0,
"distance": 0,
"driving_side": "left",
"weight": 0,
"mode": "driving",
"geometry": "axfmaAsueieG??"
}
],
"distance": 263.003,
"summary": "Tomei Expwy"
}
],
"geometry": "cxhmaAws`ieGxFoOfE{N|HiXrJk`@tKob@vNib@",
"voiceLocale": "en-US"
}
],
"waypoints": [
{
"distance": 2.687,
"name": "E1",
"location": [
137.52814,
34.837394
]
},
{
"distance": 0.327,
"name": "E1",
"location": [
137.53073,
34.836369
]
}
],
"code": "Ok",
"uuid": "route_with_length"
}
2 changes: 2 additions & 0 deletions libnavigation-base/api/current.txt
Original file line number Diff line number Diff line change
Expand Up @@ -1503,6 +1503,7 @@ package com.mapbox.navigation.base.trip.model.roadobject.incident {
method public String getImpact();
method public java.util.List<java.lang.String> getLanesBlocked();
method public String? getLanesClearDesc();
method public Integer? getLength();
method public String? getLongDescription();
method public java.util.Map<java.lang.String,java.util.List<java.lang.String>> getMultilingualAffectedRoadNames();
method public Long? getNumLanesBlocked();
Expand All @@ -1525,6 +1526,7 @@ package com.mapbox.navigation.base.trip.model.roadobject.incident {
property public final boolean isClosed;
property public final java.util.List<java.lang.String> lanesBlocked;
property public final String? lanesClearDesc;
property public final Integer? length;
property public final String? longDescription;
property public final java.util.Map<java.lang.String,java.util.List<java.lang.String>> multilingualAffectedRoadNames;
property public final Long? numLanesBlocked;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -249,6 +249,7 @@ private fun IncidentInfo.toIncidentInfo() =
numLanesBlocked,
affectedRoadNames,
multiLingualAffectedRoadNames,
length,
)

private fun IncidentType.toIncidentType(): Int =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ import java.util.Date
* @param multilingualAffectedRoadNames affected road names in different languages.
* May contain affected road names from [affectedRoadNames] property in case language is known for them.
* Key is a ISO 639-1, 2 letter language code, value - the list of affected road names.
* @param length length of the incident in meters.
*/
class IncidentInfo internal constructor(
val id: String,
Expand All @@ -61,6 +62,7 @@ class IncidentInfo internal constructor(
val numLanesBlocked: Long?,
val affectedRoadNames: List<String>?,
val multilingualAffectedRoadNames: Map<String, List<String>>,
val length: Int?,
) {

/**
Expand Down Expand Up @@ -93,6 +95,7 @@ class IncidentInfo internal constructor(
if (numLanesBlocked != other.numLanesBlocked) return false
if (affectedRoadNames != other.affectedRoadNames) return false
if (multilingualAffectedRoadNames != other.multilingualAffectedRoadNames) return false
if (length != other.length) return false

return true
}
Expand Down Expand Up @@ -122,6 +125,7 @@ class IncidentInfo internal constructor(
result = 31 * result + numLanesBlocked.hashCode()
result = 31 * result + affectedRoadNames.hashCode()
result = 31 * result + multilingualAffectedRoadNames.hashCode()
result = 31 * result + length.hashCode()
return result
}

Expand Down Expand Up @@ -150,7 +154,8 @@ class IncidentInfo internal constructor(
"lanesClearDesc=$lanesClearDesc, " +
"numLanesBlocked=$numLanesBlocked, " +
"affectedRoadNames=$affectedRoadNames, " +
"multilingualAffectedRoadNames=$multilingualAffectedRoadNames" +
"multilingualAffectedRoadNames=$multilingualAffectedRoadNames, " +
"length=$length" +
")"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -270,7 +270,8 @@ class RoadObjectFactoryTest {
INCIDENT_AFFECTED_ROAD_NAME_JA1,
INCIDENT_AFFECTED_ROAD_NAME_JA2
),
)
),
INCIDENT_LENGTH
),
LENGTH,
SDKRoadObjectProvider.MAPBOX,
Expand Down Expand Up @@ -493,6 +494,7 @@ class RoadObjectFactoryTest {
INCIDENT_CREATION_TIME,
INCIDENT_START_TIME,
INCIDENT_END_TIME,
INCIDENT_LENGTH,
USA_CODE_2,
USA_CODE_3,
listOf(INCIDENT_LANES_BLOCKED),
Expand Down Expand Up @@ -710,6 +712,7 @@ class RoadObjectFactoryTest {
private val INCIDENT_CREATION_TIME = Date(40)
private val INCIDENT_START_TIME = Date(60)
private val INCIDENT_END_TIME = Date(80)
private const val INCIDENT_LENGTH = 12345
private const val USA_CODE_2 = "US"
private const val USA_CODE_3 = "USA"
private const val CANADA_CODE_2 = "CA"
Expand Down

0 comments on commit 23e2c92

Please sign in to comment.