Skip to content

refactor(sleep): split SleepScreen UI into sibling files (re-cut of #734) - #1426

Merged
ryanbr merged 1 commit into
mainfrom
refactor/sleep-ui-sections-v2
Aug 18, 2026
Merged

ryanbr merged 1 commit into
mainfrom
refactor/sleep-ui-sections-v2

Conversation

@ryanbr

@ryanbr ryanbr commented Aug 18, 2026

Copy link
Copy Markdown
Owner

Supersedes #734 by @tigercraft4, re-cut against current main. That PR was ~388 commits behind and SleepScreen.kt had since been rewritten +608/−103, so the original code-motion no longer applied; this redoes the same extraction cleanly on today's file.

What (pure UI code-motion, no behaviour change)

Moves three clusters out of SleepScreen.kt (3605 → ~1900 lines), keeping each comment with its code:

  • SleepNightNavUi.kt — sleep window row + night navigation / edit / delete controls
  • SleepMetricCardsUi.kt — metric grid, sleep-debt ledger, stage comparison, trend cards, shared Sleep chart helpers
  • SleepMetricDetailSheet.kt — the metric detail bottom sheet

No sleep calculations, storage, BLE behaviour, or screen wiring changed.

Fixes over the original

  • Polish translation added for the two delete-dialog body strings (values-pl is gated at zero — the original added de/es/fr/pt/zh but not pl, which would fail the i18n gate on current main).
  • Imports trimmed + deduped in the touched files.
  • Cross-file helpers widened private → internal; the generic helper names that collide across screens (Hairline/ChartCard/ChartFooter/LegendDot) are renamed to Sleep-prefixed internals so they don't clash with other screens' private copies.

Validation (local)

  • compileFullDebugKotlin ✓ · compileFullDebugUnitTestKotlin ✓ · processFullDebugResources (aapt) ✓
  • python3 Tools/i18n_audit.py --ci origin/main ✓ (the 2 strings move out of the hardcoded baseline, 243 → 241; all focus locales + pl complete)

Credit: @tigercraft4 (original extraction + de/es/fr/pt/zh translations).

Re-cut of the extraction in #734 (by @tigercraft4) against current main, which had
moved on ~388 commits (SleepScreen.kt rewritten +608/-103 since that branch point).
Pure UI code-motion, no behaviour change: moves three clusters out of SleepScreen.kt
into siblings, keeping each comment with its code:

- SleepNightNavUi.kt — sleep window row + night navigation / edit / delete controls
- SleepMetricCardsUi.kt — metric grid, debt ledger, stage comparison, trend cards,
  shared Sleep chart helpers
- SleepMetricDetailSheet.kt — the metric detail bottom sheet

Fixes over the original: adds the missing Polish translation for the two delete-dialog
body strings (values-pl is gated at zero), and trims/dedupes imports in the touched
files. Cross-file helpers widened private->internal; the generic helper names that
collide across screens (Hairline/ChartCard/ChartFooter/LegendDot) are renamed to
Sleep-prefixed internals so they do not clash with other screens private copies.

No sleep calculations, storage, BLE, or screen wiring changed. compileFullDebugKotlin
+ compileFullDebugUnitTestKotlin + processFullDebugResources + i18n --ci all green.

Co-authored-by: tigercraft4 <tigercraft4@users.noreply.github.com>
@ryanbr ryanbr mentioned this pull request Aug 18, 2026
6 of 12 tasks
@ryanbr
ryanbr merged commit 100ce3b into main Aug 18, 2026
3 checks passed
@ryanbr
ryanbr deleted the refactor/sleep-ui-sections-v2 branch August 18, 2026 03:07
ryanbr added a commit that referenced this pull request Aug 18, 2026
Build numbers only. MARKETING_VERSION / versionName stay 10.1.1 — the staging
line is one above the latest release (v10.1.0) and holds there until 10.1.1
actually ships.

versionCode 341 -> 342 and CURRENT_PROJECT_VERSION 223 -> 224, both +1 past the
previous staging build so a sideloaded update installs in place rather than
being refused as a downgrade.

Picks up since the last testing build (f2271cd): backup build provenance
(#1422), the CTL/ATL/TSB training-load engine (#1423) and its Trends card
(#1425), sleep-vs-wake HR contrast (#1424), the v20 optical decoder + CRC gate
(#895), the Sleep UI split (#1426), the WHOOP4 clock-correlation fix (#1427),
the settings waist-row layout + copy fix (#1428), hourly Apple step import
(#1429), Low refresh (#1430), and Power saving moving into More with a 35%
ceiling (#1431).
rntcruz23 pushed a commit to rntcruz23/noop that referenced this pull request Aug 26, 2026
…>SleepChartCard rename

The PR #19 sync merge (b0cd204) auto-merged SleepScreen.kt with ZERO
conflicts, but upstream's own ryanbr#1426 ("split SleepScreen UI into sibling
files") had renamed the shared ChartCard/StrokeCap-adjacent helpers into
Sleep-prefixed internals to avoid name collisions across screens - ChartCard
became SleepChartCard, now defined (and made non-private) in the new sibling
SleepMetricCardsUi.kt. Every one of upstream's own call sites in SleepScreen.kt
picked up the rename cleanly during the merge; the one exception was the
fork-only SleepCyclesChart card (the Apple-Health-style staircase, carried
forward unchanged across several syncs), which still called the old
`ChartCard` name. That name still resolves in the SOURCE TREE (TrendsScreen.kt
has its own unrelated private ChartCard), so nothing conflicted - it just
silently called the wrong, inaccessible overload, producing a compile error
that no diff-level check would catch: compileFullReleaseKotlin failed with
"Cannot access 'ChartCard': it is private in file" plus a cascade of
"Type mismatch" / "No value passed for parameter" errors as the compiler
tried to match the call against unrelated overloads.

Same root file also lost its StrokeCap/TextAlign imports, used only by
fork-only code the same ryanbr#1426 refactor's import-trimming pass had no way to
know about (it correctly trimmed what upstream's OWN moved-out code no
longer needed in SleepScreen.kt, but the fork's remaining SleepCyclesChart
still uses both for the staircase's stage colouring and clock-label row).

Fix: renamed the one stale ChartCard(...) call to SleepChartCard(...)
(identical parameter shape - title/subtitle/trailing/footer/tint/chart, so
no other change needed), and restored the two missing imports.

Verified with a much more thorough check than the isolated-file compiles
used in prior fixes: compiled SleepScreen.kt together with EVERY sibling
Sleep*.kt file plus Components.kt/StrandComponents.kt/PaletteTokens.kt/
Theme.kt (the real dependency graph, not just the files that had merge
conflicts) with the real Kotlin 1.9.24 compiler - zero "Cannot access",
"Conflicting overloads", "Overload resolution ambiguity", "Type mismatch",
or "No value passed for parameter" errors anywhere in SleepScreen.kt, and
confirmed no other stale ChartCard(...) call site exists anywhere in the
module. Methodology note for next time: a file that auto-merges with ZERO
conflicts can still break if fork-only code inside it depends on a symbol
upstream renamed/relocated elsewhere in the same batch - conflict markers
alone are not sufficient signal that a file is safe.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012pwRSEnFWdsYMC7CLXWNEW
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant