Skip to content

Commit b176096

Browse files
kmadsenrunner
andauthored
Make the location switch to map matching faster (#6906)
* Make the location switch to map matching faster * Rename changelog files --------- Co-authored-by: runner <runner@fv-az571-164>
1 parent 0ae6a95 commit b176096

File tree

3 files changed

+38
-0
lines changed

3 files changed

+38
-0
lines changed
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
- Make the location switch to map matching faster with MapboxTripStarter.enableMapMatching

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -179,6 +179,7 @@ class MapboxTripStarter internal constructor(
179179
replayRouteSession = null
180180
replayHistorySession.onDetached(mapboxNavigation)
181181
mapboxNavigation.startTripSession()
182+
mapboxNavigation.resetTripSession { }
182183
} else {
183184
logI(LOG_CATEGORY) {
184185
"startTripSession was not called. Accept location permissions and call " +

libnavigation-core/src/test/java/com/mapbox/navigation/core/trip/MapboxTripStarterTest.kt

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,42 @@ class MapboxTripStarterTest {
126126
assertTrue(infoLogSlot.captured.contains("startTripSession was not called"))
127127
}
128128

129+
@Test
130+
fun `enableMapMatching after replay route will resetTripSession`() {
131+
every { PermissionsManager.areLocationPermissionsGranted(any()) } returns true
132+
133+
val mapboxNavigation = mockMapboxNavigation()
134+
sut.enableReplayRoute()
135+
sut.onAttached(mapboxNavigation)
136+
sut.enableMapMatching()
137+
138+
verifyOrder {
139+
replayRouteSession.onAttached(mapboxNavigation)
140+
replayRouteSession.onDetached(mapboxNavigation)
141+
mapboxNavigation.startTripSession()
142+
mapboxNavigation.resetTripSession(any())
143+
}
144+
verify(exactly = 0) { mapboxNavigation.stopTripSession() }
145+
}
146+
147+
@Test
148+
fun `enableMapMatching after replay history will resetTripSession`() {
149+
every { PermissionsManager.areLocationPermissionsGranted(any()) } returns true
150+
151+
val mapboxNavigation = mockMapboxNavigation()
152+
sut.enableReplayHistory()
153+
sut.onAttached(mapboxNavigation)
154+
sut.enableMapMatching()
155+
156+
verifyOrder {
157+
replayHistorySession.onAttached(mapboxNavigation)
158+
replayHistorySession.onDetached(mapboxNavigation)
159+
mapboxNavigation.startTripSession()
160+
mapboxNavigation.resetTripSession(any())
161+
}
162+
verify(exactly = 0) { mapboxNavigation.stopTripSession() }
163+
}
164+
129165
@Test
130166
fun `refreshLocationPermissions will startTripSession after onAttached`() {
131167
every { PermissionsManager.areLocationPermissionsGranted(any()) } returns false

0 commit comments

Comments
 (0)