Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -228,9 +228,23 @@ internal object CustomerCenterConfigTestData {
)

val purchaseInformationPromotional = PurchaseInformation(
title = "rc_promo_Test1_lifetime",
title = "Entitlement",
pricePaid = PriceDetails.Free,
expirationOrRenewal = ExpirationOrRenewal.Expiration("April 24th, 2225"),
expirationOrRenewal = ExpirationOrRenewal.Expiration("October 25th, 2025"),
store = Store.PROMOTIONAL,
managementURL = null,
product = null,
isSubscription = false,
isExpired = false,
isTrial = false,
isCancelled = true,
isLifetime = true,
)

val purchaseInformationPromotionalLifetime = PurchaseInformation(
title = "Entitlement",
pricePaid = PriceDetails.Free,
expirationOrRenewal = ExpirationOrRenewal.Expiration("September 6th, 2225"),
store = Store.PROMOTIONAL,
managementURL = null,
product = null,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,11 @@ private fun getSubtitle(
purchaseInformation: PurchaseInformation,
localization: CustomerCenterConfigData.Localization,
): String? {
// Lifetime purchases should not show expiration dates
if (purchaseInformation.isLifetime) {
return getPrice(purchaseInformation, localization)
}

return when (purchaseInformation.expirationOrRenewal) {
is ExpirationOrRenewal.Expiration ->
purchaseInformation.expirationString(purchaseInformation.expirationOrRenewal.date, localization)
Expand Down Expand Up @@ -182,6 +187,7 @@ private class PurchaseInformationProvider : PreviewParameterProvider<PurchaseInf
CustomerCenterConfigTestData.purchaseInformationYearlyExpired,
CustomerCenterConfigTestData.purchaseInformationFreeTrial,
CustomerCenterConfigTestData.purchaseInformationPromotional,
CustomerCenterConfigTestData.purchaseInformationPromotionalLifetime,
CustomerCenterConfigTestData.purchaseInformationLifetime,
CustomerCenterConfigTestData.purchaseInformationMonthlyRenewing.copy(
title = "Monthly long subscription name that overflows",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import androidx.compose.runtime.Composable
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.tooling.preview.Preview
import com.revenuecat.purchases.Store
import com.revenuecat.purchases.customercenter.CustomerCenterConfigData
import com.revenuecat.purchases.customercenter.CustomerCenterConfigData.HelpPath
import com.revenuecat.purchases.ui.revenuecatui.customercenter.CustomerCenterConstants
Expand Down Expand Up @@ -45,7 +46,9 @@ internal fun RelevantPurchasesListView(
.verticalScroll(rememberScrollState()),
horizontalAlignment = Alignment.Start,
) {
val subscriptions = purchases.filter { it.isSubscription }.toSet()
val subscriptions = purchases.filter {
it.isSubscription || (it.store == Store.PROMOTIONAL && !it.isLifetime)
}.toSet()
val nonSubscriptions = (purchases - subscriptions).toSet()

PurchaseListSection(
Expand Down