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

Add valueInMonths helper to Period class #1250

Merged
merged 2 commits into from
Sep 19, 2023

Conversation

tonidero
Copy link
Contributor

@tonidero tonidero commented Sep 15, 2023

Description

To help with the variables work needed for paywalls, this adds a helper function valueInMonths for the Period class. This will be used to calculate the price per month.

@tonidero tonidero added the pr:feat A new feature label Sep 15, 2023
String formatted = price.getFormatted();
Long amount = price.getAmountMicros();
String currencyCode = price.getCurrencyCode();
}
Copy link
Contributor Author

Choose a reason for hiding this comment

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

While looking at other things, I noticed that the Price class didn't have API tests. This adds them.

@tonidero tonidero marked this pull request as ready for review September 15, 2023 10:18
@tonidero tonidero requested a review from a team September 15, 2023 10:18
@codecov
Copy link

codecov bot commented Sep 15, 2023

Codecov Report

Patch coverage: 100.00% and project coverage change: +0.01% 🎉

Comparison is base (a463ccd) 85.45% compared to head (93acb70) 85.46%.
Report is 2 commits behind head on paywalls.

Additional details and impacted files
@@             Coverage Diff              @@
##           paywalls    #1250      +/-   ##
============================================
+ Coverage     85.45%   85.46%   +0.01%     
============================================
  Files           187      187              
  Lines          6351     6358       +7     
  Branches        923      924       +1     
============================================
+ Hits           5427     5434       +7     
  Misses          567      567              
  Partials        357      357              
Files Changed Coverage Δ
...n/kotlin/com/revenuecat/purchases/models/Period.kt 95.00% <100.00%> (+1.06%) ⬆️

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

@@ -41,6 +46,18 @@ data class Period(
YEAR,
UNKNOWN,
}

val valueInMonths: Double
Copy link
Contributor

Choose a reason for hiding this comment

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

I guess detekt doesn't enforce it, but it would be nice to always add docstrings to public methods.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Completely agree, there are actually rules to check for that but we don't have them enabled: https://detekt.dev/docs/rules/comments/#undocumentedpublicproperty. Create a linear ticket to track this.

@tonidero tonidero requested a review from NachoSoto September 18, 2023 08:04
@tonidero tonidero merged commit ed76366 into paywalls Sep 19, 2023
@tonidero tonidero deleted the add-value-in-months-helper-to-period branch September 19, 2023 07:37
tonidero added a commit that referenced this pull request Oct 31, 2023
### Description
To help with the variables work needed for paywalls, this adds a helper
function `valueInMonths` for the `Period` class. This will be used to
calculate the price per month.
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.

2 participants