Skip to content

fix(gamecenter): signed-out GC entry points now alert instead of no-op - #715

Merged
wei18 merged 1 commit into
mainfrom
fix/685-gc-signed-out-fallback
Jul 7, 2026
Merged

wei18 merged 1 commit into
mainfrom
fix/685-gc-signed-out-fallback

Conversation

@wei18

@wei18 wei18 commented Jul 7, 2026

Copy link
Copy Markdown
Owner

Closes #685 — the last open item from the 2026-07-05 UX audit's GC cluster (14 files, +207/−42).

Root cause

The GC-signed-out .alert modifier was attached in universalRootModifiers — a plain helper called exactly once from makeGameApp, outside any SwiftUI View's body. That attachment point is never revisited by Observation's render invalidation, so flipping showGameCenterSignedOutAlert never presented anything even though the #513 flag logic was correct all along. (Reviewer independently verified the mechanism with a fresh agent given only the SwiftUI/Observation description, no diff.)

Fix

  • Move the alert into GameRoot.body, alongside the fullScreenCover binding that already worked via the same pattern.
  • New shared gate GameRootViewModel.presentGameCenterOrAlert(present:): authenticated → present dashboard; unauthenticated and .unknown → alert (same semantics the Home card always intended). Home card and both apps' Settings GC row now route through it, so the fallback can't drift between entry points again.
  • presentGameCenter threaded through both apps' Live.swift / LiveRouteFactory symmetrically. GameShellKit stays zero-dependency.

Verification

  • 3 new root-cause unit tests (authenticated/unauthenticated/unknown) + 2 per-app Settings wiring tests; GameAppKit 29/29, MinesweeperKit 184/184, SudokuKit relevant suites green (full-suite segfault reproduced on unmodified main = pre-existing local env issue, not this change).
  • Simulator-verified on both apps, signed-out: both entry points now show the "Sign in to Game Center" alert, repeatedly on repeated taps. (Owner separately confirmed the authenticated path on a real device pre-fix.)
  • swiftlint --strict 0 violations; alert strings are pre-existing localized keys with all 7 locales in both app catalogs (verified by reviewer via xcstrings parse) — no catalog changes.

Review

Dual-model review (sonnet + haiku), both approve. Haiku's hardcoded-string MINOR was adjudicated a false positive (LocalizedStringKey + app-catalog convention). Sonnet's two non-blocking residuals — the nil-default presentGameCenter fallback seam and a weak wiring test — are tracked as #714.

🤖 Generated with Claude Code

The Home leaderboard card's #513 signed-out alert never appeared, and the
Settings Game Center row had no guard at all — both silently did nothing
when Game Center was signed out (confirmed via simulator repro on both
apps, closes #685).

Root cause: the GC-signed-out `.alert` modifier was attached in
`universalRootModifiers`, a plain helper called exactly once from
`makeGameApp` outside any SwiftUI View's own `body`. That attachment
point was never revisited by Observation's render invalidation, so
flipping `GameRootViewModel.showGameCenterSignedOutAlert` never
re-triggered presentation even though the flag itself was set correctly.

Fix:
- Move the alert modifier into `GameRoot.body` itself, alongside the
  `fullScreenCover` binding that already worked via the same pattern.
- Add `GameRootViewModel.presentGameCenterOrAlert(present:)` as the one
  shared auth-gate; both `GameHomeViewModel.select(.leaderboard)` and the
  new `SettingsView.presentGameCenter` injection point route through it,
  so the fallback can't drift between entry points again.
- Wire `presentGameCenter` through both apps' `LiveRouteFactory` /
  `Live.swift` so the Settings row shares the Home card's guard instead
  of calling `GameCenterDashboard.present()` unconditionally.

Verified on-device behavior in the iOS Simulator (signed-out) on both
Sudoku and Minesweeper: both entry points now show "Sign in to Game
Center", repeatedly, on repeated taps.

Co-Authored-By: Claude Fable 5 <[email protected]>
@wei18
wei18 enabled auto-merge (squash) July 7, 2026 02:06
@wei18
wei18 merged commit a0b5a96 into main Jul 7, 2026
4 checks passed
@wei18
wei18 deleted the fix/685-gc-signed-out-fallback branch July 7, 2026 02:07
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.

fix(sudoku): Game Center entry points are dead no-ops when signed out (no dashboard, no sign-in alert)

1 participant