Skip to content

refactor(admob): share suspended ad load result tracking - #4053

Merged
polmiro merged 1 commit into
next-gen-admob-sdkfrom
share-ad-load-result-tracking
Aug 26, 2026
Merged

refactor(admob): share suspended ad load result tracking#4053
polmiro merged 1 commit into
next-gen-admob-sdkfrom
share-ad-load-result-tracking

Conversation

@polmiro

@polmiro polmiro commented Aug 21, 2026

Copy link
Copy Markdown
Member

Summary

  • add an internal AdLoadResult helper that shares loaded/failed tracking for suspending Google Mobile Ads Next-Gen APIs
  • configure successful ads after the tracking attempt while returning the exact original result instance
  • preserve lazy response-info lookup and tracking-failure resilience, with focused success/failure contract tests

Context

This is a foundation-only change for later adoption by the format-specific suspending loaders.

Test plan

  • ./gradlew :feature:admob-next-gen:testDefaultsDebugUnitTest
  • ./gradlew detektAll
  • ./scripts/api-check.sh

Note

Low Risk
Internal tracking helper plus unit tests; no public API or production call-site changes yet.

Overview
Adds AdLoadResult.trackAndConfigureAdLoadResult so suspending Next-Gen loaders can reuse the same loaded/failed tracking as TrackingAdLoadCallback.

On success it tracks then runs configureAd; on failure it only tracks. It always returns the original result instance, and tracking still goes through trackIfConfigured so missing SDK setup or tracker errors do not skip ad configuration. Unit tests cover success, failure, and those resilience cases.

Reviewed by Cursor Bugbot for commit 1690bc2. Bugbot is set up for automated code reviews on this repo. Configure here.

@codecov

codecov Bot commented Aug 21, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 82.99%. Comparing base (22dc594) to head (1690bc2).

Additional details and impacted files
@@                 Coverage Diff                 @@
##           next-gen-admob-sdk    #4053   +/-   ##
===================================================
  Coverage               82.99%   82.99%           
===================================================
  Files                     437      437           
  Lines                   17893    17893           
  Branches                 2684     2684           
===================================================
  Hits                    14851    14851           
  Misses                   2148     2148           
  Partials                  894      894           

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@polmiro
polmiro requested a review from AlvaroBrey August 21, 2026 08:20
@polmiro
polmiro marked this pull request as ready for review August 21, 2026 08:20
@polmiro
polmiro requested a review from a team as a code owner August 21, 2026 08:20
@polmiro
polmiro merged commit 6b02549 into next-gen-admob-sdk Aug 26, 2026
36 checks passed
@polmiro
polmiro deleted the share-ad-load-result-tracking branch August 26, 2026 08:06
polmiro added a commit that referenced this pull request Aug 26, 2026
…4086)

## Summary

I jumped the gun and merged the approved PR for interstitial ads before
adopting the new helper.

- #4053 introduced the shared
`AdLoadResult.trackAndConfigureAdLoadResult` foundation helper.
- Adopt that helper at the existing suspending interstitial load call
site while preserving result identity, tracking order, and callback
installation.

## Test plan

- [x] `./gradlew :feature:admob-next-gen:testDefaultsDebugUnitTest`
- [x] `./gradlew detektAll`
- [x] `./scripts/api-check.sh`

<!-- CURSOR_SUMMARY -->
---

> [!NOTE]
> **Low Risk**
> Mechanical refactor to a shared helper with equivalent tracking and
callback wiring; no API or auth changes.
> 
> **Overview**
> The suspending **`AdTracker.loadAndTrackInterstitialAd`** path no
longer inlines success/failure tracking with **`trackAdLoaded`** /
**`trackAdFailedToLoad`**. It now chains **`InterstitialAd.load`**
through the shared **`trackAndConfigureAdLoadResult`** helper (from
#4053), passing interstitial format metadata and a **`configureAd`**
block that installs the tracking event callback.
> 
> Behavior is intended to stay the same: the original **`AdLoadResult`**
is returned, load success/failure events are still tracked, and tracking
is installed on successful loads before the suspend function completes.
> 
> <sup>Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit
9a4b7f0. Bugbot is set up for automated
code reviews on this repo. Configure
[here](https://www.cursor.com/dashboard/bugbot).</sup>
<!-- /CURSOR_SUMMARY -->
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants