Skip to content

feat(v2): conditional AdMob/UMP deps + NoopAdProvider for macOS build - #101

Merged
wei18 merged 1 commit into
mainfrom
fix/macos-admob-conditional
May 23, 2026
Merged

wei18 merged 1 commit into
mainfrom
fix/macos-admob-conditional

Conversation

@wei18

@wei18 wei18 commented May 23, 2026

Copy link
Copy Markdown
Owner

Fixes macOS build (link errors on missing macOS slice in AdMob/UMP xcframeworks).

Changes

  • AppMonetizationKit/Package.swift: AdsAdMob deps gated to .iOS via .condition()
  • NEW NoopAdProvider in MonetizationCore (37 lines, .suppressed status → EmptyView)
  • AppComposition/Live.swift: #if os(iOS) AdProvider switch
  • CompositionTests: platform-conditional expectation

Code Reviewer APPROVE. macOS BUILD SUCCEEDED verified locally.

§未決 (follow-up issues to file)

  1. bootMonetization() should early-return on !iOS (2 spurious telemetry breadcrumbs/launch)
  2. Pre-existing iOS xcodebuild failure on 'MobileAds in scope' — orthogonal, not introduced by this PR

Fixes macOS build failure (12+ link errors on missing macOS slice in
GoogleMobileAds.xcframework + UserMessagingPlatform.xcframework).

Changes:
- Packages/AppMonetizationKit/Package.swift: AdsAdMob target's
  GoogleMobileAds + GoogleUserMessagingPlatform product deps gated
  with .condition(.when(platforms: [.iOS])). UMP declared directly
  (not transitive) so the platform condition attaches.
- NEW MonetizationCore/NoopAdProvider.swift (~37 lines): production
  fallback AdProvider for macOS (where AdMob doesn't exist). actor;
  init/refreshBanner no-ops; bannerStatus = .suppressed (BannerSlotView
  already collapses to EmptyView for .suppressed → zero downstream
  changes needed).
- AppComposition/Live.swift: #if os(iOS) for LiveAdMobAdProvider vs
  NoopAdProvider on macOS.
- CompositionTests: platform-conditional expectation.

Code Reviewer (2026-05-22): APPROVE. macOS BUILD SUCCEEDED verified
locally. Per foundations.md §9.1 isolation contract holds — only
AdsAdMob has the GoogleMobileAds product, and that product is now
empty on macOS link.

§未決 deferred to follow-up
- bootMonetization() still calls UMP+ATT on macOS via canImport guards
  → 2 telemetry breadcrumbs per launch; consider early-return on !iOS
- iOS xcodebuild compile fails on pre-existing 'MobileAds in scope'
  error — orthogonal pre-existing bug, separate issue to be filed

Co-Authored-By: Claude Opus 4.7 <[email protected]>
@wei18
wei18 merged commit 8d1fc59 into main May 23, 2026
@wei18
wei18 deleted the fix/macos-admob-conditional branch May 23, 2026 11:14
wei18 added a commit that referenced this pull request May 23, 2026
) (#103)

Closes #102. Pre-existing iOS xcodebuild failure (only revealed after
#101 fixed macOS link, allowing iOS compile to actually run):

  LiveAdMobBridge.swift: cannot find 'MobileAds' in scope
  UMPConsentPresenter.swift: cannot find 'ConsentForm' in scope

Root cause: code targeted AdMob v12 / UMP v3 Swift-native API
(`MobileAds.shared`, `ConsentForm.loadAndPresentIfRequired`), but
Package.swift pins GoogleMobileAds 11.13.0 + UMP 2.x which only expose
ObjC names — no NS_SWIFT_NAME overlays for the unprefixed symbols.

Verified against installed xcframework headers:
- GADMobileAds.h:34 sharedInstance() ✓
- UMPConsentInformation.h:52 sharedInstance (class property) ✓
- UMPRequestParameters.h:4 default init ✓
- UMPConsentForm.h:24 loadAndPresentIfRequired(from:completion:) ✓

Code Reviewer (2026-05-23): APPROVE. Surgical fix — 11 lines across 2
files. No isolation-contract change (foundations.md §9.1 holds; 1 real
`internal import GoogleMobileAds` in LiveAdMobBridge.swift).

Verification:
- iOS xcodebuild BUILD SUCCEEDED
- macOS xcodebuild BUILD SUCCEEDED (no #101 regression)
- AppMonetizationKit tests 87/87
- Isolation grep: 1 hit

§未決 routed to backlog
- v12.x upgrade follow-up → foundations.md §Backlog
- iOS xcodebuild not wired into Xcode Cloud PR workflow →
  methodology.md §Backlog

Co-authored-by: Claude Opus 4.7 <[email protected]>
wei18 added a commit that referenced this pull request May 23, 2026
…106)

UMP + ATT bridges are iOS-only via canImport guards. On macOS
bootMonetization() called them anyway, routing .unsupported outcomes
through Telemetry.errorOccurred → 2 spurious breadcrumbs per launch.

Add #if !os(iOS) { return } early-return. iOS path unchanged.

Verification: swift test --filter "BootOrder|Composition" 20/20 pass
(incl. new test using RecordingSink to assert events.isEmpty).

Co-authored-by: Claude Opus 4.7 <[email protected]>
wei18 added a commit that referenced this pull request May 25, 2026
… v2.5 user-owned)

