refactor: extract Offering.presentedOfferingContext helper and apply …#6865
Merged
Conversation
Member
Author
|
@RCGitBot please test |
tonidero
approved these changes
May 28, 2026
| expect(params.offeringId) == "offering_1" | ||
| } | ||
|
|
||
| func testParamsWithOfferingWithNoPackagesHasNilPresentedOfferingContext() { |
Contributor
There was a problem hiding this comment.
Could be good to add a test using this new property and that does have a package?
Contributor
There was a problem hiding this comment.
Or well... maybe these should be part of OfferingTest, to test the new helper function...
de392a9 to
5cd7b45
Compare
Member
Author
|
@RCGitBot please test |
bb9525f to
fe395a8
Compare
Base automatically changed from
rickvdl/add-presented-offering-context-to-custom-paywall-events
to
main
June 1, 2026 14:59
5cd7b45 to
e981e2c
Compare
…across SDK Mirrors purchases-android#3513. Adds an @_spi(Internal) computed property `presentedOfferingContext` on `Offering` that returns the context from the first available package, replacing seven repeated `availablePackages.first?.presentedOfferingContext` call sites in PaywallEvent, CustomPaywallImpressionParams, and Purchases.
e981e2c to
db14fa7
Compare
Member
Author
|
@RCGitBot please test |
This was referenced Jun 3, 2026
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.
Mirrors Android PR RevenueCat/purchases-android#3513
Added a small helper function for getting the
PresentedOfferingContextfrom an Offering object as a follow up on RevenueCat/purchases-android#3424 (comment)Replacing all occurrences of
with the use of the new helper
Note
Low Risk
Behavior-preserving refactor with unit tests; only affects how placement/targeting context is read for analytics, not purchase logic.
Overview
Adds an internal
Offering.presentedOfferingContexthelper (same behavior as reading the first package’s context, ornilwhen there are no packages) and switches paywall/custom-paywall code paths to use it instead of repeatingavailablePackages.first?.presentedOfferingContext.Call sites updated include
CustomPaywallImpressionParams,PaywallEventinitializers, andPurchases.trackCustomPaywallImpressionwhen resolving context from cached offerings. Unit tests cover the helper for offerings with and without packages.Reviewed by Cursor Bugbot for commit db14fa7. Bugbot is set up for automated code reviews on this repo. Configure here.