Share how a Workday looks between app and widget - #42
Merged
Merged
Conversation
Move the tracking state out of WorkdayManager into Shared as WorkdayState so the widget compares a real type instead of strings, and publish the Threshold Ladder as one value instead of colour-named threshold fields. A snapshot stored by the previous version fails to decode and reads as unavailable until the app publishes again. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01WFc8P7zoT4V7GQaqwegkcm
Add a shared appearance module holding the palette, the colour and label of each tracking state, the indicator and progress colours per Threshold Level, and the two-digit-hour duration format. Both widget sizes take colour, label and duration text from it, so the widget adopts the app's palette and shows durations as 08:05. DesignTokens reads its accents from the shared palette so the hex values live in one place. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01WFc8P7zoT4V7GQaqwegkcm
…rance The menu bar, popover badge, log editor chip and every Threshold Level accent now ask the shared appearance module. DesignTokens keeps the palette but no longer maps states or Threshold Levels to colours. The menu bar still leaves the normal level to native rendering, and the app's visible colours are unchanged. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01WFc8P7zoT4V7GQaqwegkcm
Rename the snapshot's Threshold Ladder field, store snapshots under a versioned key so an older format reads as unavailable, move duration formatting into its own shared file and pin the palette's values. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01WFc8P7zoT4V7GQaqwegkcm
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
What does this PR do?
Moves the mapping from tracking state and Threshold Level to colour, label and duration text into one module in
Shared/, used by both the app and the widget.Typed widget snapshot:
WorkdayState, moved out ofWorkdayManager.State.thresholdLadderinstead of the colour-namedorangeThreshold/redThresholdfields.widget_snapshot_v2. A value left under v1 is ignored: the widget shows "unavailable" until the app's next publish, which happens on launch.Shared/WorkdayAppearance.swift:Duration formatting (
08:05) lives inShared/TimeInterval+Duration.swift.Widget: the duplicated colour, label and progress switches and all hex values are gone. Visible change, as decided:
08:05). The live running counter is unchanged.App: the menu bar, popover badge, log editor chip, progress bar, week history and log list all read from the shared module. The app's look is unchanged: a test pins the palette values, and the menu bar keeps native rendering at normal level.
How to test?
xcodebuild test -scheme OpenWorktimeTrackerTestsruns 275 tests.WorkdayAppearanceTests,WidgetSnapshotTestsandWorkdayManagerClockAndStoreTestspass.mainat b6aa5e5):ViewLayoutTests.testSettingsRowsRemainReadableInBothLanguagesAndAppearancesfails with 7 OCR assertions.Notes
WorkdayManagerandproject.pbxproj. Whichever merges second may need a quick rebase. CI regenerates the project with XcodeGen..swiftlint.ymldoes not includeShared/orWorktimeWidget/, so the new shared code isn't linted.Checklist
make test): everything except the OCR test above, which also fails onmainmake lint): 0 serious, same 5 length warnings asmain@Observable(notObservableObject)DesignTokensfor colors/typography (DesignTokens now reads its accents from the shared palette)🤖 Generated with Claude Code
https://claude.ai/code/session_01WFc8P7zoT4V7GQaqwegkcm