Skip to content

feat(settings): persist practice difficulty and MS tap-mode across launches - #746

Merged
wei18 merged 1 commit into
mainfrom
feat/720-persist-practice-difficulty-tapmode
Jul 10, 2026
Merged

wei18 merged 1 commit into
mainfrom
feat/720-persist-practice-difficulty-tapmode

Conversation

@wei18

@wei18 wei18 commented Jul 10, 2026

Copy link
Copy Markdown
Owner

Closes #720 — the 3 persistence gaps from the inventory (players expect these to stick; they reset every launch):

What (11 files, +399/−6)

  • New shared seam GameAppKit/LastSelectionStore(key:fallback:defaults:) — injectable-UserDefaults string store mirroring the existing MinesweeperWinCountStore shape; one implementation, parameterized per game (mirror principle — no per-app copies).
  • G1 Sudoku practice difficulty → com.wei18.sudoku.practice.lastDifficulty (VM constructor seed + persist closure, wired in LiveRouteFactory's .practice branch).
  • G2 MS practice difficulty → com.wei18.minesweeper.practice.lastDifficulty (view had no write-back seam — added onDifficultyChanged + internal binding).
  • G3 MS board tap-mode (reveal/flag) → com.wei18.minesweeper.board.tapMode, reseeded per board open, garbage raw values fall back to Reveal.
  • First-run fallbacks preserve today's defaults (Medium / Beginner / Reveal). Theme picker + pencil mode stay out of scope per the recorded dispositions.

Verification

  • 15 new tests: store round-trip + suite isolation (ephemeral UserDefaults suites, never touching .standard), per-gap seed/persist/relaunch-simulation (two independent instances, not same-instance re-reads), garbage-value fallback.
  • Reviewer independently re-ran all three packages: GameAppKit 32/32 · SudokuKit 274/274 · MinesweeperKit 232/232; swiftlint --strict 0; zero snapshot changes.

Review

Dual review (sonnet + haiku): zero findings. Sonnet verified the seam's suite isolation, the three key spellings against the issue, the .practice-branch-only composition change, the minimal MinesweeperEngine dependency addition, and that the relaunch-simulation tests are not tautologies.

🤖 Generated with Claude Code

Sudoku/Minesweeper Practice hubs reset to Medium/Beginner and the
Minesweeper board's tap-mode toggle reset to Reveal every launch even
though players expect these choices to stick (#720 gap-fill: G1/G2/G3).

Adds a shared `LastSelectionStore` (GameAppKit) — a UserDefaults-backed
"last selected" String preference, mirroring `MinesweeperWinCountStore`'s
injectable-UserDefaults shape — reused for all three gaps since
MinesweeperUI already depends on GameAppKit for GameRootViewModel:

- G1: `PracticeHubViewModel` gains `initialDifficulty` / `persistDifficulty`,
  wired at SudokuAppComposition/LiveRouteFactory.
- G2: `MinesweeperPracticeHubView` gains `onDifficultyChanged`, wired at
  MinesweeperAppComposition/LiveRouteFactory.
- G3: `MinesweeperBoardView`'s tap-mode `@State` seeds from and persists to
  the same store directly (MS-only, no composition-root threading needed).

Closes #720.

Co-Authored-By: Claude Fable 5 <[email protected]>
@wei18
wei18 enabled auto-merge (squash) July 10, 2026 06:44
@wei18
wei18 merged commit 9a80cde into main Jul 10, 2026
4 checks passed
@wei18
wei18 deleted the feat/720-persist-practice-difficulty-tapmode branch July 10, 2026 06:44
wei18 added a commit that referenced this pull request Jul 10, 2026
Records the composition rename (#739/#745), settings-persistence
inventory + LastSelectionStore fill (#720/#746), the two-round
Acknowledgements diagnostic (#721/#748), the #700/#738 ASCRegister
apply closeout (11 achievements + 77 loc, 21 leaderboard-loc UPDATEs),
and the #713 upkeep-triage disposition including the unreconciled
13-vs-15 finding-count discrepancy.

Co-authored-by: Claude Fable 5 <[email protected]>
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.

chore(settings): inventory every user-facing setting's persistence and fill the gaps

1 participant