Skip to content

Conversation

tonidero
Copy link
Contributor

Description

Based on #2610

This actually makes use of the presented offering context to pass a modified offering to the paywall. This data will be sent as part of the post receipt when a purchase is made.

@tonidero tonidero added pr:other pr:force_patch Forces a patch release labels Aug 19, 2025
@tonidero tonidero changed the base branch from main to add-hybrid-apis-set-presented-offering-context August 19, 2025 10:45
@tonidero tonidero marked this pull request as ready for review August 19, 2025 10:47
@tonidero tonidero requested review from a team August 19, 2025 10:47
Copy link

codecov bot commented Aug 19, 2025

Codecov Report

❌ Patch coverage is 58.33333% with 10 lines in your changes missing coverage. Please review.
✅ Project coverage is 78.41%. Comparing base (0c1aaa4) to head (768fa70).
⚠️ Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
...om/revenuecat/purchases/models/TestStoreProduct.kt 16.66% 10 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2612      +/-   ##
==========================================
+ Coverage   78.38%   78.41%   +0.03%     
==========================================
  Files         301      301              
  Lines       11229    11241      +12     
  Branches     1561     1561              
==========================================
+ Hits         8802     8815      +13     
+ Misses       1741     1740       -1     
  Partials      686      686              

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

Copy link
Member

@JayShortway JayShortway left a comment

Choose a reason for hiding this comment

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

Looks good! A suggestion and a question.

Comment on lines -1304 to +1306
ctor public TestStoreProduct(String id, String name, String title, String description, com.revenuecat.purchases.models.Price price, com.revenuecat.purchases.models.Period? period, optional com.revenuecat.purchases.models.PricingPhase? freeTrialPricingPhase, optional com.revenuecat.purchases.models.PricingPhase? introPricePricingPhase);
ctor public TestStoreProduct(String id, String name, String title, String description, com.revenuecat.purchases.models.Price price, optional com.revenuecat.purchases.models.Period? period, optional com.revenuecat.purchases.models.PricingPhase? freeTrialPricingPhase);
ctor public TestStoreProduct(String id, String name, String title, String description, com.revenuecat.purchases.models.Price price, optional com.revenuecat.purchases.models.Period? period, optional com.revenuecat.purchases.models.PricingPhase? freeTrialPricingPhase, optional com.revenuecat.purchases.models.PricingPhase? introPricePricingPhase);
Copy link
Member

Choose a reason for hiding this comment

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

The deleted line lacks the optional keyword for the com.revenuecat.purchases.models.Period? period parameter. The added lines all have the optional keyword for period. Any idea why? 🤔

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I removed one of the constructors for the TestStoreProduct that made it non-optional: https://github.com/RevenueCat/purchases-android/pull/2612/files#diff-18a1e4e397d6d9a1ac93514cf38e78a9b038cb703d536ed5162cc44c0f2d848aL23-L39. I do think that shouldn't really matter, but I guess the path it follows now in this case would go to the top-level constructor instead of that constructor. Metalava probably generated symbols for that constructor, but I think the API itself should remain compatible?

Copy link
Member

Choose a reason for hiding this comment

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

Thanks! Yea I think so too 🤔

Comment on lines 371 to 372
val offering = options.offeringSelection.offeringIdentifier?.let { offerings[it] }
?: offerings.current
Copy link
Member

Choose a reason for hiding this comment

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

Using offeringSelection would allow it to smart cast, avoiding the need to handle a nullable offeringIdentifier.

Suggested change
val offering = options.offeringSelection.offeringIdentifier?.let { offerings[it] }
?: offerings.current
val offering = offerings[offeringSelection.offeringIdentifier] ?: offerings.current

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think that doesn't work becuase offeringSelection.offeringIdentifier is nullable (Because it can be OfferingSelection.None).

Copy link
Member

Choose a reason for hiding this comment

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

Sorry I meant offeringId. This should work no?

val offering = offerings[offeringSelection.offeringId] ?: offerings.current

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Oh yes yes, that works! Will do the change. Thanks!

