Add tiered subscriptions (intro offers) to Galaxy Store pricing phases#2954
Conversation
| GalaxyStrings.PARSING_INTRO_PRICING_PHASES_FOR_SUBS_TIERED_PRICING_NOT_SUPPORTED | ||
| } | ||
| this.createFreeTrialPricingPhase()?.let { pricingPhases.addFirst(it) } | ||
| this.createFreeTrialPricingPhase()?.let { pricingPhases.add(it) } |
There was a problem hiding this comment.
Replacing addFirst with add to avoid some Android OS level availability requirements
|
|
||
| private fun ProductVo.createPrice(): Price = | ||
| Price( | ||
| private fun ProductVo.createTieredSubscriptionPricingPhase(): PricingPhase? { |
There was a problem hiding this comment.
Extracted the price creation logic from ProductVo.createPrice() to createPriceFromGalaxyData()` so it can be reused
|
|
||
| @SuppressWarnings("MagicNumber", "ReturnCount") | ||
| private fun ProductVo.createPeriod(): Period? { | ||
| private fun ProductVo.createPeriod(): Period? = createPeriodFromGalaxyData( |
There was a problem hiding this comment.
Extracted the period creation logic from ProductVo.createPeriod() to createPeriodFromGalaxyData()` so it can be reused
tonidero
left a comment
There was a problem hiding this comment.
Looks great! just a comment on something I think we should fix, but could be done in a separate PR
| // Here, we manually build the formatted string instead of using ProductVo.itemPriceString | ||
| // because itemPriceString doesn't include the decimal values if the amount is an integer with no decimal value. | ||
| // This way, we can get strings like "$3.00" instead of "$3" | ||
| formatted = "%s%.2f".format(currencyUnit, itemPrice), |
There was a problem hiding this comment.
I missed this in previous PRs.... But I think we should use itemPriceString if available? Note that there are currencies where there are no cents or that it's preferred to show the price without cents when it's a whole number. We could try to handle it ourselves, but I would probably default to what the Galaxy store provides normally.
There was a problem hiding this comment.
I think that makes sense! Updated to use itemPriceString in 9992e97
Description
Adds support for including tiered subscription (intro offers) in
GalaxySubscriptionOption's pricing phases