Hello,
I’m struggling with the RevenueCat update from 5.x to 6.4.0 on Android.
I have currently a method to load the weekly subscription, however product doesn’t have subscriptionPeriod any longer.
fun loadWeeklyProduct(onPackageLoaded: (Package?) -> Unit) {
Purchases.sharedInstance.getOfferingsWith(
{ error ->
// An error occurred
}) { offerings ->
val annualProduct = offerings.current?.availablePackages?.firstOrNull { item ->
item.product.subscriptionPeriod == "P1W"
}
onPackageLoaded(annualProduct)
}
}
And with this other method I would check if they still are eligible for Trial. Sadly product also no longer has any freeTrialPeriod.
private fun fillTrialOrNormal(it: Package) {
val hasFreeTrial = !it.product.freeTrialPeriod.isNullOrEmpty()
Utilities().checkTrialUsedUp(it.product.sku, hasFreeTrial) { trialUsedUp ->
var title = ""
var header = ""
if (trialUsedUp) {
title = "${it.product.price} / Year"
header = getString(R.string.upgrade_to_premium)
binding.premiumTextId.text = header
} else {
title = "Start Your 3 Days Free Trial,\nThen ${it.product.price} / Year"
}
binding.trialPurchaseButtonId.text = title
binding.trialPurchaseButtonId.isEnabled = true
}
}
I couldn’t find anything about this on the migration document. I would really appreciate any hints how to achieve this.
Many Thanks,
Houman