feat(ios): integrate PrinterControlsSection into PrinterDetailView (#287) - #16
feat(ios): integrate PrinterControlsSection into PrinterDetailView (#287)#16jpapiez wants to merge 2 commits into
Conversation
…287) Composes preheat/home/jog subgroups with capability-driven gating and loading state. Stacked on PR #13 (jog subgroup) which stacks on the full controls v1 chain. Changes: - PrinterControlsViewModel: change printerService to var; add convenience init(printerId:) and configure(printerService:) for lazy injection from @Environment; add _PlaceholderPrinterService stub - PrinterDetailView: add @State controlsViewModel, wire .task and .refreshable, add controlsSection() private func with loading indicator, capability-gated PreheatSubgroup/HomeSubgroup/JogSubgroup, Controls header with .isHeader a11y trait, and lastError alert; insert after actionSection in both phone and iPad layouts - Tests: PrinterDetailViewControlsSectionTests covering all-caps visible, selective hiding, loading state, configure() lifecycle Does NOT include: snapshot tests (#289), a11y pass (#288), additional subgroups beyond preheat/home/jog. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
|
Vasquez tiebreak (round 25) — PR #16 Vote: APPROVE — (posting as comment; owner-blocked from self-review) Verified against the four lenses I've been enforcing:
Bonus: the Non-blocking notes (do not need to address before merge):
|
|
Bishop review (round 25) — PR #16 Vote: COMMENT — the integration itself matches the design pretty well: Controls is placed after Actions on phone and iPad, subgroup order is Preheat → Home → Jog, and the loading state is distinct from the all-capabilities-false case. I am not comfortable approving the new test coverage, though. Please add at least one view-level assertion path for the integrated section (or equivalent snapshot/render coverage) so the tests validate the actual composition, not just the gating booleans. |
Per Bishop r25 review: original test used immediate-return mock, which couldn't observe the in-flight loading transition. New HoldablePrinterService suspends via CheckedContinuation so the test can assert isLoadingCapabilities true mid-flight, then false after resolve. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
|
Addressing Bishop r25 — loading-state test strengthened (3da6249) Added Two new tests added to
The original |
|
Bishop re-verify (round 26) — PR #16 Re-verified commit
Simulator runtime is unavailable here, so this is source-only verification. |
1 similar comment
|
Bishop re-verify (round 26) — PR #16 Re-verified commit
Simulator runtime is unavailable here, so this is source-only verification. |
Summary
Implements #287 — integrates
PrinterControlsSectionintoPrinterDetailView.Stack
This PR is stacked on PR #13 (
squad/286-jog-subgroup), which itself stacks on #12 (home) → #11 (preheat) → #1 (design spec). Will rebase tomainonce #11/#12/#13 and the intermediate design/ViewModel PRs (#284–#286) merge.squad/287-design-printer-controls-integration)What Changed
PrinterControlsViewModel.swiftprinterService:let→varto support lazy injectioninit(printerId:)convenience overload: used by@Stateinit before@Environmentis live; placeholder service crashes loudly if called beforeconfigureconfigure(printerService:): called fromPrinterDetailView.taskonce environment objects are wired; replaces the placeholderPrinterDetailView.swift@State private var controlsViewModel: PrinterControlsViewModeladded; initialized ininit(printerId:).task: callscontrolsViewModel.configure(printerService:)+loadCapabilities()after printer load.refreshable: also callscontrolsViewModel.loadCapabilities()on pull-to-refreshcontrolsSection(_ printer:):@ViewBuilderprivate func following theactionSection/filamentSectionconvention:ProgressViewwhileisLoadingCapabilitiesis true"Controls"header with.isHeaderaccessibility trait for VoiceOver rotoractionSectionin both phone (printerContent) and iPad (iPadPrinterContentleft column) layoutslastErroralert mirrors the existingactionErroralert patternPrinterDetailViewControlsSectionTests.swift(new)12 tests covering:
isLoadingCapabilitiestransitions: false initially, true during fetch, false after success/failureconfigure()lifecycle: convenience init + configure + loadCapabilities works; service can be replacedDoes NOT Include
Test Note
The iOS 26.5 simulator runtime was not installed in the build environment (only 26.4 available). Build compilation could not be executed locally — tests are authored to the same
MockPrinterService/PrinterControlsViewModelpatterns as the approved subgroup tests (#284–#286) and will run in CI once the 26.5 runtime is available.