Skip to content

Commit 0c9e479

Browse files
author
Łukasz Paczos
committed
block until deprecated MapboxNavigation#resetTripSession() finishes
1 parent 79e3cb2 commit 0c9e479

File tree

1 file changed

+12
-3
lines changed

1 file changed

+12
-3
lines changed

libnavigation-core/src/main/java/com/mapbox/navigation/core/MapboxNavigation.kt

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -143,6 +143,7 @@ import kotlinx.coroutines.cancel
143143
import kotlinx.coroutines.channels.Channel
144144
import kotlinx.coroutines.channels.ReceiveChannel
145145
import kotlinx.coroutines.launch
146+
import kotlinx.coroutines.runBlocking
146147
import kotlinx.coroutines.sync.Mutex
147148
import kotlinx.coroutines.sync.withLock
148149
import java.lang.reflect.Field
@@ -645,10 +646,18 @@ class MapboxNavigation @VisibleForTesting internal constructor(
645646
* navigation simulation, or before resetting location to not real (simulated)
646647
* position without recreation of [MapboxNavigation].
647648
*/
648-
@Deprecated(message = "use a function withe the callback instead")
649+
@Deprecated(message = "use the overload with the callback instead")
649650
fun resetTripSession() {
650-
resetTripSession {
651-
// no-op
651+
// using a blocking function to keep parity with the original implementation so that
652+
// Nav Native is fully done with the reset when this function returns
653+
runBlocking {
654+
logD(LOG_CATEGORY) {
655+
"Resetting trip session"
656+
}
657+
navigator.resetRideSession()
658+
logI(LOG_CATEGORY) {
659+
"Trip session reset"
660+
}
652661
}
653662
}
654663

0 commit comments

Comments
 (0)