[WIP] AdMob reward verification integration branch#3465
Draft
polmiro wants to merge 8 commits into
Draft
Conversation
This empty commit enables opening a draft collector PR from admob-reward-verification to main while component PRs are stacked into this branch.
### 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 Report❌ Patch coverage is 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. 🚀 New features to boost your workflow:
|
…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 -->
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.
Checklist
purchases-iosand hybridsMotivation
Collect reward-verification component PRs behind an integration branch before merging to
main.Description
This draft PR tracks aggregate changes merged into
admob-reward-verificationfrom component PRs.