Plan.md was still tagged DRAFT/awaiting-v2.0-dispatch despite v2.0–v2.4
having fully shipped across ~15 PRs. Rewrite to align with code:

- Add §Status snapshot table (phase × status × PR refs, 75 @test count)
- Mark every step with [x]/[~]/[ ] + originating PR for traceability
- Add §Phase v2.4★ to backfill audit/polish work shipped after original
  plan (#97 #101 #102 #103 #106 #108 #109)
- Add steps v2.0.6 (anchor registry split) and v2.3.6.1
  (MonetizationStateController + ToastController)
- Correct existing step prose: StoreKitBridge symmetric split,
  RootView.init real 6-param signature with 4 optional slots,
  boot order via MonetizationBootCoordinator, AdMob isolation
  audit count = 2 files (protocol + live wrapper)
- Shrink §v2.5 to phase summary; defer detailed checklist to
  v2.5-readiness.md (single source of truth)
- Add §Decisions D-v2-01..06 capturing execution-phase decisions
  (AdMob v13/UMP v3, v11 ObjC API, macOS Noop, anchor registry,
  purchaseUpdates split, RootView optional slots)
- Add §下一動作 explicit user-owned next steps

340 → 275 lines.

Co-Authored-By: Claude Opus 4.7 <[email protected]>
wei18 added a commit that referenced this pull request May 25, 2026
… v2.5 user-owned) (#130)

Plan.md was still tagged DRAFT/awaiting-v2.0-dispatch despite v2.0–v2.4
having fully shipped across ~15 PRs. Rewrite to align with code:

- Add §Status snapshot table (phase × status × PR refs, 75 @test count)
- Mark every step with [x]/[~]/[ ] + originating PR for traceability
- Add §Phase v2.4★ to backfill audit/polish work shipped after original
  plan (#97 #101 #102 #103 #106 #108 #109)
- Add steps v2.0.6 (anchor registry split) and v2.3.6.1
  (MonetizationStateController + ToastController)
- Correct existing step prose: StoreKitBridge symmetric split,
  RootView.init real 6-param signature with 4 optional slots,
  boot order via MonetizationBootCoordinator, AdMob isolation
  audit count = 2 files (protocol + live wrapper)
- Shrink §v2.5 to phase summary; defer detailed checklist to
  v2.5-readiness.md (single source of truth)
- Add §Decisions D-v2-01..06 capturing execution-phase decisions
  (AdMob v13/UMP v3, v11 ObjC API, macOS Noop, anchor registry,
  purchaseUpdates split, RootView optional slots)
- Add §下一動作 explicit user-owned next steps

340 → 275 lines.

Co-authored-by: Claude Opus 4.7 <[email protected]>
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.

1 participant