Skip to content

Conversation

@VysotskiVadim
Copy link
Contributor

This PR solves exactly the same problem as #6764

I think that the SDK should provide all the needed data inside the reroute event so that users don't need to combine route progress and reroute events.

To support reroute parameters, I had to introduce a new interface.

@dzinad
Copy link
Contributor

dzinad commented Dec 20, 2022

Left some comments but I like the approach from #6764 more for reasons specified in the ticket.

}
}

@JvmOverloads
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why?


@ExperimentalPreviewMapboxNavigationAPI
interface NavigationRerouteControllerV2 : NavigationRerouteController {
fun reroute(params: RerouteParameters, callback: NavigationRerouteController.RoutesCallback)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we deprecate the old reroute method? And the interface? Because now it's not very clear how the user would implement the old reroute method. They'll still have to search for relevant request data on their own. With the deprecation it becomes clear that the old method will not be called for NavigationRerouteControllerV2.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The SDK users may have mapboxNavigation.reroute() calls in their code. I don't know why they might want to call it, but they can, and if they switch to NavigationRerouteControllerV2 without implementing old reroute, this case may be broken.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

MapboxNavigation#reroute is private, they can't invoke it.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sorry, I meant mapboxNavigaiton.getRerouteController()?.reroute()

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But if they invoke it then they have it implemented. Nothing will break here.
However, why should all the users that don't invoke reroute directly implement it? If they use NavigationRerouteControllerV2 they will probably want to receive request data as arguments. What would they do for the old reroute method? Would they just ignore the case with switching to alternatives? Or get the data themselves via RouteProgressObserver? But if we deprecate it with a message that says that we won't invoke it, they won't have to implement it at all. If they invoke it somewhere in their code - let them implement it. I don't see what exactly would break here.

@codecov
Copy link

codecov bot commented Dec 20, 2022

Codecov Report

Merging #6765 (bcea879) into main (cf4c8ea) will increase coverage by 0.01%.
The diff coverage is 90.90%.

Impacted file tree graph

@@             Coverage Diff              @@
##               main    #6765      +/-   ##
============================================
+ Coverage     72.49%   72.50%   +0.01%     
- Complexity     5522     5524       +2     
============================================
  Files           772      774       +2     
  Lines         29924    29949      +25     
  Branches       3535     3536       +1     
============================================
+ Hits          21694    21716      +22     
- Misses         6814     6816       +2     
- Partials       1416     1417       +1     
Impacted Files Coverage Δ
...re/reroute/NavigationRerouteControllerV2Adapter.kt 71.42% <71.42%> (ø)
...ava/com/mapbox/navigation/core/MapboxNavigation.kt 71.16% <85.71%> (+0.11%) ⬆️
...navigation/core/reroute/MapboxRerouteController.kt 92.25% <95.45%> (+0.22%) ⬆️
...tion/core/reroute/NavigationRerouteControllerV2.kt 100.00% <100.00%> (ø)

@VysotskiVadim
Copy link
Contributor Author

It feels that new reroute controller interface brings more confusion than value.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants