Skip to content

Commit cc729c4

Browse files
authored
MapboxTripSession: add logs voice and banner instructions (#6692)
1 parent 562e8e7 commit cc729c4

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

libnavigation-core/src/main/java/com/mapbox/navigation/core/trip/session/MapboxTripSession.kt

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -345,6 +345,10 @@ internal class MapboxTripSession(
345345
"state: ${status.routeState}",
346346
LOG_CATEGORY
347347
)
348+
logD(LOG_CATEGORY) {
349+
"navigatorObserver#onStatus; banner instruction: [${status.bannerInstruction}]," +
350+
" voice instruction: [${status.voiceInstruction}]"
351+
}
348352

349353
val tripStatus = status.getTripStatusFrom(primaryRoute)
350354
val enhancedLocation = tripStatus.navigationStatus.location.toLocation()
@@ -594,12 +598,26 @@ internal class MapboxTripSession(
594598
var legIndexUpdated = false
595599
updateLegIndexJob = mainJobController.scope.launch {
596600
try {
601+
fun msg(state: String, append: String = ""): () -> String = {
602+
"update to new leg $state. Leg index: $legIndex, route id: " +
603+
"${primaryRoute?.id} + $append"
604+
}
605+
logD(LOG_CATEGORY, msg("started"))
597606
val latestInstructionWrapper = bannerInstructionEvent.latestInstructionWrapper
598607
val lastVoiceInstruction = lastVoiceInstruction
599608
legIndexUpdated = navigator.updateLegIndex(legIndex)
600609
if (legIndexUpdated) {
601610
invalidateLatestInstructions(latestInstructionWrapper, lastVoiceInstruction)
602611
}
612+
logD(
613+
LOG_CATEGORY,
614+
msg(
615+
"finished",
616+
"(is leg updated: $legIndexUpdated; " +
617+
"latestInstructionWrapper: [$latestInstructionWrapper]; " +
618+
"lastVoiceInstruction: [$lastVoiceInstruction])"
619+
)
620+
)
603621
} finally {
604622
callback.onLegIndexUpdatedCallback(legIndexUpdated)
605623
}

0 commit comments

Comments
 (0)