Repository navigation
iPhone: the widgets and the Live Activity in the app's material (WP14) #54
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
Merged
Merged
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
3efc993
iPhone: the receipt log, four slots lit on their evidence, on the Liv…
frahlg 9c9f8f0
iPhone widgets: Grid today in the app's grammar, one signed line with…
frahlg 29ef0e8
iPhone widgets: the price as blocks, the plan as Now's strip, and AS …
frahlg 97639e5
CLAUDE.md: the widgets' material and the receipt log
frahlg File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,39 @@ | ||
| import FTWShared | ||
| import SwiftUI | ||
|
|
||
| /// The receipt log, `SENT ▸ ACCEPTED ▸ MEASURED ▸ CONFIRMED`, in the | ||
| /// terminal layer: one line of SF Mono caps with every slot always there, | ||
| /// so lighting one never moves another. A lit slot is ink, a waiting one | ||
| /// ink3; CONFIRMED is lime, and REFUSED takes its place in alarm red. | ||
| /// | ||
| /// `dimmed` draws every slot in ink3 and keeps the lit ones a little | ||
| /// stronger: a card the phone can no longer vouch for still says how far | ||
| /// the command came, without the colour of a state. | ||
| struct ReceiptRow: View { | ||
| let receipt: ReceiptLog | ||
| var dimmed = false | ||
| var size: CGFloat = 10.5 | ||
|
|
||
| var body: some View { | ||
| receipt.marks.enumerated().reduce(Text(verbatim: "")) { line, item in | ||
| let (i, mark) = item | ||
| let word = Text(verbatim: mark.text).foregroundStyle(color(mark)) | ||
| return i == 0 ? word : Text("\(line)\(arrow)\(word)") | ||
| } | ||
| .font(.system(size: size, weight: .semibold, design: .monospaced)) | ||
| .lineLimit(1) | ||
| .minimumScaleFactor(0.6) | ||
| .accessibilityLabel(receipt.line) | ||
| } | ||
|
|
||
| private var arrow: Text { Text(verbatim: ReceiptLog.arrow).foregroundStyle(Theme.ink3) } | ||
|
|
||
| private func color(_ mark: ReceiptLog.Mark) -> Color { | ||
| switch (mark.state, dimmed) { | ||
| case (.waiting, _): return Theme.ink3.opacity(dimmed ? 0.6 : 1) | ||
| case (.lit, true), (.refused, true): return Theme.ink3 | ||
| case (.lit, false): return mark.slot == .confirmed ? Theme.live : Theme.ink | ||
| case (.refused, false): return Theme.alarm | ||
| } | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
When a home has multiple chargers but only one active Live Activity,
Contract.FID.evWis the site-wide car load, whileids.count == 1only proves that one activity is open. If another charger is already drawing under its plan, any subsequent site observation will therefore mark the active command's MEASURED slot even when its own charger has not started; use per-loadpoint power or require a single charger, not merely a single activity.Useful? React with 👍 / 👎.