Skip to content
This repository was archived by the owner on Oct 17, 2025. It is now read-only.

Commit f83e2f6

Browse files
committed
chore: migrate to [email protected]
1 parent 4522634 commit f83e2f6

File tree

1 file changed

+9
-6
lines changed

1 file changed

+9
-6
lines changed

openiap/src/main/java/dev/hyo/openiap/horizon/OpenIapHorizonModule.kt

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -100,9 +100,12 @@ class OpenIapHorizonModule(
100100
}
101101

102102
when (params.type) {
103-
ProductRequest.ProductRequestType.ALL -> { query(BillingClient.ProductType.INAPP); query(BillingClient.ProductType.SUBS) }
104-
ProductRequest.ProductRequestType.INAPP -> query(BillingClient.ProductType.INAPP)
105-
ProductRequest.ProductRequestType.SUBS -> query(BillingClient.ProductType.SUBS)
103+
ProductRequest.ProductRequestType.All -> {
104+
query(BillingClient.ProductType.INAPP)
105+
query(BillingClient.ProductType.SUBS)
106+
}
107+
ProductRequest.ProductRequestType.InApp -> query(BillingClient.ProductType.INAPP)
108+
ProductRequest.ProductRequestType.Subs -> query(BillingClient.ProductType.SUBS)
106109
}
107110
results
108111
}
@@ -157,7 +160,7 @@ class OpenIapHorizonModule(
157160
): List<OpenIapPurchase> = withContext(Dispatchers.IO) {
158161
val client = billingClient ?: throw OpenIapError.NotPrepared
159162
val activity = currentActivity ?: throw OpenIapError.MissingCurrentActivity
160-
val desiredType = if (type == ProductRequest.ProductRequestType.SUBS) BillingClient.ProductType.SUBS else BillingClient.ProductType.INAPP
163+
val desiredType = if (type == ProductRequest.ProductRequestType.Subs) BillingClient.ProductType.SUBS else BillingClient.ProductType.INAPP
161164
if (request.skus.isEmpty()) throw OpenIapError.EmptySkuList
162165

163166
val products = request.skus.map { sku ->
@@ -293,7 +296,7 @@ class OpenIapHorizonModule(
293296
id = details.productId,
294297
title = details.title,
295298
description = details.description,
296-
type = if (productType == BillingClient.ProductType.SUBS) OpenIapProduct.ProductType.SUBS else OpenIapProduct.ProductType.INAPP,
299+
type = if (productType == BillingClient.ProductType.SUBS) OpenIapProduct.ProductType.Subs else OpenIapProduct.ProductType.InApp,
297300
displayName = details.name,
298301
displayPrice = displayPrice,
299302
currency = currency,
@@ -341,7 +344,7 @@ class OpenIapHorizonModule(
341344
purchaseToken = purchase.purchaseToken,
342345
platform = "android",
343346
quantity = purchase.quantity,
344-
purchaseState = OpenIapPurchase.PurchaseState.PURCHASED,
347+
purchaseState = OpenIapPurchase.PurchaseState.Purchased,
345348
isAutoRenewing = purchase.isAutoRenewing(),
346349
purchaseTokenAndroid = purchase.purchaseToken,
347350
dataAndroid = purchase.originalJson,

0 commit comments

Comments
 (0)