Skip to content

alarms: one wake schedule for the strap alarm and the wind-down reminder - #37

Merged
DX23876 merged 3 commits into
mainfrom
alarm-shared-wake-time
Oct 5, 2026
Merged

DX23876 merged 3 commits into
mainfrom
alarm-shared-wake-time

Conversation

@DX23876

@DX23876 DX23876 commented Oct 4, 2026 •

Copy link
Copy Markdown
Owner

What this PR does

Supersedes #36 (by @rodrigosa7) and carries its commit. #36 moved the per-day wake times under the strap alarm. The idea is right, but as written it also:

  • left the wind-down reminder with no editable wake time while the strap alarm is off (the picker was removed, and the per-day editor only shows with the alarm on);
  • overwrote the reminder's stored wake time on every visit (onAppear), silently re-timing the reminder;
  • deleted a day's own time when its alarm weekday was deselected, although the reminder fires every evening and still used it;
  • showed "—" in the hero and hid "You'll be reminded around …" as soon as any per-day time existed;
  • removed copy that AlarmWakeTimeLabellingTests pins, so StrandTests would fail.

This PR keeps the direction (one wake time) and fixes those points:

  • New "Wake time" card, always visible. It holds the usual wake time plus the per-day times. The strap alarm and the reminder both read it, and the card states that the time only wakes you when the strap alarm is on.
  • Strap alarm card: switch, weekdays and arming status, with no picker of its own.
  • One-time merge of the two previously stored times (alarm.wakeTimesUnified). It takes the reminder's time when only the reminder was on, otherwise the alarm's, so an armed alarm is never re-timed. This replaces the per-visit sync.
  • Deselecting an alarm weekday keeps that day's own time. The per-day editor lists all seven days.
  • Schedule edits re-arm the strap only while the alarm is on (rearmStrapAlarmIfOn), so editing the reminder's times never writes a disable to the strap.
  • Hero and reminder line resolve the next wake, per-day time included, instead of showing a dash.
  • Visual changes:
    • Card order is now Hero → Wake time → Strap alarm → Wind-down → honesty note. The honesty note is still below the alarm it refers to, and no longer splits the two features.
    • Days with their own time sit on an inset fill.
  • WindDownNudge.nudgeMinuteOfDay(forWake:) is extracted as a pure helper. The existing callers return the same output.

Analysis migration required: no. This only changes alarm and reminder scheduling.

Type of change

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

How it was tested

  • python3 Tools/i18n_audit.py --ci origin/main: passes. The one new string is translated into all nine locales. As a cross-check, the gate fails without the catalog entry.
  • python3 Tools/doc_comment_lint.py: passes. git diff --check: clean.
  • Not compiled locally: this was authored on Linux, where SwiftUI is unavailable. app-build.yml on head 88aec97 passed: Strand (macOS) and NOOPiOS (iOS Simulator) both build, and StrandTests passed on the macOS leg.
  • New AlarmWakeScheduleTests: merge rule, next-wake resolution (including the wake-minute edge and the Sat→Sun wrap), and nudgeMinuteOfDay(forWake:) parity with the stored-wake path.
  • AlarmWakeTimeLabellingTests is updated to the single-schedule model:
    • exactly one base-time picker, sharing a card with the per-day editor;
    • the wake time says when it wakes you;
    • weekday changes don't clear overrides;
    • schedule edits re-arm only through the gated helper.
  • No BLE wire behaviour changed. The only BLE-adjacent difference is that schedule edits with the alarm off no longer send disableStrapAlarm. Not tested on a strap.

Checklist

  • Swift package tests pass for any package I touched: no package touched
  • The affected Apple app schemes build (Strand and/or NOOPiOS): both pass in app-build.yml
  • No new build warnings introduced: not verified; the build log was not inspected for warnings
  • 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/signing material

Related issues

Supersedes #36.


Generated by Claude Code

Builds on #36, which moved the per-day wake times under the strap alarm. That left the
reminder without any editable wake time while the alarm is off, overwrote the reminder's
stored time on every visit, deleted a day's own time when its alarm weekday was deselected,
and blanked the hero whenever any per-day time existed.

- New "Wake time" card, always visible: the usual wake time plus the per-day times. Both
  the strap alarm and the reminder read it; it states that it only wakes you when the
  strap alarm is on.
- The strap alarm card keeps the switch, weekdays and arming status, no picker of its own.
- One-time merge of the two stored times: the reminder's when only the reminder was on,
  otherwise the alarm's, so an armed alarm is never re-timed. Replaces the per-visit sync.
- Deselecting an alarm weekday keeps that day's own time; the editor lists all seven days.
- Schedule edits re-arm the strap only while the alarm is on, so editing the reminder's
  times never writes a disable to the strap.
- Hero and reminder line resolve the next wake, per-day time included, instead of a dash.
- Days with their own time sit on an inset fill; the honesty note moves to the end.
- One new string, translated into all nine locales. Source-contract tests updated to the
  single-schedule model; pure tests for the merge rule and next-wake resolution.

Analysis migration required: no. Alarm and reminder scheduling only.
Copilot AI balanced review requested due to automatic review settings October 4, 2026 19:55

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

# Conflicts:
#	Strand/Resources/Localizable.xcstrings
@DX23876
DX23876 merged commit b40fa22 into main Oct 5, 2026
8 of 10 checks passed
@DX23876
DX23876 deleted the alarm-shared-wake-time branch October 11, 2026 17:44
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