Skip to content

Commit 1a34711

Browse files
committed
NAVAND-899: meet code review
1 parent 88eae2b commit 1a34711

7 files changed

Lines changed: 15 additions & 8 deletions

File tree

CHANGELOG.md

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@ Mapbox welcomes participation and contributions from everyone.
77
#### Bug fixes and improvements
88
- Fixed crash in `PermissionsLauncherFragment` occurring on device rotation. [#6635](https://github.com/mapbox/mapbox-navigation-android/pull/6635)
99
- Fixed a rare `java.lang.IllegalArgumentException: The Path cannot loop back on itself.` exception when using `NavigationLocationProvider`. [#6641](https://github.com/mapbox/mapbox-navigation-android/pull/6641)
10+
- Started clearing route geometry cache when no routes (neither routes used for Active Guidance nor previewed ones) are available. [#6617](https://github.com/mapbox/mapbox-navigation-android/pull/6617)
11+
- Added convenience `MapboxNavigation#moveRoutesFromPreviewToNavigator` method to simplify transition from Routes Preview state to Active Guidance state. [#6617](https://github.com/mapbox/mapbox-navigation-android/pull/6617)
1012

1113
## Mapbox Navigation SDK 2.9.2 - 18 November, 2022
1214
### Changelog
@@ -44,11 +46,6 @@ This release depends on, and has been tested with, the following Mapbox dependen
4446
- Mapbox Java `v6.10.0-beta.2` ([release notes](https://github.com/mapbox/mapbox-java/releases/tag/v6.10.0-beta.2))
4547
- Mapbox Android Core `v5.0.2` ([release notes](https://github.com/mapbox/mapbox-events-android/releases/tag/core-5.0.2))
4648

47-
- Added `DecodeUtils#clearCache` to allow trigger route geometry cache clearing in order to reduce memory usage.
48-
- Started clearing route geometry cache when no routes (neither routes used for Active Guidance nor previewed ones) are available.
49-
- Added `DecodeUtils#clearCache` to allow trigger route geometry cache clearing in order to reduce memory usage. [#6617](https://github.com/mapbox/mapbox-navigation-android/pull/6617)
50-
- Started clearing route geometry cache when no routes (neither routes used for Active Guidance nor previewed ones) are available. [#6617](https://github.com/mapbox/mapbox-navigation-android/pull/6617)
51-
- Added convenience `MapboxNavigation#moveRoutesFromPreviewToNavigator` method to simplify transition from Routes Preview state to Active Guidance state. [#6617](https://github.com/mapbox/mapbox-navigation-android/pull/6617)
5249

5350
## Mapbox Navigation SDK 2.9.1 - 11 November, 2022
5451
### Changelog

libnavigation-base/api/current.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1720,7 +1720,6 @@ package com.mapbox.navigation.base.trip.notification {
17201720
package com.mapbox.navigation.base.utils {
17211721

17221722
public final class DecodeUtils {
1723-
method public static void clearCache();
17241723
method public static com.mapbox.geojson.LineString completeGeometryToLineString(com.mapbox.api.directions.v5.models.DirectionsRoute);
17251724
method public static java.util.List<com.mapbox.geojson.Point> completeGeometryToPoints(com.mapbox.api.directions.v5.models.DirectionsRoute);
17261725
method public static com.mapbox.geojson.LineString stepGeometryToLineString(com.mapbox.api.directions.v5.models.DirectionsRoute, com.mapbox.api.directions.v5.models.LegStep legStep);
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
package com.mapbox.navigation.base.internal
2+
3+
import com.mapbox.navigation.base.utils.DecodeUtils
4+
5+
fun DecodeUtils.clearCache() {
6+
clearCacheInternal()
7+
}

libnavigation-base/src/main/java/com/mapbox/navigation/base/utils/DecodeUtils.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ object DecodeUtils {
127127
* [stepGeometryToPoints], [completeGeometryToPoints], etc.
128128
*/
129129
@JvmStatic
130-
fun clearCache() {
130+
internal fun clearCacheInternal() {
131131
synchronized(stepsGeometryDecodeCache) {
132132
cachedRoutes.clear()
133133
stepsGeometryDecodeCache.evictAll()

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

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -911,7 +911,9 @@ class MapboxNavigation @VisibleForTesting internal constructor(
911911
fun moveRoutesFromPreviewToNavigator() {
912912
val preview = getRoutesPreview()
913913
requireNotNull(preview) {
914-
"Can't move routes from preview to navigator as no previewed routes are available"
914+
"Can't move routes from preview to navigator as no previewed routes are available. " +
915+
"Make sure you have set routes to preview and received previewed routes " +
916+
"in RoutesPreviewObserver before moving them to navigator."
915917
}
916918
setNavigationRoutes(preview.routesList)
917919
setRoutesPreview(emptyList())

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
package com.mapbox.navigation.core
22

33
import com.mapbox.navigation.base.ExperimentalPreviewMapboxNavigationAPI
4+
import com.mapbox.navigation.base.internal.clearCache
45
import com.mapbox.navigation.base.route.NavigationRoute
56
import com.mapbox.navigation.base.utils.DecodeUtils
67
import com.mapbox.navigation.core.directions.session.RoutesObserver

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
package com.mapbox.navigation.core
22

33
import com.mapbox.navigation.base.ExperimentalPreviewMapboxNavigationAPI
4+
import com.mapbox.navigation.base.internal.clearCache
45
import com.mapbox.navigation.base.utils.DecodeUtils
56
import com.mapbox.navigation.core.directions.session.RoutesUpdatedResult
67
import com.mapbox.navigation.core.preview.RoutesPreview

0 commit comments

Comments
 (0)