HandleRerouteOnWaypointArrivalUseCase
This UseCase is to workaround bug with MapboxNavigation with custom arrival logic.
We use custom arrival logic and disable automatic leg switching with custom com.mapbox.navigation.core.arrival.ArrivalController at ObserveComingToWaypointUseCase.
With such manual leg switching the following steps will lead to the bug:
start route with a destination and a waypoint
go along the route to the waypoint and pass it
go off route, not directed to the final destination
switch legs of the route with com.mapbox.navigation.core.MapboxNavigation.navigateNextRouteLeg
route will be rebuilt, but the waypoint that was already passed will be included in it
Worth to mention, that the bug will also sometimes appear with automatic leg switching as well. To reproduce crucial here is that reroute event should happen close enough to the waypoint. Then com.mapbox.navigation.core.reroute.MapboxRerouteController will use outdated coordinate list, that still includes waypoint coordinate.
TODO file bug for MapboxNavigation repo and attach here