Skip to content

Add hasPaywall property to Offering#4847

Merged
ajpallares merged 7 commits into
mainfrom
offering-has-paywall-getter
Mar 4, 2025
Merged

Add hasPaywall property to Offering#4847
ajpallares merged 7 commits into
mainfrom
offering-has-paywall-getter

Conversation

@ajpallares

@ajpallares ajpallares commented Mar 4, 2025

Copy link
Copy Markdown
Member

Checklist

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

Motivation

Checking whether an Offering has a paywall can be confusing now that we have v1 and v2 paywalls.

Description

  • This PR adds the hasPaywall getter to Offering to make it easier to know whether an Offering has a paywall or not
  • Related to this, I also used this PR to update the documentation of PaywallView (and related) that was implying PaywallData to mean "paywall", which is not true anymore since v2 paywalls.

Returns `true` if the offering has either a v1 or a v2 paywall
…wall", as `PaywallData` only refers to v1 paywalls
@ajpallares ajpallares added the pr:feat A new feature label Mar 4, 2025
@ajpallares ajpallares marked this pull request as ready for review March 4, 2025 08:20
@ajpallares ajpallares requested a review from a team March 4, 2025 08:20

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Made the methods here static to be able to access the decodeFixture from other test clases not inheriting from BaseHTTPResponseTest (see Tests/UnitTests/Purchasing/OfferingsTests.swift)

@ajpallares ajpallares requested review from a team and tonidero March 4, 2025 08:46

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

Nice! Thanks for adding those tests! 🙌

@joshdholtz joshdholtz left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Love this! Thank you 🫶

@ajpallares ajpallares merged commit 81aaf6a into main Mar 4, 2025
@ajpallares ajpallares deleted the offering-has-paywall-getter branch March 4, 2025 11:09
@ajpallares ajpallares changed the title Offering hasPaywall getter Add hasPaywall property to Offering Mar 4, 2025
ajpallares added a commit to RevenueCat/purchases-android that referenced this pull request Mar 4, 2025
### Checklist
- [x] If applicable, unit tests
- [ ] If applicable, create follow-up issues for `purchases-ios` and
hybrids

### Motivation
Checking whether an `Offering` has a paywall is not possible now that
there's also v2 paywalls. Added the same property in iOS (see
RevenueCat/purchases-ios/pull/4847)

### Description
This PR adds the `hasPaywall` property to `Offering` to allow knowing
whether an `Offering` has a paywall or not.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

pr:feat A new feature

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants