Galaxy Store Free Trial Eligibility Detection#2947
Conversation
Generated by 🚫 Danger |
| private const val ELIGIBILITY_PRICING_TIERED_PRICE = "TieredPrice" | ||
|
|
||
| internal fun ProductVo.toStoreProduct( | ||
| promotionEligibilities: List<PromotionEligibilityVo>? = null, |
There was a problem hiding this comment.
You may be wondering why ProductVo.storeProduct now takes in a List<PromotionEligibilityVo>? instead of a single PromotionEligibilityVo?. This is because the IapHelper.getPromotionEligibility()'s listener provides us with an ArrayList of PromotionEligibilityVo? objects:
public interface OnGetPromotionEligibilityListener {
void onGetPromotionEligibility(@NotNull ErrorVo var1, @NotNull ArrayList<PromotionEligibilityVo> var2);
}And thus, it's allowed by the API to receive multiple PromotionEligibilityVos for the same product ID. I haven't seen this happen in my testing, but since it's technically allowed, it's a case we need to handle.
| ?.filter { it.itemId == this.itemId } | ||
| ?.mapTo(eligibilityPricings) { it.pricing } | ||
|
|
||
| if ( |
There was a problem hiding this comment.
We still haven't seen this case appear in our testing, but since it's possible through the API, it's probably worth handling in the code :)
tonidero
left a comment
There was a problem hiding this comment.
Looks great! Just some comments but nothing big.
| recurrenceMode = RecurrenceMode.NON_RECURRING, | ||
| billingCycleCount = null, | ||
| price = Price( | ||
| formatted = "%s%.2f".format(currencyUnit, 0.0), |
There was a problem hiding this comment.
FWIW, I think Google returns Free as a string in this case... But that's problematic for us since we would need to localize that string... So I'm ok just putting 0.0 for now, and we can reassess later
| ReplaceWith("presentedOfferingContext.offeringIdentifier"), | ||
| ) | ||
| override val presentedOfferingIdentifier: String? | ||
| get() = presentedOfferingContext?.offeringIdentifier |
There was a problem hiding this comment.
Is this populated later at some point? for google, we add a copyWithPresentedOfferingContext method that creates a copy of subscription options with the context added. Seems we're missing that here?
There was a problem hiding this comment.
Great callout, it looks like this happens at the StoreProduct level. I'll add that logic to GalaxyStoreProduct.copyWithPresentedOfferingContext()
There was a problem hiding this comment.
Updated to do this in cd237ec 👍
I'm going to go ahead and merge this so I can start working on including intro offers :)
…xySubscriptionOption.kt Co-authored-by: Toni Rico <toni.rico.diez@revenuecat.com>
Description
This PR adds support for including free trials for Galaxy Store products in the
pricingPhasesproperty of theGalaxySubscriptionOption. It does so by creating one (and only one) SubscriptionOption for each Galaxy subscription product, and, when the user is eligible for a free trial, it includes the free trial in that SubscriptionOption'spricingPhases.As a part of this exercise, we also needed to modify
GalaxyPurchasingDatato keep a reference to just the product ID and product type, instead of the entireStoreProductto avoid a circular reference betweenGalaxyStoreProductandGalaxySubscriptionOption.Out of Scope
This PR intentionally does not add introductory subscription pricing phases when a user is eligible for one. Support for those will come in the future :)