From 63e9c980c30008f0ffa2b5c8ef4a94dd07b5de3b Mon Sep 17 00:00:00 2001 From: Yury Kanetski Date: Fri, 1 Nov 2024 00:35:22 +0100 Subject: [PATCH] v3.5.0-rc.1 (#7886) ce489449a82df6bb8326489eaa6f8b1a6a9fee56 --- CHANGELOG.md | 27 ++++++++ CODEOWNERS | 1 + gradle/dependencies.gradle | 8 +-- gradle/publish.gradle | 3 +- .../core/CoreMapMatchingTests.kt | 8 +-- .../copilot/HistoryAttachmentsUtils.kt | 4 +- .../copilot/internal/CopilotSession.kt | 7 ++ .../copilot/work/HistoryUploadWorker.kt | 44 ++++++------ .../copilot/HistoryAttachmentsUtilsTest.kt | 3 +- .../copilot/MapboxCopilotImplTest.kt | 1 + libnavigation-core/api/current.txt | 4 ++ .../reroute/RouteHistoryOptionsAdapter.kt | 4 +- .../reroute/RouteHistoryOptionsAdapterTest.kt | 67 ++++++++++++++++--- 13 files changed, 134 insertions(+), 47 deletions(-) create mode 100644 CODEOWNERS diff --git a/CHANGELOG.md b/CHANGELOG.md index ab4099c1f22..a48eb4d7f0c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,32 @@ # Changelog for the Mapbox Navigation SDK Core Framework for Android +## Navigation SDK Core Framework 3.5.0-rc.1 - 26 October, 2024 +#### Features + + +#### Bug fixes and improvements +- Improved reroute and alternative routes behavior [#7114](https://github.com/mapbox/mapbox-navigation-android/pull/7114) +- Fixed map matching bug after leaving a tunnel [#7114](https://github.com/mapbox/mapbox-navigation-android/pull/7114) +- Increased route stickiness in dead reckoning mode [#7114](https://github.com/mapbox/mapbox-navigation-android/pull/7114) +- Added ability to send raw unfused GNSS location in addition to fused one [#7114](https://github.com/mapbox/mapbox-navigation-android/pull/7114) +- Improved odometry and road graph fusing in urban canyons [#7114](https://github.com/mapbox/mapbox-navigation-android/pull/7114) +- Signature of experimental `RawGnssSatelliteData` has been changed, now it requires `residual` as a constructor parameter [#7114](https://github.com/mapbox/mapbox-navigation-android/pull/7114) +- Experimental `RawGnssLocation` type has been removed, now `RawGnssData` requires `DilutionOfPrecision` as a parameter [#7114](https://github.com/mapbox/mapbox-navigation-android/pull/7114) + +#### Known issues :warning: + + +#### Other changes + + +### Mapbox dependencies +This release depends on, and has been tested with, the following Mapbox dependencies: +- Mapbox Maps SDK `v11.8.0-rc.1` ([release notes](https://github.com/mapbox/mapbox-maps-android/releases/tag/v11.8.0-rc.1)) +- Mapbox Navigation Native `v321.0.0-rc.1` +- Mapbox Core Common `v24.8.0-rc.1` +- Mapbox Java `v7.3.1` ([release notes](https://github.com/mapbox/mapbox-java/releases/tag/v7.3.1)) + + ## Navigation SDK Core Framework 3.5.0-beta.1 - 17 October, 2024 #### Features - Added support for SVG junction views, see `MapboxJunctionApi#generateJunction(instructions: BannerInstructions, @JunctionViewFormat format: String, consumer: MapboxNavigationConsumer>)`. [#6803](https://github.com/mapbox/mapbox-navigation-android/pull/6803) diff --git a/CODEOWNERS b/CODEOWNERS new file mode 100644 index 00000000000..2e5fc7570ab --- /dev/null +++ b/CODEOWNERS @@ -0,0 +1 @@ +* @mapbox/navigation-android diff --git a/gradle/dependencies.gradle b/gradle/dependencies.gradle index 83961cadef6..f0ce8348232 100644 --- a/gradle/dependencies.gradle +++ b/gradle/dependencies.gradle @@ -13,16 +13,16 @@ ext { // version which we should use in this build def mapboxNavigatorVersion = System.getenv("FORCE_MAPBOX_NAVIGATION_NATIVE_VERSION") if (mapboxNavigatorVersion == null || mapboxNavigatorVersion == '') { - mapboxNavigatorVersion = '321.0.0-beta.1' + mapboxNavigatorVersion = '321.0.0-rc.1' } println("Navigation Native version: " + mapboxNavigatorVersion) version = [ - mapboxMapSdk : '11.8.0-beta.1', + mapboxMapSdk : '11.8.0-rc.1', mapboxSdkServices : '7.3.1', mapboxNavigator : "${mapboxNavigatorVersion}", - mapboxCommonNative : '24.8.0-beta.1', - mapboxSearch : '2.6.0-beta.1', + mapboxCommonNative : '24.8.0-rc.1', + mapboxSearch : '2.6.0-rc.1', mapboxBaseAndroid : '0.11.0', androidXLifecycle : '2.4.0', androidXCoreVersion : '1.6.0', diff --git a/gradle/publish.gradle b/gradle/publish.gradle index 2ef5d5fecc8..c56697e15a9 100644 --- a/gradle/publish.gradle +++ b/gradle/publish.gradle @@ -56,8 +56,7 @@ registry { sdkName = project.ext.navSdkArtifactSettings[project.name].getV2() production = true snapshot = project.ext.snapshot -// TODO revert override = snapshot - override = true + override = snapshot dryRun = false publish = true publishMessage = "cc @mapbox/navigation-android" diff --git a/instrumentation-tests/src/androidTest/java/com/mapbox/navigation/instrumentation_tests/core/CoreMapMatchingTests.kt b/instrumentation-tests/src/androidTest/java/com/mapbox/navigation/instrumentation_tests/core/CoreMapMatchingTests.kt index f8b96bc38ef..e01925d4975 100644 --- a/instrumentation-tests/src/androidTest/java/com/mapbox/navigation/instrumentation_tests/core/CoreMapMatchingTests.kt +++ b/instrumentation-tests/src/androidTest/java/com/mapbox/navigation/instrumentation_tests/core/CoreMapMatchingTests.kt @@ -313,8 +313,8 @@ class CoreMapMatchingTests : BaseCoreNoCleanUpTest() { val result = navigation.requestMapMatching(options).getSuccessfulOrThrowException() navigation.setNavigationRoutes(result.navigationRoutes) stayOnPosition( - latitude = 32.712012, - longitude = -117.172928, + latitude = 32.712702672167055, + longitude = -117.17290808578423, bearing = 178.0f, frequencyHz = 5, ) { @@ -354,8 +354,8 @@ class CoreMapMatchingTests : BaseCoreNoCleanUpTest() { navigation.setNavigationRoutes(listOf(deserializedRoute)) stayOnPosition( - latitude = 32.712012, - longitude = -117.172928, + latitude = 32.712702672167055, + longitude = -117.17290808578423, bearing = 178.0f, frequencyHz = 5, ) { diff --git a/libnavigation-copilot/src/main/java/com/mapbox/navigation/copilot/HistoryAttachmentsUtils.kt b/libnavigation-copilot/src/main/java/com/mapbox/navigation/copilot/HistoryAttachmentsUtils.kt index 94678142e5e..d8f9b19cee7 100644 --- a/libnavigation-copilot/src/main/java/com/mapbox/navigation/copilot/HistoryAttachmentsUtils.kt +++ b/libnavigation-copilot/src/main/java/com/mapbox/navigation/copilot/HistoryAttachmentsUtils.kt @@ -37,8 +37,8 @@ internal object HistoryAttachmentsUtils { .replace('_', '/'), ).getString("u") - fun generateSessionId(copilotSession: CopilotSession, owner: String): String = - "$COPILOT/$owner/${retrieveSpecVersion()}/" + + fun generateSessionId(copilotSession: CopilotSession): String = + "$COPILOT/${copilotSession.owner}/${retrieveSpecVersion()}/" + "${copilotSession.appMode}/-/-" + "/${copilotSession.driveMode}/-" + "/${copilotSession.driveId}" diff --git a/libnavigation-copilot/src/main/java/com/mapbox/navigation/copilot/internal/CopilotSession.kt b/libnavigation-copilot/src/main/java/com/mapbox/navigation/copilot/internal/CopilotSession.kt index 4ba71e5e704..1227de5d872 100644 --- a/libnavigation-copilot/src/main/java/com/mapbox/navigation/copilot/internal/CopilotSession.kt +++ b/libnavigation-copilot/src/main/java/com/mapbox/navigation/copilot/internal/CopilotSession.kt @@ -3,11 +3,15 @@ package com.mapbox.navigation.copilot.internal import android.content.Context import android.content.pm.ApplicationInfo import com.google.gson.Gson +import com.mapbox.common.MapboxServices import com.mapbox.navigation.base.ExperimentalPreviewMapboxNavigationAPI +import com.mapbox.navigation.base.internal.options.getOwner +import com.mapbox.navigation.base.internal.utils.MapboxOptionsUtil.getTokenForService import com.mapbox.navigation.base.options.EventsAppMetadata import com.mapbox.navigation.base.options.NavigationOptions import com.mapbox.navigation.copilot.HistoryAttachmentsUtils.retrieveNavNativeSdkVersion import com.mapbox.navigation.copilot.HistoryAttachmentsUtils.retrieveNavSdkVersion +import com.mapbox.navigation.copilot.HistoryAttachmentsUtils.retrieveOwnerFrom import com.mapbox.navigation.copilot.HistoryAttachmentsUtils.utcTimeNow import java.io.File import java.util.Locale @@ -41,6 +45,7 @@ data class CopilotSession( val appUserId: String = "_", val appSessionId: String = "_", val recording: String = "", + val owner: String = "", ) { fun toJson(): String = Gson().toJson(this) @@ -69,6 +74,8 @@ data class CopilotSession( appUserId = copilotOptions.userId ?: eventsAppMetadata?.userId ?: "_", appSessionId = eventsAppMetadata?.sessionId ?: "_", recording = recording, + owner = copilotOptions.getOwner()?.takeUnless { it.isBlank() } + ?: retrieveOwnerFrom(getTokenForService(MapboxServices.DIRECTIONS)), ) } } diff --git a/libnavigation-copilot/src/main/java/com/mapbox/navigation/copilot/work/HistoryUploadWorker.kt b/libnavigation-copilot/src/main/java/com/mapbox/navigation/copilot/work/HistoryUploadWorker.kt index 525556070e3..6328ef810bf 100644 --- a/libnavigation-copilot/src/main/java/com/mapbox/navigation/copilot/work/HistoryUploadWorker.kt +++ b/libnavigation-copilot/src/main/java/com/mapbox/navigation/copilot/work/HistoryUploadWorker.kt @@ -12,17 +12,14 @@ import androidx.work.OneTimeWorkRequestBuilder import androidx.work.WorkManager import androidx.work.WorkerParameters import com.mapbox.common.MapboxOptions -import com.mapbox.common.MapboxServices import com.mapbox.common.TransferState import com.mapbox.common.UploadOptions import com.mapbox.navigation.base.ExperimentalPreviewMapboxNavigationAPI -import com.mapbox.navigation.base.internal.utils.MapboxOptionsUtil.getTokenForService import com.mapbox.navigation.copilot.AttachmentMetadata import com.mapbox.navigation.copilot.HistoryAttachmentsUtils import com.mapbox.navigation.copilot.HistoryAttachmentsUtils.attachmentFilename import com.mapbox.navigation.copilot.HistoryAttachmentsUtils.generateSessionId import com.mapbox.navigation.copilot.HistoryAttachmentsUtils.rename -import com.mapbox.navigation.copilot.HistoryAttachmentsUtils.retrieveOwnerFrom import com.mapbox.navigation.copilot.HttpServiceProvider import com.mapbox.navigation.copilot.MapboxCopilot import com.mapbox.navigation.copilot.MapboxCopilot.pushStatusObservers @@ -106,8 +103,6 @@ internal class HistoryUploadWorker( HistoryAttachmentsUtils.delete(file) } - @Suppress("MaxLineLength") - /* ktlint-disable max-line-length */ private suspend fun uploadHistoryFile( uploadOptions: UploadOptions, ): Boolean = suspendCancellableCoroutine { cont -> @@ -120,7 +115,8 @@ internal class HistoryUploadWorker( TransferState.IN_PROGRESS -> { logD( - "uploadStatus state = UPLOADING sent ${uploadStatus.totalSentBytes}/${uploadStatus.totalBytes} bytes", + "uploadStatus state = UPLOADING sent ${uploadStatus.totalSentBytes}" + + "/${uploadStatus.totalBytes} bytes", ) } @@ -132,7 +128,8 @@ internal class HistoryUploadWorker( TransferState.FAILED -> { logD( - "uploadStatus state = FAILED error = ${uploadStatus.error}; HttpResponseData = ${uploadStatus.httpResult?.value}", + "uploadStatus state = FAILED error = ${uploadStatus.error}; " + + "HttpResponseData = ${uploadStatus.httpResult?.value}", ) cont.resume(false) } @@ -144,7 +141,6 @@ internal class HistoryUploadWorker( } } } - /* ktlint-enable max-line-length */ private fun failure(copilotSession: CopilotSession) { val failedStatus = PushStatus.Failed(copilotSession) @@ -166,19 +162,20 @@ internal class HistoryUploadWorker( internal companion object { - private const val HISTORY_FILE_PATH: String = "history_file_path" - private const val APP_MODE: String = "app_mode" - private const val DRIVE_MODE: String = "drive_mode" - private const val DRIVE_ID: String = "drive_id" - private const val STARTED_AT: String = "started_at" - private const val ENDED_AT: String = "ended_at" - private const val NAV_SDK_VERSION: String = "nav_sdk_version" - private const val NAV_NATIVE_SDK_VERSION: String = "nav_native_sdk_version" - private const val APP_VERSION: String = "app_version" - private const val APP_USER_ID: String = "app_user_id" - private const val APP_SESSION_ID: String = "app_session_id" - private const val UPLOAD_URL: String = "upload_url" - private const val UPLOAD_SESSION_ID: String = "upload_session_id" + private const val HISTORY_FILE_PATH = "history_file_path" + private const val APP_MODE = "app_mode" + private const val DRIVE_MODE = "drive_mode" + private const val DRIVE_ID = "drive_id" + private const val STARTED_AT = "started_at" + private const val ENDED_AT = "ended_at" + private const val NAV_SDK_VERSION = "nav_sdk_version" + private const val NAV_NATIVE_SDK_VERSION = "nav_native_sdk_version" + private const val APP_VERSION = "app_version" + private const val APP_USER_ID = "app_user_id" + private const val APP_SESSION_ID = "app_session_id" + private const val UPLOAD_URL = "upload_url" + private const val UPLOAD_SESSION_ID = "upload_session_id" + private const val OWNER = "owner" // 2^8 x 338 = 86528 / 3600 = 24.03 hours private const val MAX_RUN_ATTEMPT_COUNT = 8 @@ -208,8 +205,7 @@ internal class HistoryUploadWorker( private fun inputData(copilotSession: CopilotSession): Data { val url = "$PROD_BASE_URL/attachments/v1?access_token=${MapboxOptions.accessToken}" - val owner = retrieveOwnerFrom(getTokenForService(MapboxServices.DIRECTIONS)) - val uploadSessionId = generateSessionId(copilotSession, owner) + val uploadSessionId = generateSessionId(copilotSession) return Data.Builder() .putCopilotSession(copilotSession) @@ -230,6 +226,7 @@ internal class HistoryUploadWorker( appUserId = data.getString(APP_USER_ID)!!, appSessionId = data.getString(APP_SESSION_ID)!!, recording = data.getString(HISTORY_FILE_PATH)!!, + owner = data.getString(OWNER).orEmpty(), ) @VisibleForTesting @@ -245,5 +242,6 @@ internal class HistoryUploadWorker( .putString(APP_VERSION, copilotSession.appVersion) .putString(APP_SESSION_ID, copilotSession.appSessionId) .putString(HISTORY_FILE_PATH, copilotSession.recording) + .putString(OWNER, copilotSession.owner) } } diff --git a/libnavigation-copilot/src/test/java/com/mapbox/navigation/copilot/HistoryAttachmentsUtilsTest.kt b/libnavigation-copilot/src/test/java/com/mapbox/navigation/copilot/HistoryAttachmentsUtilsTest.kt index d9d0c97592b..40a6ac49b14 100644 --- a/libnavigation-copilot/src/test/java/com/mapbox/navigation/copilot/HistoryAttachmentsUtilsTest.kt +++ b/libnavigation-copilot/src/test/java/com/mapbox/navigation/copilot/HistoryAttachmentsUtilsTest.kt @@ -53,9 +53,10 @@ class HistoryAttachmentsUtilsTest { appVersion = "v0.108.0-9-g0527ee4", appUserId = "wBzYwfK0oCYMTNYPIFHhYuYOLLs1", appSessionId = "3e48fd7b-ac82-42a8-9abe-aaeb724f92ce", + owner = "owner", ) - val sessionId = HistoryAttachmentsUtils.generateSessionId(navigationSession, "owner") + val sessionId = HistoryAttachmentsUtils.generateSessionId(navigationSession) val expectedSessionId = "co-pilot/owner/1.2/mbx-debug/-/-/free-drive/" + "-/3e48fd7a-fc82-42a8-9bae-baeb724f92ce" diff --git a/libnavigation-copilot/src/test/java/com/mapbox/navigation/copilot/MapboxCopilotImplTest.kt b/libnavigation-copilot/src/test/java/com/mapbox/navigation/copilot/MapboxCopilotImplTest.kt index ea2b8e96eb0..d3f8ab481fc 100644 --- a/libnavigation-copilot/src/test/java/com/mapbox/navigation/copilot/MapboxCopilotImplTest.kt +++ b/libnavigation-copilot/src/test/java/com/mapbox/navigation/copilot/MapboxCopilotImplTest.kt @@ -104,6 +104,7 @@ class MapboxCopilotImplTest { mockkObject(HistoryAttachmentsUtils) every { HistoryAttachmentsUtils.delete(any()) } returns false + every { HistoryAttachmentsUtils.retrieveOwnerFrom(fakeAccessToken) } returns "owner" val tmpFolder = folder.newFolder("copilot-test") mockedContext = mockk(relaxed = true) { diff --git a/libnavigation-core/api/current.txt b/libnavigation-core/api/current.txt index d7a2f03a63b..74da752d1b2 100644 --- a/libnavigation-core/api/current.txt +++ b/libnavigation-core/api/current.txt @@ -203,6 +203,9 @@ package com.mapbox.navigation.core.arrival { package com.mapbox.navigation.core.directions.session { + public final class DirectionsSessionKt { + } + public final class IgnoredRoute { method public com.mapbox.navigation.base.route.NavigationRoute getNavigationRoute(); method public String getReason(); @@ -1271,6 +1274,7 @@ package com.mapbox.navigation.core.trip.session.eh { method public void matchPolylineObjects(java.util.List matchableGeometries, boolean useOnlyPreloadedTiles = false); method public void matchPolylineObjects(java.util.List matchableGeometries); method public void registerRoadObjectMatcherObserver(com.mapbox.navigation.core.trip.session.eh.RoadObjectMatcherObserver roadObjectMatcherObserver); + method public void unregisterRoadObjectMatcherObserver(com.mapbox.navigation.core.trip.session.eh.RoadObjectMatcherObserver roadObjectMatcherObserver); } public final class RoadObjectMatcherKt { diff --git a/libnavigation-core/src/main/java/com/mapbox/navigation/core/reroute/RouteHistoryOptionsAdapter.kt b/libnavigation-core/src/main/java/com/mapbox/navigation/core/reroute/RouteHistoryOptionsAdapter.kt index 7209a4a790a..b74862d3f6f 100644 --- a/libnavigation-core/src/main/java/com/mapbox/navigation/core/reroute/RouteHistoryOptionsAdapter.kt +++ b/libnavigation-core/src/main/java/com/mapbox/navigation/core/reroute/RouteHistoryOptionsAdapter.kt @@ -1,6 +1,7 @@ package com.mapbox.navigation.core.reroute import com.google.gson.JsonPrimitive +import com.mapbox.api.directions.v5.DirectionsCriteria.PROFILE_DRIVING_TRAFFIC import com.mapbox.api.directions.v5.models.RouteOptions import com.mapbox.navigation.base.ExperimentalMapboxNavigationAPI import com.mapbox.navigation.base.route.ResponseOriginAPI.Companion.DIRECTIONS_API @@ -40,7 +41,8 @@ internal class RouteHistoryOptionsAdapter( val routeProgress = latestRouteProgressProvider() return if (routeProgress != null && routeProgress.navigationRoute.origin == RouterOrigin.ONLINE && - routeProgress.navigationRoute.responseOriginAPI == DIRECTIONS_API + routeProgress.navigationRoute.responseOriginAPI == DIRECTIONS_API && + routeOptions.profile() == PROFILE_DRIVING_TRAFFIC ) { addCurrentRouteToHistory(routeProgress, routeOptions) } else { diff --git a/libnavigation-core/src/test/java/com/mapbox/navigation/core/reroute/RouteHistoryOptionsAdapterTest.kt b/libnavigation-core/src/test/java/com/mapbox/navigation/core/reroute/RouteHistoryOptionsAdapterTest.kt index e5aae4093b9..847c525b7b0 100644 --- a/libnavigation-core/src/test/java/com/mapbox/navigation/core/reroute/RouteHistoryOptionsAdapterTest.kt +++ b/libnavigation-core/src/test/java/com/mapbox/navigation/core/reroute/RouteHistoryOptionsAdapterTest.kt @@ -1,6 +1,12 @@ package com.mapbox.navigation.core.reroute +import com.google.gson.JsonElement import com.google.gson.JsonPrimitive +import com.mapbox.api.directions.v5.DirectionsCriteria.PROFILE_CYCLING +import com.mapbox.api.directions.v5.DirectionsCriteria.PROFILE_DRIVING +import com.mapbox.api.directions.v5.DirectionsCriteria.PROFILE_DRIVING_TRAFFIC +import com.mapbox.api.directions.v5.DirectionsCriteria.PROFILE_WALKING +import com.mapbox.api.directions.v5.DirectionsCriteria.ProfileCriteria import com.mapbox.api.directions.v5.models.RouteOptions import com.mapbox.navigation.base.ExperimentalMapboxNavigationAPI import com.mapbox.navigation.base.route.NavigationRoute @@ -36,7 +42,7 @@ class RouteHistoryOptionsAdapterTest { null }, ) - val initialOptions = createRouteOptions() + val initialOptions = createTestRouteOptions() val result = adapter.onRouteOptions(initialOptions, defaultRouteOptionsAdapterParams) @@ -61,7 +67,7 @@ class RouteHistoryOptionsAdapterTest { ) }, ) - val originalRouteOptions = createRouteOptions( + val originalRouteOptions = createTestRouteOptions( unrecognizedProperties = mapOf("test-key" to JsonPrimitive("test-value")), ) @@ -81,6 +87,39 @@ class RouteHistoryOptionsAdapterTest { ) } + @Test + fun `adapter doesn't add current route to history for no driving traffic profiles`() { + val testNavigationRoute = createNavigationRoutes( + createDirectionsResponse( + uuid = "history-test", + ), + ) + val adapter = createRouteHistoryOptionsAdapter( + latestRouteProgressProvider = { + createRouteProgress( + testNavigationRoute[0], + currentRouteGeometryIndexValue = 30, + ) + }, + ) + for (profile in listOf(PROFILE_CYCLING, PROFILE_WALKING, PROFILE_DRIVING)) { + val originalRouteOptions = createTestRouteOptions( + profile = profile, + ) + + val updatedRouteOptions = adapter.onRouteOptions( + originalRouteOptions, + defaultRouteOptionsAdapterParams, + ) + + val url = updatedRouteOptions.toHttpUrl() + assertNull( + "failed for $profile profile", + url.getRoutesHistory(), + ) + } + } + @Test fun `reroute on a route with history`() { val testNavigationRoute1 = createNavigationRoutes( @@ -102,7 +141,7 @@ class RouteHistoryOptionsAdapterTest { currentRouteProgress }, ) - val originalRouteOptions = createRouteOptions() + val originalRouteOptions = createTestRouteOptions() val routeOptionsFirstReroute = adapter.onRouteOptions( originalRouteOptions, @@ -144,7 +183,7 @@ class RouteHistoryOptionsAdapterTest { currentRouteProgress }, ) - val originalRouteOptions = createRouteOptions() + val originalRouteOptions = createTestRouteOptions() val routeOptionsFirstReroute = adapter.onRouteOptions( originalRouteOptions, @@ -182,7 +221,7 @@ class RouteHistoryOptionsAdapterTest { ) }, ) - val originalRouteOptions = createRouteOptions() + val originalRouteOptions = createTestRouteOptions() val updatedRouteOptions = adapter.onRouteOptions( originalRouteOptions, @@ -258,7 +297,7 @@ class RouteHistoryOptionsAdapterTest { }, ) - var routeOptions = createRouteOptions() + var routeOptions = createTestRouteOptions() repeat(100) { routeOptions = adapter.onRouteOptions( routeOptions, @@ -290,7 +329,7 @@ class RouteHistoryOptionsAdapterTest { ) }, ) - val originalRouteOptions = createRouteOptions( + val originalRouteOptions = createTestRouteOptions( unrecognizedProperties = mapOf("routes_history" to JsonPrimitive("")), ) @@ -323,7 +362,7 @@ class RouteHistoryOptionsAdapterTest { ) }, ) - val originalRouteOptions = createRouteOptions( + val originalRouteOptions = createTestRouteOptions( unrecognizedProperties = mapOf("routes_history" to JsonPrimitive(";1;0")), ) @@ -348,7 +387,7 @@ class RouteHistoryOptionsAdapterTest { error("test error") }, ) - val initialOptions = createRouteOptions() + val initialOptions = createTestRouteOptions() val result = adapter.onRouteOptions( initialOptions, @@ -377,7 +416,7 @@ class RouteHistoryOptionsAdapterTest { ) }, ) - val originalRouteOptions = createRouteOptions( + val originalRouteOptions = createTestRouteOptions( unrecognizedProperties = mapOf("test-key" to JsonPrimitive("test-value")), ) @@ -404,6 +443,14 @@ private fun createRouteProgress( every { currentRouteGeometryIndex } returns currentRouteGeometryIndexValue } +private fun createTestRouteOptions( + @ProfileCriteria profile: String = PROFILE_DRIVING_TRAFFIC, + unrecognizedProperties: Map? = null, +) = createRouteOptions( + profile = profile, + unrecognizedProperties = unrecognizedProperties, +) + private fun RouteOptions.toHttpUrl() = toUrl("***").toString().toHttpUrl() private fun HttpUrl.getRoutesHistory() = queryParameter("routes_history")