diff --git a/apps/multiplatform/common/src/commonMain/kotlin/chat/simplex/common/views/badges/BadgeStore.kt b/apps/multiplatform/common/src/commonMain/kotlin/chat/simplex/common/views/badges/BadgeStore.kt index 17e402cca0..dc6ad6f55d 100644 --- a/apps/multiplatform/common/src/commonMain/kotlin/chat/simplex/common/views/badges/BadgeStore.kt +++ b/apps/multiplatform/common/src/commonMain/kotlin/chat/simplex/common/views/badges/BadgeStore.kt @@ -99,6 +99,9 @@ data class BadgeStoreReceipt( // receipt says so. const val useBadgeTestProducts = false +// test products stand in for a store, so the lane is offered without one +val badgeStoreAvailable: Boolean get() = useBadgeTestProducts || platform.androidHasPlatformStore + private fun testProduct(level: BadgeLevel, period: BadgePeriod, priceMicros: Long) = BadgeProduct(badgeStoreProductId(level, period), "\$${priceMicros / 1_000_000}.00", priceMicros, "USD") @@ -161,7 +164,7 @@ object BadgeStore { private val presenting = mutableMapOf() fun purchaseState(userId: Long?): BadgePurchaseState? { - if (!platform.androidHasPlatformStore) return null + if (!badgeStoreAvailable) return null val purchases = openStorePurchases(userId) val held = unfinished.value.values.mapNotNull { it.invoiceId }.toSet() return when { @@ -173,7 +176,7 @@ object BadgeStore { } fun canBuy(userId: Long?): Boolean = - platform.androidHasPlatformStore && reconciledOnce.value && buying.value.isEmpty() && purchaseState(userId) == null + badgeStoreAvailable && reconciledOnce.value && buying.value.isEmpty() && purchaseState(userId) == null fun setStorePurchases(rhId: Long?, userId: Long, purchases: List) { storePurchases.value = Triple(rhId, userId, purchases) diff --git a/apps/multiplatform/common/src/commonMain/kotlin/chat/simplex/common/views/badges/BadgesSupportSimplexView.kt b/apps/multiplatform/common/src/commonMain/kotlin/chat/simplex/common/views/badges/BadgesSupportSimplexView.kt index 075685649f..81d840c9a0 100644 --- a/apps/multiplatform/common/src/commonMain/kotlin/chat/simplex/common/views/badges/BadgesSupportSimplexView.kt +++ b/apps/multiplatform/common/src/commonMain/kotlin/chat/simplex/common/views/badges/BadgesSupportSimplexView.kt @@ -64,7 +64,7 @@ fun BadgesSupportSimplexView(modalManager: ModalManager) { Spacer(Modifier.weight(1f)) Column(horizontalAlignment = Alignment.CenterHorizontally) { - if (platform.androidHasPlatformStore) { + if (badgeStoreAvailable) { ChooseLevelButton(modalManager) if (badgeBrowserAllowed()) { BuyInBrowserTextButton()