@@ -46,7 +46,7 @@ fun NavigationRoute.refreshRoute(
46
46
legAnnotations : List <LegAnnotation ?>? ,
47
47
incidents : List <List <Incident >? >? ,
48
48
closures : List <List <Closure >? >? ,
49
- unrecognizedProperties : Map < String , JsonElement >? ,
49
+ waypoints : List < DirectionsWaypoint ? >? ,
50
50
): NavigationRoute {
51
51
val updateLegs = directionsRoute.legs()?.mapIndexed { index, routeLeg ->
52
52
if (index < initialLegIndex) {
@@ -95,19 +95,19 @@ fun NavigationRoute.refreshRoute(
95
95
.build()
96
96
}
97
97
}
98
- return update(
99
- {
100
- toBuilder()
101
- .legs(updateLegs)
102
- .updateRouteDurationBasedOnLegsDuration(updateLegs)
103
- .build()
104
- }
105
- ) {
98
+ val directionsRouteBlock: DirectionsRoute .() -> DirectionsRoute = {
99
+ toBuilder()
100
+ .legs(updateLegs)
101
+ .updateRouteDurationBasedOnLegsDuration(updateLegs)
102
+ .build()
103
+ }
104
+ val directionsResponseBlock: DirectionsResponse .Builder .() -> DirectionsResponse .Builder = {
106
105
updateWaypoints(
107
106
directionsResponse.waypoints(),
108
- unrecognizedProperties
107
+ waypoints
109
108
)
110
109
}
110
+ return update(directionsRouteBlock, directionsResponseBlock)
111
111
}
112
112
113
113
private fun adjustedIndex (offsetIndex : Int , originalIndex : Int? ): Int {
@@ -198,14 +198,11 @@ private fun List<LegStep>.updateSteps(
198
198
199
199
private fun DirectionsResponse.Builder.updateWaypoints (
200
200
oldWaypoints : List <DirectionsWaypoint >? ,
201
- newUnrecognizedProperties : Map < String , JsonElement >? ,
201
+ updatedWaypoints : List < DirectionsWaypoint ? >? ,
202
202
): DirectionsResponse .Builder {
203
203
if (oldWaypoints == null ) {
204
204
return this
205
205
}
206
- val updatedWaypoints = WaypointsParser .parse(
207
- newUnrecognizedProperties?.get(Constants .KEY_WAYPOINTS )
208
- )
209
206
val newWaypoints = mutableListOf<DirectionsWaypoint >()
210
207
if (updatedWaypoints != null ) {
211
208
oldWaypoints.forEachIndexed { index, oldWaypoint ->
0 commit comments