Skip to content

[WIP] AdMob reward verification integration branch#3465

Draft
polmiro wants to merge 8 commits into
mainfrom
admob-reward-verification
Draft

[WIP] AdMob reward verification integration branch#3465
polmiro wants to merge 8 commits into
mainfrom
admob-reward-verification

Conversation

@polmiro
Copy link
Copy Markdown
Member

@polmiro polmiro commented May 12, 2026

Checklist

  • If applicable, unit tests
  • If applicable, create follow-up issues for purchases-ios and hybrids

Motivation

Collect reward-verification component PRs behind an integration branch before merging to main.

Description

This draft PR tracks aggregate changes merged into admob-reward-verification from component PRs.

This empty commit enables opening a draft collector PR from admob-reward-verification to main while component PRs are stacked into this branch.
@polmiro polmiro changed the title [DRAFT] AdMob reward verification integration branch [WIP] AdMob reward verification integration branch May 12, 2026
polmiro added 3 commits May 13, 2026 09:53
### Checklist
- [x] If applicable, unit tests
- [ ] If applicable, create follow-up issues for `purchases-ios` and
hybrids

### Motivation
This adds the core status polling endpoint plumbing in `:purchases`, so
adapter-level polling behavior can be stacked in subsequent PRs.

### Description
This change adds end-to-end SDK wiring for fetching reward verification
status by `clientTransactionId`:

- Adds `Endpoint.GetRewardVerificationStatus`.
- Adds `Backend.getRewardVerificationStatus(...)` with response parsing
and deduped callback handling.
- Adds internal status/wire models:
  - `RewardVerificationStatus`
  - `RewardVerificationStatusResponse`
- Exposes internal entry points through:
  - `PurchasesOrchestrator`
  - `Purchases` (defaults/internal)
  - `awaitGetRewardVerificationStatus(...)` coroutine extension
  - `GetRewardVerificationStatusCallback` (internal)

Test coverage includes:
- Endpoint path generation.
- Response status mapping.
- Backend success/error behavior and deduping.
- Purchases forwarding behavior.

<!-- CURSOR_SUMMARY -->
---

