-
Notifications
You must be signed in to change notification settings - Fork 30
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
Support for visual sub-maneuvers #303
Conversation
relevant urls: I set this as a draft because I am not sure if this approach is correct, especially considering Valhalla responses (which I didn't think about too much), and about different types of subs, and about the overall model structuring. I figured it was easier to discuss over a PR than just text, so happy to make changes accordingly. Also, I guess I am breaking backward compatibility, but am not sure about what the recommended way to fix this is. |
5cd1245
to
0e20949
Compare
pub struct SubManeuverBannerContentComponent { | ||
#[serde(rename = "type")] | ||
pub component_type: Option<String>, | ||
pub directions: Option<Vec<String>>, |
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 only focused on directions
here, but didn't think too much about other subs
, like just lists of type
+ text
, or type
+ image_base_url
, etc, as per the sample json in this file. should we handle these also?
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.
We're generally fine merging partial implementations if it's well-documented what's missing in an appropriate place. In this case, I think just a quick comment noting that we parse these but don't use them yet is enough (this is just the low-level OSRM model anyways, and we usually try to make these extremely complete, so that data is there if we need it).
Re: the sample JSON in this file, here's a gist with a sample route that we can add to the project. This one comes from Valhalla via our API (so, FWIW, Valhalla also does lane guidance :D). https://gist.github.com/ianthetechie/fc3c983b3242a84987ec7ddf468971ac
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 added a new test for this, and updated the old test to also do some checks here.
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.
👍
You know what's funny? I just realized we already have another example from Mapbox's public docs which I had forgotten about (see the deserialize_banner_instruction
test) 😂 Let's keep both; good to have diversity of API tests in here. We could probably turn one or both of those into snapshot tests now that I think of it.
4913e37
to
e3699cc
Compare
e3699cc
to
5aadeac
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.
Wow, thanks for the PR! I think this is pretty much the right direction; just a few comments on models.
I've just reviewed the Rust side of things for now; once we're aligned on data modeling, we can move up to the UI layer (wasn't expecting that in the PR too; thanks!) :D
Also, I guess I am breaking backward compatibility, but am not sure about what the recommended way to fix this is.
You're talking about semver compatibility, right? Or was there something I missed / didn't review?
Generally speaking, this project is pre-1.0, and a significant number of the organizations actively using it are also engaged in development, so don't worry too much about breaking changes as long as they are announced.
EDIT: I see you might have just been asking what do to in that case ;) Just run the update release version shell script and commit the files (careful with Package.swift; if you are using the local development flag, you'll need to unstage that change :D)
pub struct SubManeuverBannerContentComponent { | ||
#[serde(rename = "type")] | ||
pub component_type: Option<String>, | ||
pub directions: Option<Vec<String>>, |
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.
We're generally fine merging partial implementations if it's well-documented what's missing in an appropriate place. In this case, I think just a quick comment noting that we parse these but don't use them yet is enough (this is just the low-level OSRM model anyways, and we usually try to make these extremely complete, so that data is there if we need it).
Re: the sample JSON in this file, here's a gist with a sample route that we can add to the project. This one comes from Valhalla via our API (so, FWIW, Valhalla also does lane guidance :D). https://gist.github.com/ianthetechie/fc3c983b3242a84987ec7ddf468971ac
pub struct SubManeuverBannerContentComponent { | ||
#[serde(rename = "type")] | ||
pub component_type: Option<String>, | ||
pub directions: Option<Vec<String>>, |
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 added a new test for this, and updated the old test to also do some checks here.
pub image_base_url: Option<String>, | ||
pub abbr: Option<String>, | ||
pub abbr_priority: Option<u8>, | ||
pub active_direction: Option<String>, |
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.
btw, we have Lane
already for intersections (though it's not exposed right now) - is that okay or do you think this would cause any confusion in the future?
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.
Correct; intersections also have detailed lane info, which is what I originally thought this PR was about 😂 My current understanding (not having designed either API) is that these are complementary, but that the Mapbox usage is the more common one across navigation SDKs. The detailed intersection info may be useful in specific contexts though, so we modeled it just in case.
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.
Fantastic; thanks!
I also had a quick look over the UI stuff and that all looked fine.
Is this PR still considered a draft? Were you also planning to push SwiftUI+Jetpack Compose views for the sub-instruction layout? (No worries if not; I know you guys also do a lot of custom UI; that can come in a later PR if it's not immediately available. This looks solid to merge as-is.)
pub struct SubManeuverBannerContentComponent { | ||
#[serde(rename = "type")] | ||
pub component_type: Option<String>, | ||
pub directions: Option<Vec<String>>, |
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.
👍
You know what's funny? I just realized we already have another example from Mapbox's public docs which I had forgotten about (see the deserialize_banner_instruction
test) 😂 Let's keep both; good to have diversity of API tests in here. We could probably turn one or both of those into snapshot tests now that I think of it.
pub image_base_url: Option<String>, | ||
pub abbr: Option<String>, | ||
pub abbr_priority: Option<u8>, | ||
pub active_direction: Option<String>, |
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.
Correct; intersections also have detailed lane info, which is what I originally thought this PR was about 😂 My current understanding (not having designed either API) is that these are complementary, but that the Mapbox usage is the more common one across navigation SDKs. The detailed intersection info may be useful in specific contexts though, so we modeled it just in case.
Looks like a few failures CI caught which are easy to fix (missing params etc.) |
Co-authored-by: Ian Wagner <ianwagner+github@switzerlandmail.ch>
* Update ferrostar version * Add prettier * Run Prettier * Update guide * Rename format to format:fix, add format:check script * Add format:check to GitHub workflow
* Support arbitrary Valhalla options (formerly we only merged costing options) * Fix argument * Improve docs of some convenience initializers * Align Android with iOS costing options * swiftformat * Don't forget the web ;) * Add Android-specific README * Set up Android to use API keys properly via local.properties * Fix CI * Fix subtle bug where Android location providers never updated lastLocation * Rename U-Turn images to match how Kotlin stringifies the maneuvers * Allow the fused location provider to report an initial fix faster * First pass at an actually usable demo app * Minor build script improvement * Checkpoint commit phase 1 * Checkpoint commit phase 2 highlighting some bad stuff to clean up * Add docs on the StaticLocationEngine * Fix formatting + doc test * Fix typo in Android readme Co-authored-by: Jacob Fielding <jf0517@gmail.com> * Kotlin let closure idiom * ktfmtFormat + auto-commit * Remove extraneous env? * Try switching to a mix of Apple Silicon Ubuntu runners for Android * Fix runner permissions (I think) * Apply automatic changes * Address open thread re: iOS uturn image name * Add TODO docs * Fix the navigation camera (re-)application logic * Cleanup * Remove old comment * Apply automatic changes --------- Co-authored-by: Jacob Fielding <jf0517@gmail.com> Co-authored-by: ianthetechie <ianthetechie@users.noreply.github.com>
had to merge with main to do the fixes but should hopefully be good now |
for the UI, happy to try this in another PR - we're still wrapping a |
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.
Sounds good on the UI in a separate PR. Thanks! Can merge this as soon as CI passes.
Within
BannerInstructions
, the MapBox API allows for asub_content
for describing sub-maneuvers. This data is used either for showing the step after the current one if it is to happen really quickly after the current step (ex turn left then turn right), or to specify lane information. This PR implements this within Ferrostar.