Skip to content
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

Progress view current road #307

Merged
merged 22 commits into from
Oct 30, 2024
Merged

Progress view current road #307

merged 22 commits into from
Oct 30, 2024

Conversation

ianthetechie
Copy link
Contributor

@ianthetechie ianthetechie commented Oct 23, 2024

Closes #245. Closes close #244.

  • Renames ArrivalView to ProgressView`
  • Exposes helpers for getting the current road name (at least as far as the route step is concerned)
  • Adds a UI (replaceable + composeable) widget along with the progress view

Android screenshot (simulator; sorry for the puck bugs:

image

iPhone 16:

image

iPhone SE 3rd gen:

image

Out of scope for now: generic interface for road names. I expect eventually someone will ask for this so they can do local map matching etc. for free roam experiences. We should support this eventually but doesn't need to be now.

For a future (but soon-ish) PR: Landscape layouts. These are... a bit trickier. Confirmed with the user asking for this that they are only blocked by portrait. I'll split up issues.

@ianthetechie ianthetechie added android iOS UI/UX Related to the UI/UX (on any platform) labels Oct 23, 2024
Copy link
Contributor

@michaelkirk michaelkirk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I only looked at the Swift + Rust code.

qq about the new clones in rust, but it's not a big deal either way.

Copy link
Collaborator

@Archdoog Archdoog left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looking pretty sweet.

In addition to my comments, probably want to add some snapshot testing for the current road views on iOS & Android

Comment on lines 39 to 41
@ViewBuilder currentRoadNameViewBuilder: (String?) -> AnyView = { name in
AnyView(CurrentRoadNameView(currentRoadName: name, theme: DefaultRoadNameViewTheme()))
}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is probably fine as it's an internal view. No need to convert to view modifier.

Comment on lines 40 to 42
@ViewBuilder currentRoadNameViewBuilder: (String?) -> AnyView = { name in
AnyView(CurrentRoadNameView(currentRoadName: name, theme: DefaultRoadNameViewTheme()))
}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is probably fine as it's an internal view. No need to convert to view modifier.

Comment on lines 55 to 57
@ViewBuilder currentRoadNameViewBuilder: @escaping (String?) -> AnyView = { name in
AnyView(CurrentRoadNameView(currentRoadName: name, theme: DefaultRoadNameViewTheme()))
}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use view modifier pattern?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah; that might actually be the right move here...

Comment on lines 16 to 24
Text(currentRoadName)
.font(theme.textFont)
.foregroundStyle(theme.textColor)
.padding(.leading, 12)
.padding(.trailing, 12)
.padding(.vertical, 8)
.background(theme.backgroundColor)
.clipShape(.rect(cornerRadius: 48))
.overlay(RoundedRectangle(cornerRadius: 48).stroke(theme.borderColor, lineWidth: 1))
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would be nice to have the & clip shape in the init or theme (similar to android comment). To allow easy customization.


public extension CurrentRoadNameView {
/// Sets the interior padding (expanding the buffer around the text).
func padding(_ padding: EdgeInsets) -> Self {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice! I expect with these modifiers. We can get rid of all of the init args?

        @ViewBuilder currentRoadNameViewBuilder: @escaping (String?) -> AnyView = { name in
            AnyView(CurrentRoadNameView(currentRoadName: name, theme: DefaultRoadNameViewTheme()))
        }

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ahh that's an interesting idea! Let me try that...

Copy link
Collaborator

@Archdoog Archdoog left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Like the view modifier methodology 👍. Added a comment about all the init @Viewbuilders now that the modifiers exist.

Secondarily, I expect we'd have a some snapshot tests of the new view? Or to update the progress view tests to include it in a bundled test?

Beyond those two things, looks good to me.

@ianthetechie ianthetechie merged commit 67ad4ee into main Oct 30, 2024
14 checks passed
@ianthetechie ianthetechie deleted the progress-view-current-road branch October 30, 2024 05:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
android iOS UI/UX Related to the UI/UX (on any platform)
Projects
None yet
3 participants