Split complication settings views, add floating live preview#5079
Conversation
- Split ComplicationListView.swift into one view per file (ComplicationsRootView, ComplicationListView, WatchComplicationBuilderEditView), per the one-struct-per-file rule; the legacy list gained its missing #Preview. Surface that rule in a new Non-Negotiable Conventions section of AGENTS.md. - Make FakeServerManager public and seed it in the builder #Preview so the server-gated form (including the complication mock) renders in Xcode previews. - New FloatingPanel component in HADesignSystem: drag anywhere with corner snapping (flick-aware), tap or pinch to resize, configurable corner radius; registered in the components gallery. - In the complication builder, the preview floats over the form once its inline section scrolls away, showing only the selected family centered and zoomed to fit a compact watch face whose bezel radius the panel chrome matches concentrically. - Persist the editor's Customize disclosure as a new nullable isCustomized column (auto-added by the column migration); older rows fall back to inferring it from per-size overrides. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
|
The following added lines contain |
|
Found 1 unused localization strings in the codebase. Click to see detailsTo remove them, run the |
There was a problem hiding this comment.
Pull request overview
This PR refactors Apple Watch complication settings UI to follow the “one type per file” convention, improves Xcode previewability by seeding a fake server environment, and introduces a reusable floating picture-in-picture live preview panel (including persistence for the “Customize” disclosure state).
Changes:
- Split complication settings views into dedicated files and add missing
#Previews. - Add a reusable
FloatingPanelcomponent and integrate it as a floating live complication preview when the inline preview scrolls off-screen. - Persist the editor’s “Customize” disclosure state via a new nullable
isCustomizedcolumn onWatchComplicationConfig, with backward-compatible inference for older rows.
Reviewed changes
Copilot reviewed 12 out of 12 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| Sources/Shared/Database/GRDB+Initialization.swift | Adds new nullable isCustomized column to the complications config table. |
| Sources/Shared/API/Server+Fakes.swift | Makes FakeServerManager public for previews/tests and annotates helper methods. |
| Sources/HAModels/Sources/WatchComplicationConfig.swift | Adds isCustomized persistence + showsCustomized() fallback behavior. |
| Sources/HAModels/Sources/DatabaseTables.swift | Registers the new isCustomized database column name. |
| Sources/HADesignSystem/Sources/Gallery/DesignSystemComponent.swift | Adds FloatingPanel to the design system component gallery. |
| Sources/HADesignSystem/Sources/Components/FloatingPanel.swift | New draggable/snapping, pinch/tap-resizable floating panel component. |
| Sources/App/Settings/AppleWatch/Complications/WatchComplicationBuilderEditView.swift | Moves builder into its own file; adds floating live preview + preview seeding. |
| Sources/App/Settings/AppleWatch/Complications/Preview/AllFamiliesComplicationPreview.swift | Adds single-family compact rendering mode for the floating preview. |
| Sources/App/Settings/AppleWatch/Complications/ComplicationsRootView.swift | Moves root complications settings view into its own file with preview. |
| Sources/App/Settings/AppleWatch/Complications/ComplicationListView.swift | Removes embedded root/builder views; adds legacy list preview. |
| HomeAssistant.xcodeproj/project.pbxproj | Adds the new SwiftUI files to the Xcode project. |
| AGENTS.md | Documents the “one type per file + #Preview” rule as non-negotiable. |
Summary
ComplicationListView.swiftheld three view structs;ComplicationsRootViewandWatchComplicationBuilderEditViewnow live in their own files (code moved verbatim), and the legacy list gained its missing#Preview. The one-type-per-file +#Previewrule is now surfaced in a "Non-Negotiable Conventions" section ofAGENTS.md.FakeServerManageris nowpublic, and the builder's#PreviewseedsCurrent.serverswith it, so the server-gated form (including the live complication mock) renders in Xcode previews.FloatingPanelinHADesignSystem(registered in the components gallery) — a picture-in-picture panel that follows the finger, snaps to the nearest corner on release (flick-aware via predicted end point), and resizes by tap-toggle or pinch. In the complication builder, once the inline preview section scrolls off-screen the preview re-appears floating over the form, showing only the selected family centered and zoomed to fit a compact watch face; the panel chrome radius is concentric with the watch bezel.isCustomizedcolumn onWatchComplicationConfig(added automatically by the existing column migration); rows saved before the flag fall back to inferring it from per-size overrides.