> [!NOTE]
> **Medium Risk**
> Adds a new backend API call and response parsing with callback
de-duping; issues would primarily surface as incorrect status mapping or
request caching/dispatch behavior for this new endpoint.
> 
> **Overview**
> Adds end-to-end internal plumbing to fetch ad reward verification
status by `clientTransactionId`.
> 
> Introduces a new `Endpoint.GetRewardVerificationStatus` and
`Backend.getRewardVerificationStatus` (with callback de-duping and JSON
parsing into the new `RewardVerificationStatus` enum), then wires it
through `PurchasesOrchestrator` and `Purchases`, including a coroutine
wrapper `awaitGetRewardVerificationStatus`.
> 
> Includes unit tests covering endpoint path/name, response-to-enum
mapping (including unknown statuses), backend success/error handling,
and concurrent-call de-duping plus forwarding from `Purchases`.
> 
> <sup>Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit
1e9852a. Bugbot is set up for automated
code reviews on this repo. Configure
[here](https://www.cursor.com/dashboard/bugbot).</sup>
<!-- /CURSOR_SUMMARY -->
### Checklist
- [x] If applicable, unit tests
- [x] If applicable, create follow-up issues for `purchases-ios` and
hybrids

### Motivation
This adds the Android API facade for AdMob reward verification so we can
align the SDK surface with iOS before stacking implementation details.

### Description
This PR introduces the reward verification API shape in `feature/admob`
without implementing runtime behavior yet.

Changes included:
- Added new experimental extensions for rewarded and rewarded
interstitial ads:
  - `enableRewardVerification()`
  - verification `show(...)` overloads
- Added experimental reward verification models:
  - `RewardVerificationResult`
- `VerifiedReward` (with value semantics for virtual currency payloads)
- Updated generated API signatures in `feature/admob/api.txt`
- Updated `feature/admob/README.md` with reward-verification usage
examples based on `loadAndTrack...` helpers
- Verification `show(...)` requires `rewardVerificationResult`
- Documented callback thread contract in KDoc

<!-- CURSOR_SUMMARY -->
---

> [!NOTE]
> **Medium Risk**
> Adds new experimental public API surface for rewarded ad verification
that currently throws `NotImplementedError`, so adopters could hit
runtime failures if used. Changes are otherwise isolated to the
`feature/admob` module and documentation.
> 
> **Overview**
> Introduces an **experimental AdMob reward verification facade** for
rewarded and rewarded-interstitial ads, including
`enableRewardVerification()` and new `show(...)` overloads that return a
`RewardVerificationResult`.
> 
> Adds new verification models (`RewardVerificationResult`,
`VerifiedReward` with a `@Poko` `VirtualCurrency` payload and sentinel
types) and wires them into the published surface
(`feature/admob/api.txt`) plus module build config (adds the `poko`
plugin).
> 
> Updates `feature/admob/README.md` with reward-verification usage
examples and refreshes the supported-formats table.
> 
> <sup>Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit
a56b266. Bugbot is set up for automated
code reviews on this repo. Configure
[here](https://www.cursor.com/dashboard/bugbot).</sup>
<!-- /CURSOR_SUMMARY -->
Mark GetRewardVerificationStatusCallback with InternalRevenueCatAPI opt-in so release variant Kotlin compilation succeeds when using RewardVerificationStatus.
@codecov
Copy link
Copy Markdown

codecov Bot commented May 13, 2026

Codecov Report

❌ Patch coverage is 86.48649% with 10 lines in your changes missing coverage. Please review.
✅ Project coverage is 79.92%. Comparing base (d889109) to head (5291412).

Files with missing lines Patch % Lines
.../kotlin/com/revenuecat/purchases/common/Backend.kt 80.95% 7 Missing and 1 partial ⚠️
...mon/networking/RewardVerificationStatusResponse.kt 75.00% 1 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #3465      +/-   ##
==========================================
+ Coverage   79.89%   79.92%   +0.03%     
==========================================
  Files         369      371       +2     
  Lines       14871    14945      +74     
  Branches     2048     2055       +7     
==========================================
+ Hits        11881    11945      +64     
- Misses       2157     2165       +8     
- Partials      833      835       +2     

☔ 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.

polmiro added 4 commits May 13, 2026 11:20
…ffolding (#3470)

### Checklist
- [x] If applicable, unit tests
- [ ] If applicable, create follow-up issues for `purchases-ios` and
hybrids

### Motivation
Tracking APIs in AdMob are already shipped and should remain
compatibility-safe. This refactor improves internal structure by
separating tracking internals from the root package while keeping
reward-verification APIs as simple unimplemented placeholders.

### Description
This PR is **structure-only** in `feature/admob` (no intended behavior
change):

- Moved tracking internals into a dedicated internal area:
  - `.../admob/tracking/TrackIfConfigured.kt`
  - `.../admob/tracking/AdMobPrecisionMapping.kt`
  - `.../admob/tracking/TrackingAdListener.kt`
  - `.../admob/tracking/TrackingOnPaidEventListener.kt`
  - `.../admob/tracking/TrackingFullScreenContentCallback.kt`
- Kept public extension API files as thin entrypoints and rewired
imports:
  - tracking entrypoints remain in place and unchanged in signature
- Kept reward-verification extension APIs as direct
`NotImplementedError` stubs (no extra internal facade layer).
- Updated tests to reference tracking symbols from the new package.
- Removed old duplicated root-level tracking internal files.

**Before**
- Flat root-level package with tracking internals mixed with public
extension files.

**After**
- Root-level public API entrypoints remain thin.
- Tracking internals are grouped under `admob.tracking`.
- Reward-verification APIs remain unimplemented placeholders, unchanged
in behavior.

**Behavior parity statement**
- Tracking behavior and public tracking API are intended to remain
unchanged.
- Reward-verification public APIs remain unimplemented as before (same
`NotImplementedError` behavior).

### Test plan
- Attempted:
  - `./gradlew :feature:admob:test :feature:admob:lint`
- `./gradlew :feature:admob:testDefaultsBc8DebugUnitTest
:feature:admob:testDefaultsBc7DebugUnitTest`
- Blocked by unrelated pre-existing compilation failures in
`:purchases`:
-
`purchases/src/main/kotlin/com/revenuecat/purchases/interfaces/GetRewardVerificationStatusCallback.kt`
- error: internal RevenueCat API annotation usage violation during
`:purchases:compileDefaultsBc[7|8][Debug|Release]Kotlin`

No `feature/admob`-specific runtime/lint failures were surfaced before
hitting that blocker.
### Checklist
- [x] If applicable, unit tests
- [ ] If applicable, create follow-up issues for `purchases-ios` and
hybrids

### Motivation
Tracking internals in `feature/admob` are organized under `tracking/*`,
but tracking-focused unit tests were still in the root `unit/` package.

### Description
- moves existing tracking-focused unit tests into `unit/tracking`
- updates test packages/imports accordingly
- keeps test behavior and assertions unchanged

### Testing
- tests were reorganized only; no production code changes
- `ReadLints` reports no issues for moved test files

<!-- CURSOR_SUMMARY -->
---

> [!NOTE]
> **Low Risk**
> Low risk because this PR only changes test package
declarations/imports; no production code or behavior is modified.
> 
> **Overview**
> Reorganizes AdMob tracking-focused unit tests by moving them under the
`com.revenuecat.purchases.admob.tracking` test package (updating package
declarations and removing now-unneeded imports).
> 
> Test logic and assertions remain the same; this is a
structural/namespace cleanup to match the `tracking/*` production
organization.
> 
> <sup>Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit
254b57b. Bugbot is set up for automated
code reviews on this repo. Configure
[here](https://www.cursor.com/dashboard/bugbot).</sup>
<!-- /CURSOR_SUMMARY -->
### Checklist
- [x] If applicable, unit tests
- [ ] If applicable, create follow-up issues for `purchases-ios` and
hybrids

### Motivation
Close the Android core SDK reward verification response-surface gap by
exposing rich reward verification results (including verified reward
payloads) while keeping the scope limited to endpoint/request/response
plumbing.

### Description
- Replaced status-only reward verification surface with a rich result
model in `:purchases` core (`RewardVerificationResult`,
`VerifiedReward`)
- Updated backend/orchestrator/Purchases/coroutine pathways to return
result-based data from the reward verification endpoint
- Removed now-unneeded status-only reward verification types and
callbacks that were not launched
- Renamed transport-layer reward verification endpoint/response
identifiers to remove `Status` suffix (`GetRewardVerification`,
`RewardVerificationResponse`) while keeping backend path behavior
unchanged
- Updated and renamed focused tests for endpoint mapping and backend
propagation

<!-- CURSOR_SUMMARY -->
---

> [!NOTE]
> **Medium Risk**
> Changes the reward verification API surface and backend response
parsing, which could affect integrations relying on the previous
status-only model or cause mismatches if backend payloads vary. Covered
by updated unit tests, but still touches networking/model plumbing
end-to-end.
> 
> **Overview**
> Expands the reward verification response surface from a status-only
enum to a richer `RewardVerificationResult` model that can carry a
verified reward payload via `VerifiedReward`.
> 
> Renames the endpoint and plumbing from `*Status*` to `*Result*`
(`getRewardVerificationResult`, `Endpoint.GetRewardVerification`,
`RewardVerificationResponse`) and updates `Purchases`,
`PurchasesOrchestrator`, `Backend`, callbacks, and coroutine extensions
to return/parse the new result (including handling unknown statuses and
unsupported/malformed reward payloads).
> 
> Removes the old `RewardVerificationStatus` types/transport response
and replaces/extends unit tests to validate new JSON mapping, reward
payload parsing, and request deduping behavior.
> 
> <sup>Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit
75aa097. 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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant