@@ -60,6 +60,7 @@ import com.mapbox.navigation.ui.maps.util.CacheResultUtils.cacheResult
6060import com.mapbox.navigation.ui.utils.internal.ifNonNull
6161import com.mapbox.navigation.utils.internal.InternalJobControlFactory
6262import com.mapbox.navigation.utils.internal.logE
63+ import com.mapbox.navigation.utils.internal.logI
6364import com.mapbox.navigation.utils.internal.logW
6465import com.mapbox.navigation.utils.internal.parallelMap
6566import kotlinx.coroutines.Deferred
@@ -663,9 +664,11 @@ class MapboxRouteLineApi(
663664 lastLocationPoint = null
664665 routeLineOptions.vanishingRouteLine?.vanishPointOffset = 0.0
665666 activeLegIndex = INVALID_ACTIVE_LEG_INDEX
667+ logI(" Updated leg index to $activeLegIndex (from clearRouteLine)" , LOG_CATEGORY )
666668 routes.clear()
667669 routeFeatureData.clear()
668670 routeLineExpressionData = emptyList()
671+ logI(" Cleared route line expression data (from clearRouteLine)" , LOG_CATEGORY )
669672 resetCaches()
670673
671674 consumer.accept(
@@ -823,6 +826,12 @@ class MapboxRouteLineApi(
823826 routeProgressUpdatesQueue.addJob(
824827 CoalescingBlockingQueue .Item (
825828 {
829+ logI(
830+ " Update with route progress. " +
831+ " Leg index: ${routeProgress.currentLegProgress?.legIndex} , " +
832+ " state: ${routeProgress.currentState} " ,
833+ LOG_CATEGORY
834+ )
826835 val currentPrimaryRoute = primaryRoute
827836 if (currentPrimaryRoute == null ) {
828837 val msg =
@@ -845,6 +854,12 @@ class MapboxRouteLineApi(
845854 updateVanishingPointState(routeProgress.currentState)
846855
847856 val currentLegIndex = routeProgress.currentLegProgress?.legIndex
857+ logI(
858+ " Calculate routeLineMaskingLayerDynamicData. " +
859+ " Leg index: ${routeProgress.currentLegProgress?.legIndex} , " +
860+ " state: ${routeProgress.currentState} , activeLegIndex: $activeLegIndex " ,
861+ LOG_CATEGORY
862+ )
848863 val routeLineMaskingLayerDynamicData =
849864 when ((currentLegIndex ? : INVALID_ACTIVE_LEG_INDEX ) != activeLegIndex) {
850865 true -> getRouteLineDynamicDataForMaskingLayers(
@@ -855,6 +870,7 @@ class MapboxRouteLineApi(
855870 }
856871 val legChange = (currentLegIndex ? : 0 ) > activeLegIndex
857872 activeLegIndex = currentLegIndex ? : INVALID_ACTIVE_LEG_INDEX
873+ logI(" Update leg index to $activeLegIndex (from route progress update)" , LOG_CATEGORY )
858874
859875 // If the de-emphasize inactive route legs feature is enabled and the vanishing route line
860876 // feature is enabled and the active leg index has changed, then calling the
@@ -1036,6 +1052,11 @@ class MapboxRouteLineApi(
10361052 return ifNonNull(route, routeProgress.currentLegProgress) { navRoute, currentLegProgress ->
10371053 val numLegs = navRoute.directionsRoute.legs()?.size ? : 0
10381054 val legIndex = currentLegProgress.legIndex
1055+ logI(
1056+ " getRouteLineDynamicDataForMaskingLayers for legIndex: $legIndex , " +
1057+ " numLegs: $numLegs , data size: ${routeLineExpressionData.size} " ,
1058+ LOG_CATEGORY
1059+ )
10391060 if (numLegs > 1 && legIndex < numLegs) {
10401061 getRouteLineDynamicDataForMaskingLayers(routeLineExpressionData, legIndex)
10411062 } else {
@@ -1421,6 +1442,7 @@ class MapboxRouteLineApi(
14211442 primaryRoute = distinctNewRoutes.firstOrNull()
14221443 MapboxRouteLineUtils .trimRouteDataCacheToSize(size = distinctNewRoutes.size)
14231444 this .activeLegIndex = INVALID_ACTIVE_LEG_INDEX
1445+ logI(" Updated activeLegIndex to $activeLegIndex (from setNewRouteData)" , LOG_CATEGORY )
14241446
14251447 preWarmRouteCaches(
14261448 distinctNewRoutes,
@@ -1653,10 +1675,18 @@ class MapboxRouteLineApi(
16531675 when (legsCount > 1 ) {
16541676 true -> {
16551677 routeLineExpressionData = deferred.await()
1678+ logI(
1679+ " Inited route line expression data: ${routeLineExpressionData.size} sync" ,
1680+ LOG_CATEGORY
1681+ )
16561682 }
16571683 false -> {
16581684 jobControl.scope.launch(Dispatchers .Main ) {
16591685 routeLineExpressionData = deferred.await()
1686+ logI(
1687+ " Inited route line expression data: ${routeLineExpressionData.size} async" ,
1688+ LOG_CATEGORY
1689+ )
16601690 }
16611691 }
16621692 }
0 commit comments