Comment on lines -1304 to +1306
ctor public TestStoreProduct(String id, String name, String title, String description, com.revenuecat.purchases.models.Price price, com.revenuecat.purchases.models.Period? period, optional com.revenuecat.purchases.models.PricingPhase? freeTrialPricingPhase, optional com.revenuecat.purchases.models.PricingPhase? introPricePricingPhase);
ctor public TestStoreProduct(String id, String name, String title, String description, com.revenuecat.purchases.models.Price price, optional com.revenuecat.purchases.models.Period? period, optional com.revenuecat.purchases.models.PricingPhase? freeTrialPricingPhase);
ctor public TestStoreProduct(String id, String name, String title, String description, com.revenuecat.purchases.models.Price price, optional com.revenuecat.purchases.models.Period? period, optional com.revenuecat.purchases.models.PricingPhase? freeTrialPricingPhase, optional com.revenuecat.purchases.models.PricingPhase? introPricePricingPhase);
Copy link
Member

Choose a reason for hiding this comment

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

Thanks! Yea I think so too 🤔

Base automatically changed from add-hybrid-apis-set-presented-offering-context to main August 20, 2025 08:15
…verride-presented-offering-context-paywalls-without-offering
@tonidero tonidero enabled auto-merge August 20, 2025 08:25
@tonidero tonidero added this pull request to the merge queue Aug 20, 2025
@tonidero tonidero removed this pull request from the merge queue due to a manual request Aug 20, 2025
@tonidero tonidero added this pull request to the merge queue Aug 20, 2025
@tonidero tonidero removed this pull request from the merge queue due to a manual request Aug 20, 2025
@tonidero tonidero enabled auto-merge August 20, 2025 08:44
@tonidero tonidero added this pull request to the merge queue Aug 20, 2025
Merged via the queue into main with commit f3065b0 Aug 20, 2025
20 checks passed
@tonidero tonidero deleted the override-presented-offering-context-paywalls-without-offering branch August 20, 2025 09:17
This was referenced Aug 20, 2025
tonidero pushed a commit that referenced this pull request Aug 21, 2025
**This is an automatic release.**

## RevenueCat SDK
### 🐞 Bugfixes
* Use `Block store` to backup anonymous user ids across installations
(#2595) via Toni Rico (@tonidero)

## RevenueCatUI SDK
### Paywallv2
#### 🐞 Bugfixes
* Fixes price formatting discrepancies on Paywalls for `{{
product.price_per_[day|week|month|year] }}` (#2604) via JayShortway
(@JayShortway)

### 🔄 Other Changes
* Revert dokka 2 and gradle 9 update (#2618) via Toni Rico (@tonidero)
* Introduce runtime annotations library and add stability annotations
for increasing UI performances (#2608) via Jaewoong Eum (@skydoves)
* Override presented offering context paywalls without offering (#2612)
via Toni Rico (@tonidero)
* Add APIs for hybrid SDKs to set presentedOfferingContext (#2610) via
Toni Rico (@tonidero)
* Bump Baseline Profiles to 1.4.0 and update profiles (#2611) via
Jaewoong Eum (@skydoves)
* Migrate deprecated kotlinOptions to compilerOptions (#2607) via
Jaewoong Eum (@skydoves)
* [AUTOMATIC][Paywalls V2] Updates paywall-preview-resources submodule
(#2613) via RevenueCat Git Bot (@RCGitBot)
* Migrate amazon & debugview modules to KTS (#2327) via Jaewoong Eum
(@skydoves)
* Update to Dokka 2.0.0 (#2609) via Toni Rico (@tonidero)
* Add log when restoring purchases finds no purchases with some
troubleshooting (#2599) via Toni Rico (@tonidero)

Co-authored-by: revenuecat-ops <ops@revenuecat.com>
tonidero added a commit that referenced this pull request Aug 25, 2025
Based on #2610

This actually makes use of the presented offering context to pass a
modified offering to the paywall. This data will be sent as part of the
post receipt when a purchase is made.
@tonidero tonidero mentioned this pull request Aug 25, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
pr:force_patch Forces a patch release pr:other
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants