Repository navigation
fix(monetization): reserve the banner slot height before the ad loads - #729
Merged
Merged
Conversation
Owner-observed bug: on the Sudoku game screen the board frame shrank when the AdMob banner appeared - a mid-game layout jump. The shared BannerSlotView only entered layout after the async AdGate resolution landed, so every screen reflowed when the slot materialized. Fix (shared MonetizationUI/MonetizationCore, both apps): - AdGate gains a synchronous session hint (lastKnownShouldShowBanner, Mutex-backed, nonisolated) recording the latest shouldShowBanner resolution; recordBannerDismissed/recordPurchase eagerly flip it to false. The decision logic itself is unchanged (split into resolveShouldShowBanner). - BannerSlotView seeds its show/hide state from that hint at init, so any slot mounted after the gate has resolved once (Board entered from Home, hubs, Settings) reserves its 50pt from the very first layout; ad load only fills the already-reserved rect. Gate-denied (Remove Ads / dismissed today) still collapses to EmptyView, and the pre-first-resolution cold-launch default is unchanged - so all existing purchased-state snapshot baselines stay byte-identical. Coverage: - AdGateLayoutHintTests: 6 unit tests pinning the hint lifecycle. - First ads-enabled (hasPurchasedRemoveAds: false) snapshot fixtures in the repo (per the #725 review note): Sudoku BoardViewBannerTests + MinesweeperBoardSnapshotTests, light + dark, unloaded spinner slot reserved at 50pt. All pre-existing baselines pass unchanged. - Sim-verified on iPhone 17 Pro: board frame identical before/after the test ad loads (row-1 cell y=137.75, toolbar y=542 in both). Closes #723 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.
Closes #723 — owner-observed: the Sudoku board shrank mid-game when the AdMob banner loaded (layout jump during play).
What (5 files, +/− small; AdGate + BannerSlotView + 3 test files)
lastKnownShouldShowBanner— aMutex<Bool?>-backed nonisolated session hint recording the last authoritativeshouldShowBannerresolution;recordBannerDismissed/recordPurchaseeagerly flip it false. Decision logic char-identical — the 5-rule body moved verbatim into a privateresolveShouldShowBanner; the public wrapper writes the hint at its single exit point.shouldShowfrom the hint → once the session's gate has allowed, any later-mounted slot (Home→Board is the typical flow) reserves its 50pt from FIRST layout; the ad load only fills content. Gate-denied staysEmptyView. The hint never touchesstatus, so a real ad can never mount ahead of the live gate resolution (architecturally proven by both reviewers).hasPurchasedRemoveAds: false, unloaded 50pt spinner state, light+dark, both apps) — closes the coverage gap recorded in chore(polish): dark banner seam, ms settings tint parity, sudoku pause a11y id (#688 items 2/5a/5b) #725's review. All existing baselines byte-untouched (every PNG in the stat isBin 0 -> N).Known residual (deliberate, documented in-code): the cold-launch FIRST screen still has one layout settle (no prior resolution exists to hint from). The reported in-game jump is eliminated.
Verification
AdGateLayoutHintTests6/6 (nil-before / mirror allow+deny / eager flips / day-rollover reopen); SudokuKit 270/270; MinesweeperKit 189/189; GameAppKit 29/29.import GoogleMobileAdsstill exactly one file (scan:admob invariant).Review
Money-tier dual review (sonnet + opus), both approve, no BLOCKER/MAJOR. Sonnet verified the decision-logic move char-by-char and the
shouldShow/statusseparation; opus exhaustively walked every purchaser/dismissed path (hint can never be true for them; a stale seed-true converges to a self-correcting blank, never an ad). Two MINOR observations recorded in the review thread, neither requiring change.🤖 Generated with Claude Code