Suppress reroute announcement on long steps#382
Conversation
| // If the new route has a first step that has a distance greater than 1km, | ||
| // surpress the first announcement since they have ample time until the next maneuver | ||
| var newAlertLevel: AlertLevel = .none | ||
| if let firstLeg = route.legs.first, let firstStep = firstLeg.steps.first, firstStep.distance > 1_000 { |
There was a problem hiding this comment.
The comment above says this heuristic is based on duration, whereas this statement checks only for distance. If the user is traveling along a freeway in the U.S. and the new upcoming maneuver is 1 kilometer ahead, then the user has already passed the standard 1-mile advance guide sign and the next guide sign they’ll see is directly above the exit. Either we’d need to switch to a heuristic based on remaining duration, or we’d need separate logic for freeways versus surface streets.
|
What if we suppress the announcement when the new upcoming maneuver is farther away or later than the current upcoming maneuver, but preserve the announcement if the new upcoming maneuver is closer or earlier? |
Sounds good to me. |
If I've missed the maneuver and triggered a reroute, won't the current upcoming maneuver's distance remaining be zero? |
#374 calls for silencing the announcement in that case, correct? |
| - parameter legIndex: Zero-based index indicating the current leg the user is on. | ||
| */ | ||
| public init(route: Route, legIndex: Int = 0) { | ||
| public init(route: Route, legIndex: Int = 0, alertLevel: AlertLevel = .none) { |
There was a problem hiding this comment.
This parameter needs documentation (same for the one on RouteLegProgress).
Remove Objective-C compatibility; adopt Swift language features
Closes: #374
In cases where we reroute the user and the new route has a first step which has very long (1km), there is no need to alert the user about the first step. This is because they have ample time until the upcoming maneuver.
/cc @1ec5 @frederoni @ericrwolfe