-
Notifications
You must be signed in to change notification settings - Fork 312
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Custom Rerouting #3472
Custom Rerouting #3472
Conversation
*/ | ||
func router(_ router: Router, willRerouteFrom location: CLLocation) | ||
func router(_ router: Router, willRerouteFrom location: CLLocation) -> ReroutingRequest |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I decided to stick to the return value instead of providing a callback to be called by user. It is less convenient to use it this way when there are multithreaded calculations on the User side, but it is safer in terns that user will be forced to return a value in any case. Otherwise, user could just ignore/forget to call the callback and it'll jam the rerouting.
c3a038f
to
99d51ef
Compare
a7c16a2
to
a86e009
Compare
Breaking Changes in MapboxCoreNavigationBreaking API Changes
|
Breaking Changes in MapboxNavigationBreaking API Changes
|
Originally it was labeled for 2.1, but since there are some breaking changes, could we move it to 2.2 maybe? |
99d51ef
to
81ab813
Compare
Moved to |
a4122d8
to
4ea538b
Compare
d3fbc38
to
35e692e
Compare
Breaking Changes in MapboxCoreNavigationBreaking API Changes
|
Breaking Changes in MapboxNavigationBreaking API Changes
|
Since this PR introduces a breaking change while we are at RC stage, I switch it to target 2.2 version |
case .failure(let error): | ||
return calculationCompletion(session, .failure(error)) | ||
case .success(let response): | ||
guard let mostSimilarIndex = response.routes?.index(mostSimilarTo: progress.route) else { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some customers pointed out that this algorithm can sometimes select the route with the biggest ETA, should we somehow allow them to select one of the routes using their own algorithm?
Currently, it's a little bit misleading that we call willReroute
callback not before the reroute itself, but before we start to fetch possible reroutes.
Maybe we should rename willReroute
to willFetchReroutes
and add a new willReroute
callback where an application can select the best route.🤔
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A bit ugly, but user can achieve this if they just remove "slower" routes from reroutingResult
.
We could (and actually will) revisit rerouting logic once we incorporate NavNative's rerouting implementation.
25f84d1
to
affe140
Compare
…thage; CHANGELOG updated
…thage; CHANGELOG updated
…iding custom route for rerouting. Modified underlying logic to reflect the change; Unit tests added/updated.
…e in non-breaking fashion: added new delegate method to ask for reroute, removed modification of 'willReroute' method; tests updated; CHANGELOG updated.
cc30853
to
5b25bd3
Compare
No breaking changes detected in MapboxCoreNavigation |
No breaking changes detected in MapboxNavigation |
No breaking changes detected in MapboxCoreNavigation |
No breaking changes detected in MapboxNavigation |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm
vk-3464-custom-reroute: reworked delegate methods to allow new feature in non-breaking fashion: added new delegate method to ask for reroute, tests updated; CHANGELOG updated.
vk-3464-custom-reroute: reworked delegate methods to allow new feature in non-breaking fashion: added new delegate method to ask for reroute, tests updated; CHANGELOG updated.
These changes were backed out in #3668. |
Resolves #3464
This PR modifies
RouterDelegate.router(_:willRerouteFrom:)
method to allow user to select if he want's to customize the output route.