StoreProduct: new pricePerWeek and pricePerYear#1426
Conversation
This brings parity with `purchases-ios` and will be used for a new paywalls variable.
| @Category(AndroidJUnit4::class) | ||
| class PriceExtensionsPricePerMonthTest: PriceExtensionsPricePerPeriodTest() { | ||
| @Test | ||
| @Parameters( |
There was a problem hiding this comment.
Nice! yeah, I once tried to update to Juni5 to use them, but they were not compatible with Robolectric, which we use in a bunch of our tests... But adding a library like this for tests makes sense 👍
| final String formattedPricePerMonth = product.formattedPricePerMonth(locale); | ||
| final Price pricePerWeek = product.pricePerWeek(locale); | ||
| final Price pricePerMonth = product.pricePerMonth(locale); | ||
| final Price pricePerYear = product.pricePerYear(locale); |
There was a problem hiding this comment.
We should also add versions without the optional parameter to these (I see we didn't have them for the pricePerMonth and formattedPricePerMonth...), same in the Kotlin API tests.
| * For Google subscriptions, this value will use the basePlan to calculate the value. | ||
| * @param locale Locale to use for formatting the price. Default is the system default locale. | ||
| */ | ||
| fun pricePerWeek(locale: Locale = Locale.getDefault()): Price? { |
There was a problem hiding this comment.
We should add a @JvmOverloads here I think, so thee default value works in Java. Same in pricePerYear
There was a problem hiding this comment.
Oh it's because @JvmOverloads isn't allowed on interface methods.
There was a problem hiding this comment.
We can add those explicitly overloaded in a separate PR.
| @Category(AndroidJUnit4::class) | ||
| class PriceExtensionsPricePerMonthTest: PriceExtensionsPricePerPeriodTest() { | ||
| @Test | ||
| @Parameters( |
There was a problem hiding this comment.
Nice! yeah, I once tried to update to Juni5 to use them, but they were not compatible with Robolectric, which we use in a bunch of our tests... But adding a library like this for tests makes sense 👍
Depends on #1426. Equivalent to RevenueCat/purchases-ios#3355.
Depends on #1426. Equivalent to RevenueCat/purchases-ios#3355.
**This is an automatic release.** ### New Features * `StoreProduct`: new `pricePerWeek` and `pricePerYear` (#1426) via NachoSoto (@NachoSoto) ### RevenueCatUI * Fix RevenueCatUI API issues and add API tests (#1433) via Toni Rico (@tonidero) * Paywalls: Add initial snapshot testings for RevenueCatUI library (#1432) via Toni Rico (@tonidero) * `Paywalls`: new `{{ sub_price_per_week }}` variable (#1427) via NachoSoto (@NachoSoto) * `Paywalls`: new `{{ sub_relative_discount }}` variable (#1425) via NachoSoto (@NachoSoto) ### Dependency Updates * Bump fastlane-plugin-revenuecat_internal from `a297205` to `0ddee10` (#1431) via dependabot[bot] (@dependabot[bot]) ### Other Changes * `Offering`: restore constructor with no `PaywallData` (#1437) via NachoSoto (@NachoSoto) Co-authored-by: revenuecat-ops <ops@revenuecat.com>

This brings parity with
purchases-iosand will be used for a new paywalls variable.