Hi!
I'm trying to verify if a user has subscribed in the past in order to decide which button to show for a purchase. However, after a reinstallation, it seems that RevenueCat resets the user’s status. I have also tried checking if the entitlements are empty — they always are — so I end up showing the “Start Trial” button even when I shouldn’t. Google Play does not show the trial period because, for this user, it was already used. I’m currently in the internal testing phase. I’m using the latest version of the SDK.
Here is the relevant code snippet:
fun getButtonText(pkg: Package?, customerInfo: CustomerInfo?): String {
if (pkg == null || customerInfo == null) return "Continue"
val hasIntroOffer = pkg.product.subscriptionOptions?.any { it.freePhase != null } == true
val hasNeverSubscribed = customerInfo.allPurchasedProductIds.contains(pkg.product.id).not()
if (hasIntroOffer && hasNeverSubscribed) {
return when (pkg.packageType) {
PackageType.ANNUAL -> "Start 7-Day Free Trial"
PackageType.MONTHLY -> "Start 3-Day Free Trial"
else -> "Start Free Trial"
}
}
return "Continue"
}
