diff --git a/libnavigation-core/src/main/java/com/mapbox/navigation/core/MapboxNavigation.kt b/libnavigation-core/src/main/java/com/mapbox/navigation/core/MapboxNavigation.kt index faab96e8ed8..48321ac76ce 100644 --- a/libnavigation-core/src/main/java/com/mapbox/navigation/core/MapboxNavigation.kt +++ b/libnavigation-core/src/main/java/com/mapbox/navigation/core/MapboxNavigation.kt @@ -451,7 +451,9 @@ class MapboxNavigation @VisibleForTesting internal constructor( ), historyRecorderHandles.composite, ) - val routeParsingManager = createRouteParsingManager(navigationOptions.longRoutesOptimisationOptions) + val routeParsingManager = createRouteParsingManager( + navigationOptions.longRoutesOptimisationOptions + ) routeParsingManager.setPrepareForParsingAction(this::prepareNavigationForRoutesParsing) val result = MapboxModuleProvider.createModule(MapboxModuleType.NavigationRouter) { paramsProvider( diff --git a/libnavigation-core/src/main/java/com/mapbox/navigation/core/routealternatives/RouteAlternativesController.kt b/libnavigation-core/src/main/java/com/mapbox/navigation/core/routealternatives/RouteAlternativesController.kt index 38df1075ff1..cac767fb65d 100644 --- a/libnavigation-core/src/main/java/com/mapbox/navigation/core/routealternatives/RouteAlternativesController.kt +++ b/libnavigation-core/src/main/java/com/mapbox/navigation/core/routealternatives/RouteAlternativesController.kt @@ -152,7 +152,6 @@ internal class RouteAlternativesController constructor( origin ) } - } ) } @@ -245,7 +244,8 @@ internal class RouteAlternativesController constructor( RouteResponseInfo.fromResponses(allAlternatives.map { it.responseJsonRef.buffer }), userTriggeredAlternativesRefresh = immediateAlternativesRefresh ) - val alternativesParsingResult: AlternativesParsingResult>> = + val alternativesParsingResult: + AlternativesParsingResult>> = routeParsingManager.parseAlternatives(args) { parseArgs -> withContext(ThreadController.DefaultDispatcher) { parseRouteInterfaces( @@ -258,7 +258,9 @@ internal class RouteAlternativesController constructor( val expected = when (alternativesParsingResult) { AlternativesParsingResult.NotActual -> { notActualParsingCallback(getOrigin(nativeAlternatives)) - ExpectedFactory.createError(Throwable("cancelled because another parsing is already in progress")) + ExpectedFactory.createError( + Throwable("cancelled because another parsing is already in progress") + ) } is AlternativesParsingResult.Parsed -> alternativesParsingResult.value } @@ -271,7 +273,7 @@ internal class RouteAlternativesController constructor( |unable to parse alternatives; |failure for response with uuid: |${nativeAlternatives.firstOrNull()?.route?.responseUuid} - """.trimMargin(), + """.trimMargin(), LOG_CATEGORY ) null diff --git a/libnavigation-core/src/main/java/com/mapbox/navigation/core/telemetry/MapboxNavigationTelemetry.kt b/libnavigation-core/src/main/java/com/mapbox/navigation/core/telemetry/MapboxNavigationTelemetry.kt index 01188cc3f54..3431a459aeb 100644 --- a/libnavigation-core/src/main/java/com/mapbox/navigation/core/telemetry/MapboxNavigationTelemetry.kt +++ b/libnavigation-core/src/main/java/com/mapbox/navigation/core/telemetry/MapboxNavigationTelemetry.kt @@ -229,7 +229,9 @@ internal object MapboxNavigationTelemetry { } resetLocalVariables() resetDynamicValues() - routeData.originalRouteMetrics = MetricsDirectionsRoute(routes.first().directionsRoute) + routeData.originalRouteMetrics = MetricsDirectionsRoute( + routes.first().directionsRoute + ) routeData.needHandleDeparture = true } reason == RoutesExtra.ROUTES_UPDATE_REASON_ALTERNATIVE -> { @@ -239,7 +241,9 @@ internal object MapboxNavigationTelemetry { handleReroute(routes.first().directionsRoute) } reason == RoutesExtra.ROUTES_UPDATE_REASON_REFRESH -> { - routeData.originalRouteMetrics = MetricsDirectionsRoute(routes.first().directionsRoute) + routeData.originalRouteMetrics = MetricsDirectionsRoute( + routes.first().directionsRoute + ) } else -> logW( "Unknown route update reason: [$reason]", diff --git a/libnavigation-core/src/main/java/com/mapbox/navigation/core/telemetry/events/MetricsDirectionsRoute.kt b/libnavigation-core/src/main/java/com/mapbox/navigation/core/telemetry/events/MetricsDirectionsRoute.kt index 05d7239015c..2ec43bed171 100644 --- a/libnavigation-core/src/main/java/com/mapbox/navigation/core/telemetry/events/MetricsDirectionsRoute.kt +++ b/libnavigation-core/src/main/java/com/mapbox/navigation/core/telemetry/events/MetricsDirectionsRoute.kt @@ -1,7 +1,6 @@ package com.mapbox.navigation.core.telemetry.events import com.mapbox.api.directions.v5.models.DirectionsRoute -import com.mapbox.navigation.base.route.NavigationRoute import com.mapbox.navigation.core.telemetry.obtainStepCount internal data class MetricsDirectionsRoute( diff --git a/libnavigation-core/src/test/java/com/mapbox/navigation/core/RoutesCacheClearerTest.kt b/libnavigation-core/src/test/java/com/mapbox/navigation/core/RoutesCacheClearerTest.kt index 29f56066a6a..6ab57aa0a62 100644 --- a/libnavigation-core/src/test/java/com/mapbox/navigation/core/RoutesCacheClearerTest.kt +++ b/libnavigation-core/src/test/java/com/mapbox/navigation/core/RoutesCacheClearerTest.kt @@ -46,7 +46,6 @@ class RoutesCacheClearerTest { verify(exactly = 1) { DecodeUtils.clearCache() } verify(exactly = 0) { DecodeUtils.clearCacheExceptFor(any()) } - } @Test @@ -55,7 +54,9 @@ class RoutesCacheClearerTest { sut.onRoutesChanged(createRoutesUpdatedResult(testRoutes, "")) verify(exactly = 0) { DecodeUtils.clearCache() } - verify(exactly = 1) { DecodeUtils.clearCacheExceptFor(testRoutes.first().directionsResponse.routes()) } + verify(exactly = 1) { + DecodeUtils.clearCacheExceptFor(testRoutes.first().directionsResponse.routes()) + } } @Test @@ -64,14 +65,25 @@ class RoutesCacheClearerTest { createDirectionsResponse(uuid = "preview") ) sut.routesPreviewUpdated( - RoutesPreviewUpdate("", RoutesPreview(testPreviewRoutes, emptyList(), testPreviewRoutes, 0)) + RoutesPreviewUpdate( + "", + RoutesPreview(testPreviewRoutes, emptyList(), testPreviewRoutes, 0) + ) ) clearStaticMockk(DecodeUtils::class) sut.onRoutesChanged(createRoutesUpdatedResult(emptyList(), "")) verify(exactly = 0) { DecodeUtils.clearCache() } - verify(exactly = 1) { DecodeUtils.clearCacheExceptFor(match { it.map { it.requestUuid() } == listOf("preview") }) } + verify(exactly = 1) { + DecodeUtils.clearCacheExceptFor( + match { + it.map { it.requestUuid() } == listOf( + "preview" + ) + } + ) + } } @Test @@ -131,7 +143,12 @@ class RoutesCacheClearerTest { @Test fun routesPreviewUpdated_emptyRoutesAndHasActiveRoutes() { - sut.onRoutesChanged(createRoutesUpdatedResult(createNavigationRoutes(), RoutesExtra.ROUTES_UPDATE_REASON_NEW)) + sut.onRoutesChanged( + createRoutesUpdatedResult( + createNavigationRoutes(), + RoutesExtra.ROUTES_UPDATE_REASON_NEW + ) + ) clearStaticMockk(DecodeUtils::class) sut.routesPreviewUpdated( @@ -177,7 +194,10 @@ class RoutesCacheClearerTest { response = createDirectionsResponse(uuid = "active") ) sut.routesPreviewUpdated( - RoutesPreviewUpdate("", RoutesPreview(testPreviewRoutes, emptyList(), testPreviewRoutes, 0)) + RoutesPreviewUpdate( + "", + RoutesPreview(testPreviewRoutes, emptyList(), testPreviewRoutes, 0) + ) ) clearStaticMockk(DecodeUtils::class) @@ -187,7 +207,7 @@ class RoutesCacheClearerTest { verify(exactly = 1) { DecodeUtils.clearCacheExceptFor( match { - it.map { it.requestUuid() }.sortedBy { it } == listOf("active", "preview", ) + it.map { it.requestUuid() }.sortedBy { it } == listOf("active", "preview") } ) } diff --git a/libnavigation-core/src/test/java/com/mapbox/navigation/core/routealternatives/RouteAlternativesControllerTest.kt b/libnavigation-core/src/test/java/com/mapbox/navigation/core/routealternatives/RouteAlternativesControllerTest.kt index d9a9258265a..956dc517368 100644 --- a/libnavigation-core/src/test/java/com/mapbox/navigation/core/routealternatives/RouteAlternativesControllerTest.kt +++ b/libnavigation-core/src/test/java/com/mapbox/navigation/core/routealternatives/RouteAlternativesControllerTest.kt @@ -456,7 +456,6 @@ class RouteAlternativesControllerTest { @Test fun `should set RouteOptions to alternative routes`() = coroutineRule.runBlockingTest { - val routeAlternativesController = createRouteAlternativesController() val nativeObserver = slot() every { controllerInterface.addObserver(capture(nativeObserver)) } just runs diff --git a/libnavigation-core/src/test/java/com/mapbox/navigation/core/telemetry/MapboxNavigationTelemetryTest.kt b/libnavigation-core/src/test/java/com/mapbox/navigation/core/telemetry/MapboxNavigationTelemetryTest.kt index a0692af83a2..bf0136f52b9 100644 --- a/libnavigation-core/src/test/java/com/mapbox/navigation/core/telemetry/MapboxNavigationTelemetryTest.kt +++ b/libnavigation-core/src/test/java/com/mapbox/navigation/core/telemetry/MapboxNavigationTelemetryTest.kt @@ -1345,7 +1345,8 @@ class MapboxNavigationTelemetryTest { every { anotherRouteOptions.profile() } returns ANOTHER_ROUTE_OPTIONS_PROFILE every { anotherRouteOptions.geometries() } returns DirectionsCriteria.GEOMETRY_POLYLINE6 every { anotherRoute.directionsResponse.uuid() } returns ANOTHER_ROUTE_OPTIONS_REQUEST_UUID - every { anotherRoute.directionsRoute.requestUuid() } returns ANOTHER_ROUTE_OPTIONS_REQUEST_UUID + every { anotherRoute.directionsRoute.requestUuid() } returns + ANOTHER_ROUTE_OPTIONS_REQUEST_UUID every { anotherRouteLeg.steps() } returns progressRouteSteps every { anotherRouteStep.maneuver() } returns anotherStepManeuver every { anotherStepManeuver.location() } returns anotherStepManeuverLocation