-
Notifications
You must be signed in to change notification settings - Fork 26
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
Feat/ios speed limit view #119
Conversation
apple/Sources/FerrostarMapLibreUI/Views/PortraitNavigationView.swift
Outdated
Show resolved
Hide resolved
var speedWithUnitsFormatter: MeasurementFormatter { get } | ||
} | ||
|
||
public struct DefaultFerrostarTheme: FerrostarTheme { |
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'm not quite sold on a "theme" also including locale settings. Those seem like separate concepts.
apple/Sources/FerrostarMapLibreUI/Views/DynamicallyOrientingNavigationView.swift
Outdated
Show resolved
Hide resolved
apple/Sources/FerrostarSwiftUI/Views/GridViews/NavigatingInnerGridView.swift
Outdated
Show resolved
Hide resolved
apple/Sources/FerrostarSwiftUI/Views/Controls/FerrostarButton.swift
Outdated
Show resolved
Hide resolved
apple/Sources/FerrostarSwiftUI/Views/GridViews/InnerGridView.swift
Outdated
Show resolved
Hide resolved
switch locale.identifier { | ||
case "en_US": | ||
USSpeedLimitView( | ||
speedLimit: speedLimit, | ||
valueFormatter: valueFormatter, | ||
unitFormatter: unitFormatter | ||
) | ||
default: | ||
ROWSpeedLimitView( | ||
speedLimit: speedLimit, | ||
valueFormatter: valueFormatter, | ||
unitFormatter: unitFormatter | ||
) | ||
} |
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 am not sure this is the best way to go about deciding which speed limit to show. For one, the US isn't the only country to use mph for speed limits.
Second, I'm pretty convinced that locale is not the correct way to set speed display preference.
I think we can punt on the specifics of this for the moment and:
- Have it be a pair of preferences for the moment (maybe bundled into the theme / display units / formatter stuff??). It's really a pair of preferences: do you want the US/MUTCD style or Vienna Convention style that's used almost everywhere else. If I were designing this, I'd make it vary on geography, but that's way out of scope for now ;)
- Move the logic at the use site (get rid of this view wrapper until we have a better idea of how users want to determine it automatically).
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.
Consider how this could become a SpeedLimitProvider (e.g. to take locale, manual inputs, or a route admins list).
Add comment that this needs to improve in the future. & Make it easy to override.
apple/Sources/FerrostarSwiftUI/Views/SpeedLimit/USSpeedLimitView.swift
Outdated
Show resolved
Hide resolved
apple/Sources/FerrostarSwiftUI/Views/SpeedLimit/ROWSpeedLimit.swift
Outdated
Show resolved
Hide resolved
I also noticed that several of the tests are (now?) nondeterministic.
|
Accepting suggestions Co-authored-by: Ian Wagner <[email protected]>
|
switch locale.identifier { | ||
case "en_US": | ||
USSpeedLimitView( | ||
speedLimit: speedLimit, | ||
valueFormatter: valueFormatter, | ||
unitFormatter: unitFormatter | ||
) | ||
default: | ||
ROWSpeedLimitView( | ||
speedLimit: speedLimit, | ||
valueFormatter: valueFormatter, | ||
unitFormatter: unitFormatter | ||
) | ||
} |
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.
Consider how this could become a SpeedLimitProvider (e.g. to take locale, manual inputs, or a route admins list).
Add comment that this needs to improve in the future. & Make it easy to override.
apple/Sources/FerrostarMapLibreUI/Views/DynamicallyOrientingNavigationView.swift
Outdated
Show resolved
Hide resolved
apple/Sources/FerrostarMapLibreUI/Views/DynamicallyOrientingNavigationView.swift
Outdated
Show resolved
Hide resolved
apple/Sources/FerrostarMapLibreUI/Views/PortraitNavigationView.swift
Outdated
Show resolved
Hide resolved
apple/Sources/FerrostarSwiftUI/Formatting/FerrostarFormatters.swift
Outdated
Show resolved
Hide resolved
apple/Sources/FerrostarSwiftUI/Formatting/FerrostarFormatters.swift
Outdated
Show resolved
Hide resolved
apple/Sources/FerrostarSwiftUI/Formatting/FerrostarFormatters.swift
Outdated
Show resolved
Hide resolved
apple/Sources/FerrostarSwiftUI/Views/SpeedLimit/SpeedLimitView.swift
Outdated
Show resolved
Hide resolved
apple/Sources/FerrostarSwiftUI/Views/SpeedLimit/SpeedLimitView.swift
Outdated
Show resolved
Hide resolved
apple/Sources/FerrostarSwiftUI/Views/SpeedLimit/SpeedLimitView.swift
Outdated
Show resolved
Hide resolved
@@ -54,20 +54,21 @@ public struct USStyleSpeedLimitView: View { | |||
.background(Color.white) | |||
.frame(width: 52, height: 76) | |||
.cornerRadius(4) | |||
.colorScheme(.light) |
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.
Ooh interesting... Is this to fix the text color (which I guess might default to white in dark mode)? If so, maybe we can just set the text color explicitly?
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.
This fixes the speed limit sign colors to light mode. Since it's something we don't want to invert (basically maintaining the white background and black text regardless of the device's color mode).
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.
Leaving a comment for posterity because this was EXTREMELY interesting... Apparently named colors (ex: .green
) may be aware of light/dark mode, and resolve to different hex values! That's both unexpected but also kinda cool.
Accepting renames & suggested comments. Co-authored-by: Ian Wagner <[email protected]>
No description provided.