-
-
Notifications
You must be signed in to change notification settings - Fork 862
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
[android] Fix PT router overriding previous mode if subway layer active #7964
Conversation
android/app/src/main/java/app/organicmaps/routing/RoutingController.java
Outdated
Show resolved
Hide resolved
Is that WebDebug failed test something I broke? Seemed like some network error 🤔 |
You can relaunch failed check manually. |
The public transportation router was forcibly overriding the previously selected mode whenever the planning activity was resumed, with the subway layer active. For instance, if you started a route planning (which automatically uses PT when that layer is on), switched to car mode and then changed some driving options, when you got back to the planning screen, the router would have changed back to PT, instead of keeping it on car. This occurred because of `RoutingController#rebuildLastRoute`, called whenever an activity (such as the driving options) concluded, which would, indirectly, call `RoutingController#initLastRouteType`. This method is responsible for defaulting the router to the most adequate type for the start+finish point combo, or, if the subway layer is selected, to set it to public transportaton. So, the fix was rather simple -- instead of only checking if the the subway layer is active (and if we're not comming from a link, but that isn't relevant here), we also check if we were already planning something, or if we're starting a new route plan. We only want to reset the mode to PT on the latter case. Fixes: organicmaps#7701 Signed-off-by: tmpod <tom@tmpod.dev>
965aca0
to
713568d
Compare
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.
Great, thanks! I assume that this change was tested, and it works, correct?
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.
✅ Pixel 6 - Android 14
Yep, tested this on Waydroid and on my phone!
|
What is blocking this PR from merging? |
Not sure, the PR is approved and tested. I think the maintainers just
haven't gotten around to it, most likely.
|
@Tmpod Thanks, and welcome to the club! |
Thank you! I'm already looking for the next issue to tackle :P
|
The public transportation router was forcibly overriding the previously selected mode whenever the planning activity was resumed, with the subway layer active. For instance, if you started a route planning (which automatically uses PT when that layer is on), switched to car mode and then changed some driving options, when you got back to the planning screen, the router would have changed back to PT, instead of keeping it on car.
This occurred because of
RoutingController#rebuildLastRoute
, called whenever an activity (such as the driving options) concluded, which would, indirectly, callRoutingController#initLastRouteType
. This method is responsible for defaulting the router to the most adequate type for the start+finish point combo, or, if the subway layer is selected, to set it to public transportaton.So, the fix was rather simple -- instead of only checking if the the subway layer is active (and if we're not comming from a link, but that isn't relevant here), we also check if we were already planning something, or if we're starting a new route plan. We only want to reset the mode to PT on the latter case.
Fixes: #7701