Repository navigation
feat(minesweeper): Game Center leaderboard + submit-on-win (#291) - #312
Merged
Merged
Conversation
…hboard (#291) Mirror Sudoku's Game Center integration for Minesweeper: - Wire the shared `GameCenterClient` into `MinesweeperAppComposition` (`.live()` = `LiveGameCenterClient(authDriver: GKAuthDriver())`, `.preview()` = `FakeGameCenterClient`); thread through `LiveRouteFactory` → `MinesweeperBoardView` → `MinesweeperGameViewModel`. - Add a game-agnostic raw submit to the shared protocol: `submitScore(leaderboardId:elapsedSeconds:)`. Sudoku's typed `submitScore(puzzleId:…)` now delegates to it (single centisecond- conversion site). The Sudoku-typed method's `SudokuEngine.Difficulty` + `LeaderboardKind` coupling kept it unusable for MS directly. - `MinesweeperGameCenterDashboard` — native GC modal presenter mirroring Sudoku's `GameCenterDashboard` (iOS `GKGameCenterViewController`, macOS `GKAccessPoint` collapse). NOT an AppRoute (#49). - Enable the Home Leaderboard card (remove `.disabled`, "Coming soon" → "Best times"); `select(.leaderboard)` presents the dashboard modal. - `MinesweeperLeaderboardID` — per-difficulty `.v1` best-time leaderboard IDs (beginner/intermediate/expert). ASC registration of these IDs is a separate user-owned / ASCRegister step. - Submit-on-win in `MinesweeperGameViewModel`: on `.won`, submit elapsed seconds to the difficulty's best-time leaderboard exactly once; errors funnel through `ErrorReporter` (non-blocking, no-retry, never crashes gameplay — mirrors Sudoku's `GameCenterSink`). Tests: submit-on-win (per-difficulty id + once + swallowed-error + losing-never-submits), leaderboard-card present (no route push), raw-submit centisecond conversion. MinesweeperKit 62 tests green; GameCenterKit suite green; SudokuKit builds (additive protocol change). Zero Sudoku source touched. Closes #291 Co-Authored-By: Claude Opus 4.8 <[email protected]>
wei18
added a commit
that referenced
this pull request
Jun 4, 2026
…oring Sudoku (#291) (#328) * feat(ascregister): app-aware GC config + Minesweeper daily leaderboards (#291) Make the Game Center leaderboard reconcile app-parameterized, mirroring the metadata `--app <sudoku|minesweeper>` precedent (#310), without duplicating the reconciler or touching Sudoku's behavior. - New `Config.GCApp` enum (sudoku|minesweeper); `Config.leaderboards(for:)` + `ConfigSnapshot.live(for:)` return the per-app leaderboard set. Sudoku's `Config.leaderboards` / `.live` stay as the default, so every existing call site (validate, iap, tests) is unchanged. - `plan` / `apply` / `validate` accept optional `--app` (defaults to sudoku); for `--app minesweeper` the action list is filtered to leaderboard actions (MS has no achievements/IAPs in its GC detail). - Add MS's 3 recurring-daily leaderboards `com.wei18.minesweeper.leaderboard.{easy,medium,hard}.daily.v1` — same shape as Sudoku (ELAPSED_TIME_CENTISECOND, ASC sort, FREQ=DAILY;INTERVAL=1, PT24H, BEST_SCORE), with reference names + en/zh-Hant title localizations under an app-scoped `gc.minesweeper.leaderboard.*` xcstrings namespace. - `LeaderboardConfig` gains `titleKey` so each app's title key namespace flows through the reconciler unchanged. - ConfigConsistencyTests: pin the 3 MS leaderboard ids byte-equal to the MS runtime constant + assert the recurring-daily shape, so a drift fails a test. Co-Authored-By: Claude Opus 4.8 <[email protected]> * feat(minesweeper): per-difficulty daily Game Center leaderboards mirroring Sudoku (#291) Change MS runtime leaderboard ids from the non-recurring best-time shape to Sudoku's recurring-daily shape, so the MS leaderboards mirror Sudoku exactly (supersedes #291 Decision 3 per the GC-leaderboards dispatch). - `MinesweeperLeaderboardID`: `{beginner,intermediate,expert}.besttime.v1` → `{easy,medium,hard}.daily.v1`. MS engine difficulty (beginner/intermediate/expert) maps to Sudoku's id segment (easy/medium/hard); ids stay byte-equal to `Config.leaderboards(for: .minesweeper)` (ConfigConsistencyTests pins it). `bestTime(for:)` → `daily(for:)`. - Submit site (`MinesweeperGameViewModel`) + completion dashboard (`MinesweeperBoardView`) call `daily(for:)`; submit stays latched + non-blocking (no behavior change beyond the id, #312 policy preserved). - Tests updated to the daily-id scheme + a difficulty→segment mapping assertion. Note for Leader: MS still submits on ALL wins; Sudoku gates on daily-mode only. See meetings/2026-06-04_ms-gc-daily-leaderboards-asc.impl-notes.md for the divergence + open decision. Co-Authored-By: Claude Opus 4.8 <[email protected]> --------- Co-authored-by: Claude Opus 4.8 <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #291. Wires Minesweeper's Game Center leaderboard, mirroring Sudoku.
GameCenterKit: added a game-agnosticsubmitScore(leaderboardId:elapsedSeconds:)primitive to the protocol; Sudoku's typedsubmitScore(puzzleId:difficulty:leaderboardKind:)now delegates to it (behavior-identical). Keeps MS types out of the shared layer.MinesweeperGameCenterDashboard(GKGameCenterViewController modal, mirror Sudoku Switch to native GameCenter UI — remove custom LeaderboardView #49 — not an AppRoute), Home Leaderboard card enabled (no longer a stub),MinesweeperLeaderboardID(per-difficulty.v1best-time IDs), submit-on-win inMinesweeperGameViewModel.submitBestTimeIfWon()(latched once per win, non-blocking via ErrorReporter)..live()= LiveGameCenterClient,.preview()= Fake.CR: APPROVE-WITH-NITS (no Blocker/High). Verified: Sudoku leaderboard submission behavior-identical (3 Sudoku tests assert exact ID+score, green); MS submit latched + non-blocking; card is a working modal side-effect, nav-invariant tested; 62 (MinesweeperKit) + 57 (GameCenterKit) tests pass; zero Sudoku source changes. ASC registration of the 3 MS leaderboard IDs is a separate user-owned step.
🤖 Generated with Claude Code