Skip to content

feat(settings): daily-reminder entry in both apps' Settings, with off-toggle (#287) - #419

Merged
wei18 merged 2 commits into
mainfrom
feat/287-reminders-in-settings-v2
Jun 8, 2026
Merged

wei18 merged 2 commits into
mainfrom
feat/287-reminders-in-settings-v2

Conversation

@wei18

@wei18 wei18 commented Jun 8, 2026

Copy link
Copy Markdown
Owner

Closes #287. Surfaces a user-initiated daily-reminder entry in BOTH apps' Settings using the existing RemindersKit (scheduling + auth were already built; the gap was no Settings enable path + nothing in MS). Shared GameShellUI ReminderSettingsModel + ReminderSettingsSection (enable→primer→authorize→schedule; fire-time persist+reschedule gated on auth; denied recovery; off-toggle wired to disable(); store-agnostic via injected closures; no UserNotifications leak into the shared target). Both apps mirror it. +reminderCancelled TelemetryEvent. 21+ keys × 7 locales.

CR (REQUEST CHANGES on v1) addressed: L10n fixture regenerated (scan:l10n passes — was the blocker); OFF affordance added + tested (offAffordanceCancelsAndEmitsWhenOn); reminderCancelled telemetry wired (was nil); enable() double-tap guard. Leader-verified: scan:l10n pass, OFF test green. Tests: GameShellKit 28, SudokuKit 216, MinesweeperKit 112, TelemetryKit 29 green. (Two scoped swiftlint:disable with codebase precedent: file_length on the grown Live.swift composition root, cyclomatic_complexity on OSLogSink — flagged as tech-debt.)

wei18 and others added 2 commits June 9, 2026 02:48
#287)

The reminder permission-priming UI + RemindersKit scheduling already existed,
but the only entry point was the post-Daily-completion primer. A player who
never solved a Daily — or declined that primer — had no way to enable reminders.
This adds a user-initiated Reminders entry to the Settings screen of BOTH apps.

Shared (GameShellUI):
- ReminderSettingsModel — @observable driver for the Settings entry: refreshes
  auth status on appear, presents the shared ReminderPrimerSheet to prime +
  request authorization, schedules/cancels the daily reminder, owns the fire-time
  and reschedules on change (gated on authorization). Store-agnostic via injected
  get/set fire-time closures; telemetry-decoupled via an Event emit seam. Never
  imports UserNotifications.
- ReminderSettingsSection — the shared Section: enable button (→ primer) when
  not-authorized, "On" + hour/minute DatePicker when authorized, denied-recovery
  row (→ ReminderDeniedExplainer) when denied. Copy fully injected; tint as Color
  (no theme dep) so Minesweeper mounts the identical section.

Sudoku: SettingsView adopts the shared section/model (retires the #321 time-only
ReminderTimeSettingsModel/row — it was Settings-only). Live.swift bridges the
fire-time to the existing ReminderSettingsStore (still shared with the post-Daily
coordinator) and the model Event to Telemetry.

Minesweeper (mirrors Sudoku): adds RemindersKit dep, SettingsView mounts the same
shared section, Live wires LiveReminderScheduler/LiveNotificationAuthorizer +
UserDefaults fire-time (com.wei18.minesweeper.reminder.*) + MS copy.

Reused as-is: RemindersKit (seams, Live conformers, scheduling, fakes),
ReminderPermissionModel, ReminderPrimerSheet, ReminderDeniedExplainer,
ReminderSettingsStore (Sudoku), the post-Daily ReminderPrimerCoordinator.

Does NOT touch AppComposition.swift boot sequence or any ATT path; priming is
user-initiated from Settings only.

Localization: +21 keys each in the Sudoku + Minesweeper String Catalogs, full
7-locale coverage (en/es/ja/ko/th/zh-Hans/zh-Hant), 0 <TRANSLATE>.

Tests: GameShellKit 26 / SudokuKit 210 / MinesweeperKit 111 GREEN. New
ReminderSettingsModel scheduler-seam coverage (authorization gating,
schedule/cancel, picker persist+reschedule) via RemindersTesting fakes.

Co-Authored-By: Claude Opus 4.8 <[email protected]>
…elemetry (#287 CR)

Addresses the #287 Code Review on a rebase of feat/287-reminders-in-settings
onto latest main (picks up #417 ATT).

BLOCKER — stale L10n fixture (scan:l10n drift gate):
- The #287 reminder keys landed in App/Sudoku/Resources/Localizable.xcstrings
  but the AppCompositionTests byte-copy fixture
  (Packages/SudokuKit/Tests/AppCompositionTests/Resources/Localizable.xcstrings.json)
  was not regenerated, so the cmp-vs-shipping gate would fail.
- Ran `mise run gen:l10n_fixture`; the fixture now byte-matches shipping.
  `mise run scan:l10n` passes (0 placeholders, 7 locales, fixture in sync).

UX gap — in-app OFF affordance:
- ReminderSettingsModel.disable() existed + was tested but was unreachable from
  the UI: once On, a user could not turn reminders off in-app.
- ReminderSettingsSection now renders a destructive "Turn off reminders" row in
  the authorized/provisional (On) branch, wired to model.disable() (cancels the
  scheduled notification, emits .cancelled). Whole-row hit target + accessibility
  id `reminders.settings.disable`, consistent with the existing enable/denied rows
  and the injected copy + tintColor.
- New copy field `disableTitle` on ReminderSettingsCopy; both apps pass
  "Turn off reminders" with full 7-locale coverage (en/es/ja/ko/th/zh-Hans/zh-Hant)
  in both String Catalogs; fixture regenerated.

Telemetry — cancellation funnel:
- Added TelemetryEvent.reminderCancelled(kind:) (mirrors reminderScheduled) +
  its OSLogSink case, so the on→off funnel is observable.
- Both apps' AppComposition/Live.swift map ReminderSettingsModel.Event.cancelled
  → .reminderCancelled (was nil).

Also (CR):
- Defensive `guard !isPrimerPresented` in enable() to stop a double-tap
  re-entering before the primer sheet commits.

Lint:
- swiftlint:disable file_length on Sudoku Live.swift (composition root crossed
  400 lines once #287 + #417 both wired here) and a scoped
  cyclomatic_complexity disable on the pre-existing OSLoggerAdapter.log helper
  (unchanged by this PR but lint-gated because the file is touched). Matches the
  ASCClient / MetadataConfig file_length precedent.

Tests (swift test GREEN):
- GameShellKit 28 (new: OFF-affordance disable→cancel+emit; enable() double-tap guard)
- SudokuKit 216 (incl. AppCompositionTests L10n fixture-sync gate + telemetry wiring)
- MinesweeperKit 112
- TelemetryKit 29

Co-Authored-By: Claude Opus 4.8 <[email protected]>
@wei18
wei18 merged commit f83ac99 into main Jun 8, 2026
4 checks passed
@wei18
wei18 deleted the feat/287-reminders-in-settings-v2 branch June 8, 2026 19:12
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.

feat: RemindersKit — local notification reminders + permission priming (shared target) [PROPOSAL_APPROVED, parked]

1 participant