Skip to content

Change AdFailedToLoad mediatorErrorCode type from Long to Int#2924

Merged
polmiro merged 2 commits into
mainfrom
int-mediator-error-code
Dec 12, 2025
Merged

Change AdFailedToLoad mediatorErrorCode type from Long to Int#2924
polmiro merged 2 commits into
mainfrom
int-mediator-error-code

Conversation

@polmiro

@polmiro polmiro commented Dec 11, 2025

Copy link
Copy Markdown
Member

Problem

Ad networks like AdMob provide error codes as Int, but the AdFailedToLoad event's mediatorErrorCode parameter expects a Long. This creates friction for developers who need to manually convert the error code type when tracking ad load failures:

// Before - developers had to manually convert
val loadAdError: LoadAdError = // from AdMob
adTracker.trackAdFailedToLoad(
    AdFailedToLoadData(
        // ...
        mediatorErrorCode = loadAdError.code.toLong() // Manual conversion required
    )
)

Solution

Changed mediatorErrorCode type from Long? to Int? throughout the SDK to match the type that ad networks naturally provide.

// After - developers can pass the value directly
val loadAdError: LoadAdError = // from AdMob
adTracker.trackAdFailedToLoad(
    AdFailedToLoadData(
        // ...
        mediatorErrorCode = loadAdError.code // Direct usage, no conversion needed
    )
)

Changes

  • AdFailedToLoadData.mediatorErrorCode: Long?Int?
  • AdEvent.FailedToLoad.mediatorErrorCode: Long?Int?
  • BackendEvent.Ad.mediatorErrorCode: Long?Int?
  • Updated all related unit tests to use Int values

Testing

  • All existing unit tests updated to reflect the type change
  • No behavioral changes, only type alignment with ad network APIs

Impact

  • Breaking change: Developers currently passing Long values will need to remove the .toLong() conversion
  • Improves developer experience by eliminating unnecessary type conversions
  • Better alignment with ad network APIs (AdMob, AppLovin, etc.)

This improves the developer experience by accepting Int directly from ad networks like AdMob, which provide error codes as Int, rather than requiring developers to manually convert to Long.

Changes:
- AdFailedToLoadData.mediatorErrorCode: Long? -> Int?
- AdEvent.FailedToLoad.mediatorErrorCode: Long? -> Int?
- BackendEvent.Ad.mediatorErrorCode: Long? -> Int?
- Updated all related tests to use Int values
@polmiro polmiro requested a review from a team as a code owner December 11, 2025 17:36
@polmiro polmiro requested a review from tonidero December 11, 2025 17:36
@codecov

codecov Bot commented Dec 11, 2025

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 78.49%. Comparing base (c4c3696) to head (13cd8ae).
⚠️ Report is 2 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #2924   +/-   ##
=======================================
  Coverage   78.49%   78.49%           
=======================================
  Files         332      332           
  Lines       12878    12878           
  Branches     1749     1749           
=======================================
  Hits        10108    10108           
  Misses       2036     2036           
  Partials      734      734           

☔ View full report in Codecov by Sentry.
📢 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.

@tonidero tonidero left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Makes sense. Thanks for fixing!

@polmiro polmiro added this pull request to the merge queue Dec 12, 2025
Merged via the queue into main with commit 78eca01 Dec 12, 2025
23 checks passed
@polmiro polmiro deleted the int-mediator-error-code branch December 12, 2025 18:02
tonidero pushed a commit that referenced this pull request Dec 15, 2025
**This is an automatic release.**

> [!WARNING]  
> If you don't have any login system in your app, please make sure your
one-time purchase products have been correctly configured in the
RevenueCat dashboard as either consumable or non-consumable. If they're
incorrectly configured as consumables, RevenueCat will consume these
purchases. This means that users won't be able to restore them from
version 9.0.0 onward.
> Non-consumables are products that are meant to be bought only once,
for example, lifetime subscriptions.


## RevenueCat SDK
### 📦 Dependency Updates
* [RENOVATE] Update build-dependencies to v8.13.2 (#2929) via RevenueCat
Git Bot (@RCGitBot)

## RevenueCatUI SDK
### 🐞 Bugfixes
* Fix `IllegalStateException`: No `ViewModelStoreOwner` was provided via
`LocalViewModelStoreOwner` in `CompatComposeView` (#2912) via Cesar de
la Vega (@vegaro)

### 🔄 Other Changes
* Change AdFailedToLoad mediatorErrorCode type from Long to Int (#2924)
via Pol Miro (@polmiro)
* Change paywall preview recorder name template (#2923) via Toni Rico
(@tonidero)
* Don't use reflection to instantiate AmazonDeviceIdentifiersFetcher
(#2919) via Will Taylor (@fire-at-will)

Co-authored-by: revenuecat-ops <ops@revenuecat.com>
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