Repository navigation
fix(sudoku): present completion view as in-board overlay on iOS (#610) - #611
Merged
Merged
Conversation
Root cause: the board is presented as a fullScreenCover modal where `path == nil`, so `pushCompletionIfNeeded()` → `path.append(.completion)` was silently a no-op — the Completion screen never appeared after solving. Fix: mirror MinesweeperBoardView's in-board overlay pattern (#292/#518). Added `@State var completionViewModel: CompletionViewModel?` to BoardView. An `.onChange(of: viewModel.status == .completed)` builds it once on the playing→completed transition; an `.overlay {}` shows `completionSurface(_:)` while it is non-nil. `gameChrome?.setHidingChrome` is keyed on overlay presence (not status), matching MS CR #518-R2 so Close restores the chrome without clearing terminal state. The macOS push-navigation path (`pushCompletionIfNeeded` / `hasNavigatedToCompletion` latch) is left untouched — it still fires correctly when `path != nil`. Wiring preserved: `gameCenter` and `makeDailyReminderPrimer` are threaded from `LiveRouteFactory` → `BoardLoaderView` → `BoardView` so the overlay's CompletionViewModel gets the GC client (#381/#383 leaderboard routing intact) and Daily solves still see the reminder primer (#287 Phase 2). Co-Authored-By: Claude Opus 4.8 <[email protected]>
Blocker from CR: on macOS the board is presented inline inside a
NavigationStack (path != nil), so the new `.onChange` was building
`completionViewModel` AND `pushCompletionIfNeeded()` was appending
`.completion` to the path — both mechanisms fired at once.
Fix: add `shouldPresentCompletionOverlay: Bool { path == nil && viewModel.status == .completed }`
to `BoardView+Completion.swift` and guard the overlay-building branch
with it. iOS modal (path == nil) → overlay only. macOS inline board
(path != nil) → push only. Gate is on `path`, not `#if os(iOS)`, so
it tracks the real presentation contract.
Also make `path` internal (was private) so `BoardView+Completion.swift`
can read it for the predicate — same pattern as `gameCenter`.
Strengthened tests (all 5 pass):
- shouldPresentCompletionOverlay: true when completed + path==nil
- shouldPresentCompletionOverlay: false when playing + path==nil
- shouldPresentCompletionOverlay: false when completed + path!=nil (macOS regression lock)
- makeCompletionViewModel: correct puzzleId + non-nil leaderboardId for daily
- makeCompletionViewModel: nil leaderboardId for practice puzzle
Co-Authored-By: Claude Opus 4.8 <[email protected]>
wei18
added a commit
that referenced
this pull request
Jul 4, 2026
Spec-first navigation methodology: screen contracts (element inventory + per-interaction presentation semantics + back/close landing + covering/ z-order + state variants) + forward/negative flow chains, code-anchored. Synthesizes web research (wireflows, statecharts, HIG modality, model-based test derivation) + this repo battle-scars (#2B/#197/#523/#611/#518/#674). Worked example: docs/screen-contracts.md + docs/navigation-flows.md (#683). Co-authored-by: Claude Fable 5 <[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.
Fixes #610.
Problem
On iOS, solving a Sudoku puzzle showed no Completion view (Game Center still submitted). Found during #579 TestFlight device verification.
Root cause
After the board moved to a fullScreenCover modal (SDD-003 Epic 1),
GameRootmounts it withpath == nil. Sudoku's only completion trigger was the legacyBoardView.pushCompletionIfNeeded()→path.append(.completion), a documented no-op whenpath == nil. Minesweeper already presents completion as an in-board overlay; Sudoku was never wired into that seam — a mirror-principle drift.Fix (mirrors Minesweeper)
BoardViewgains@State completionViewModel, built once on the.playing → .completededge, shown via.overlay {}, drivinggameChrome?.setHidingChrome(overlayPresented)(keyed on overlay presence, per MS CR layout: completion screen ignores top safe area — icon clipped by Dynamic Island + board chrome overlaps #518-R2).BoardView/BoardLoaderViewthat the.completionRouteFactory case used: Game Center client, fix(completion): leaderboard hard-coded to daily-easy — wrong slice for medium/hard, mis-posts practice #381/fix(completion): practice solves show misleading 'Sign in to Game Center' + dead button — needs .noLeaderboard state #383leaderboardId(Practice →nil→.noLeaderboard), and the Daily-only feat: RemindersKit — local notification reminders + permission priming (shared target) [PROPOSAL_APPROVED, parked] #287 reminder primer (gated byisDaily).path != nil); the overlay layers below the pushed screen there, so no behavior change.BoardView+Completion.swiftextracted to keepBoardView.swiftat the 400-line ceiling (noswiftlint:disable).Verification
BoardCompletionOverlayTests— RED (init lackedgameCenter) → GREEN. Asserts overlay VM present on.completedin the modal (path == nil) context; absent while.playing.swift test --package-path Packages/SudokuKit— all suites pass, no snapshot baselines re-recorded.swiftlint --strict— 0 violations across 5 changed files.🤖 Generated with Claude Code