Repository navigation
feat(admob): add dispose(handle:) for live banner cleanup (#221) - #275
Merged
Merged
Conversation
LiveAdMobBridge retained every BannerView in liveBanners for the handle's lifetime. Add a dispose(handle:) path so consumers (BannerSlotView on disappear) can release the entry + tear down the view on the main actor. Removes the NOTE(#221) placeholder. AdMob SDK isolation unchanged (1 import). 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 #221.
Threads
dispose(handle:) asyncthroughAdProvider+ the internalAdMobBridgeseam, with realGADBannerViewteardown inLiveAdMobBridge(drop theliveBannersretain, thendelegate = nil+removeFromSuperview()on the main actor) and no-op/record impls in Noop/Fake. Call sites:BannerSlotView(Sudoku) +MinesweeperBannerSlotView(MS mirror).onDisappear. Removes theNOTE(#221)placeholder.Verification: AppMonetizationKit
swift test→ 103 tests in 16 suites pass; AdMob isolation auditimport GoogleMobileAdscount = 1; SudokuUI + MinesweeperUI build (both call sites).Code Review verdict: APPROVE-WITH-NITS. Concurrency confirmed race-free (the
removeValue-then-MainActor.runhop hands a sole-owned reference across, identical to the establishedloadBannerprecedent); idempotency holds across all five impls. Two non-blocking nits deferred to a follow-up:.onDisappeardispose timing: paired with.task, so transient SwiftUI teardowns (tab switch, list recycling, split-pane churn) trigger dispose→.task-reload thrash — safe (idempotent, handle never stale) but spends redundant ad requests + re-flickers on return. Mitigation (gate dispose on gate-close/handle-change) tracked in follow-up..notInitializedis semantically loose (SDK stays started); harmless becauserefreshBanner()guards ondidStart, not status, and the view doesn't re-readbannerStatusafter dispose.#if canImport(GoogleMobileAds)teardown isn't exercised in SwiftPM macOS CI (only the fake bridge path is). Verified by reasoning; teardown is 3 trivial main-actor lines mirroring the load path.🤖 Generated with Claude Code