Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Paywalls: fix empty description when using custom package type and Offer Period #1519

Merged
merged 5 commits into from
Dec 20, 2023

Conversation

aboedo
Copy link
Member

@aboedo aboedo commented Dec 6, 2023

Android equivalent of RevenueCat/purchases-ios#3495

If you select a custom package type and set Offer Period, the paywall would have an empty entry for that package.

image

Before After
Screenshot_20231206-144952 Screenshot_20231206-151434

@aboedo aboedo requested review from dpannasch and a team December 6, 2023 18:26
@aboedo aboedo self-assigned this Dec 6, 2023
@@ -169,8 +169,7 @@ class VariableProcessorTest {

@Test
fun `process variables processes sub_period custom period`() {
rcPackage = TestData.Packages.annual.copy(packageType = PackageType.CUSTOM)
expectVariablesResult("{{ sub_period }}", "")
expectVariablesResult("{{ sub_period }}", "Custom", rcPackage = TestData.Packages.custom)
Copy link
Contributor

Choose a reason for hiding this comment

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

<3

Copy link

codecov bot commented Dec 6, 2023

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (9e8bd79) 84.36% compared to head (93e893f) 84.36%.

❗ Current head 93e893f differs from pull request most recent head 0c35307. Consider uploading reports for the commit 0c35307 to get more accurate results

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #1519   +/-   ##
=======================================
  Coverage   84.36%   84.36%           
=======================================
  Files         218      218           
  Lines        7177     7177           
  Branches     1004     1004           
=======================================
  Hits         6055     6055           
  Misses        734      734           
  Partials      388      388           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@@ -50,6 +50,9 @@ internal class VariableDataProvider(
}

fun periodName(rcPackage: Package): String? {
if (rcPackage.packageType == PackageType.CUSTOM) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Ditto to iOS: UNKNOWN should use this too.

Copy link
Member Author

Choose a reason for hiding this comment

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

updated here as well, thanks!

@@ -50,6 +50,10 @@ internal class VariableDataProvider(
}

fun periodName(rcPackage: Package): String? {
Copy link
Contributor

Choose a reason for hiding this comment

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

What happens if we return null because the resource is not found in line 67? Maybe we should move the fallback to identifier wherever this function is called

Copy link
Contributor

Choose a reason for hiding this comment

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

Yeah that would be the same approach as in iOS 👍🏻

@aboedo aboedo force-pushed the andy/fix/custom_identifier_showing_empty_period branch from 0c35307 to dfffd20 Compare December 20, 2023 16:12
@aboedo aboedo enabled auto-merge (squash) December 20, 2023 16:14
@aboedo aboedo merged commit 89b7b98 into main Dec 20, 2023
@aboedo aboedo deleted the andy/fix/custom_identifier_showing_empty_period branch December 20, 2023 16:32
tonidero pushed a commit that referenced this pull request Dec 21, 2023
**This is an automatic release.**

### RevenueCatUI
* Paywalls: fix empty description when using custom package type and
Offer Period (#1519) via Andy Boedo (@aboedo)
### Bugfixes
* Disable close button when action is in progress (#1528) via Cesar de
la Vega (@vegaro)
### Dependency Updates
* Bump danger from 9.4.1 to 9.4.2 (#1527) via dependabot[bot]
(@dependabot[bot])
### Other Changes
* Add revenuecatui docs to reference docs (#1526) via Toni Rico
(@tonidero)

Co-authored-by: revenuecat-ops <ops@revenuecat.com>
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.

3 participants