Skip to content

Android: battery % and recorded-nights streak strip on Today screen#256

Closed
ujix wants to merge 2 commits into
NoopApp:mainfrom
ujix:android/today-battery-streak
Closed

Android: battery % and recorded-nights streak strip on Today screen#256
ujix wants to merge 2 commits into
NoopApp:mainfrom
ujix:android/today-battery-streak

Conversation

@ujix

@ujix ujix commented Jun 13, 2026

Copy link
Copy Markdown

What this PR does

Executive summary: Adds a compact status strip at the top of the Today content area showing live strap battery percentage and a total-nights-recorded streak with a fire icon.

Details:

Today screen

  • Added: Compact Row pinned to the top-right of the Today content area; visible whenever the strap is connected
  • Added: Live strap battery % — shown with a Battery5Bar icon when the strap is connected and battery level is available
  • Added: Total recorded nights streak with a LocalFireDepartment icon — icon and count turn statusCritical (red) when streak ≥ 2, gray otherwise

Validation: :app:assembleFullDebug, testFullDebugUnitTest, and testDemoDebugUnitTest all green.

Type of change

  • Bug fix
  • New feature
  • Refactor / cleanup
  • Documentation
  • CI / tooling

How it was tested

Android 16. Real Samsung device. WHOOP 4.0. Tested: battery icon appears only when connected, streak count matches recorded nights, streak ≥ 2 triggers red color, strip absent when strap disconnected.

Checklist

  • Swift package tests pass for any package I touched (swift test in Packages/<name>)
  • Android unit tests pass if I touched android/ (./gradlew testFullDebugUnitTest)
  • No new build warnings introduced
  • UI changes use only StrandDesign tokens — no hardcoded colors, fonts, or spacing
  • No hardcoded hex frame bytes; protocol facts live in the schema / decoders
  • Follows the conventions in docs/CONTRIBUTING.md
  • I did not commit generated output (Strand.xcodeproj/) or any secrets/keystores

Related issues

Wraps the HR line chart in a Row with a SpaceBetween Y-axis column
(max/avg/min bpm) and adds an X-axis row below with three HH:mm time
labels computed from the 5-minute bucket index. Enables selectionEnabled
for tap/drag value inspection. Footer labels now show unit 'bpm'.
@NoopApp

NoopApp commented Jun 13, 2026

Copy link
Copy Markdown
Owner

The live strap-battery % on the Today header is a genuinely nice touch, and nightStreak() handles the edge cases (gaps, empties, consecutive counting) correctly.

The recorded-nights streak is the part that's a product-tone decision: streak/gamification mechanics change the feel of the app, so that's a deliberate call rather than something to quietly add. This PR also bundles the same DayNavBar as #255 — we'd dedupe if both proceed — so I'm holding it open alongside #255 while we settle the Today direction. One small thing for whenever it lands: the battery and streak icons need contentDescription labels. Appreciate it!

Adds a compact status strip (top-right of content area) showing the live
strap battery percentage (icon + %) when connected, and a fire icon with
the total recorded-nights count. Fire turns red when the streak is >= 2
consecutive nights. nightStreak() walks the sorted day set from today
backwards, allowing a one-day gap for the current live day.
@ujix ujix force-pushed the android/today-battery-streak branch from a34518f to ab13ed9 Compare June 13, 2026 15:33
@ujix

ujix commented Jun 13, 2026

Copy link
Copy Markdown
Author

You're right — the branch was stacked on top of today-day-nav (#255), which dragged the DayNavBar commits in. I've rebased android/today-battery-streak directly onto android/today-hr-chart so the PR now contains only the battery % + recorded-nights streak strip (one commit, 47 lines in TodayScreen.kt). The DayNavBar belongs exclusively to #255 now.

On the product-tone point about streak gamification — totally understand. Happy to keep this on hold alongside #255 while you settle the Today direction.

@NoopApp

NoopApp commented Jun 13, 2026

Copy link
Copy Markdown
Owner

Thanks for the clean rebase — isolating it to just the battery % + streak strip (off the DayNavBar) is exactly right, and dedupes it from #255. The battery % is a clear win. The recorded-nights streak is the one piece I'm still flagging as a product-tone call — gamification mechanics change the app's feel, so that's a deliberate maintainer decision rather than something to auto-adopt. The PR's in good shape for whenever that's settled.

NoopApp added a commit that referenced this pull request Jun 13, 2026
…nment polish

#255 (adapted from a community PR by ujix): replace the fixed 3-day selector
with a DayNavBar — chevron prev/next + a date-picker jump, capped at today —
on Android, plus a new shared StrandDesign DayNavBar and full day navigation
wired into the iOS/macOS Today screen for parity.

#256 (ujix): a live strap-battery % + recorded-nights streak strip on the
Android Today header, with spoken accessibility labels.

#234 (RichrdJ): iOS polish — unify the two Synthesis hero cards' alignment and
give the manual-workout Avg HR / Calories fields equal widths.
NoopApp added a commit that referenced this pull request Jun 13, 2026
…on, Live perf

macOS CFBundle 99 / iOS projver 54 / Android versionCode 141.

New: sleep-debt ledger (#242), daytime stress timeline (#239), recovery
forecast (#240), day-by-day Today navigation (#255), Android battery+streak
strip (#256). Improved: iOS/macOS Live-tab performance (#271). Fixed: iOS
Today/manual-workout alignment (#234).
@NoopApp

NoopApp commented Jun 13, 2026

Copy link
Copy Markdown
Owner

Adopted ✅ — battery % + recorded-nights streak strip (with a11y labels), shipped in v2.10.0, re-landed under the project account. Thank you! Closing as adopted.

@NoopApp NoopApp closed this Jun 13, 2026
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.

2 participants