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

Commit 822e5a0

Browse files
committed
Keep FetchProductsResultAll as it exists in Types.kt
1 parent eccac31 commit 822e5a0

File tree

4 files changed

+16
-6
lines changed

4 files changed

+16
-6
lines changed

openiap/src/main/java/dev/hyo/openiap/OpenIapModule.kt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,6 @@ import dev.hyo.openiap.utils.BillingConverters.toPurchase
5858
import dev.hyo.openiap.utils.BillingConverters.toSubscriptionProduct
5959
import dev.hyo.openiap.utils.fromBillingState
6060
import dev.hyo.openiap.utils.toActiveSubscription
61-
import dev.hyo.openiap.utils.toProduct
6261
import kotlinx.coroutines.Dispatchers
6362
import kotlinx.coroutines.suspendCancellableCoroutine
6463
import kotlinx.coroutines.withContext

openiap/src/main/java/dev/hyo/openiap/Types.kt

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -562,8 +562,6 @@ public data class FetchProductsResultProducts(val value: List<Product>?) : Fetch
562562

563563
public data class FetchProductsResultSubscriptions(val value: List<ProductSubscription>?) : FetchProductsResult
564564

565-
public data class FetchProductsResultAll(val products: List<Product>?, val subscriptions: List<ProductSubscription>?) : FetchProductsResult
566-
567565
public data class PricingPhaseAndroid(
568566
val billingCycleCount: Int,
569567
val billingPeriod: String,
@@ -2065,6 +2063,10 @@ public interface QueryResolver {
20652063
* Get base64-encoded receipt data for validation
20662064
*/
20672065
suspend fun getReceiptDataIOS(): String?
2066+
/**
2067+
* Get the current storefront country code
2068+
*/
2069+
suspend fun getStorefront(): String
20682070
/**
20692071
* Get the current App Store storefront country code
20702072
*/
@@ -2165,6 +2167,7 @@ public typealias QueryGetAvailablePurchasesHandler = suspend (options: PurchaseO
21652167
public typealias QueryGetPendingTransactionsIOSHandler = suspend () -> List<PurchaseIOS>
21662168
public typealias QueryGetPromotedProductIOSHandler = suspend () -> ProductIOS?
21672169
public typealias QueryGetReceiptDataIOSHandler = suspend () -> String?
2170+
public typealias QueryGetStorefrontHandler = suspend () -> String
21682171
public typealias QueryGetStorefrontIOSHandler = suspend () -> String
21692172
public typealias QueryGetTransactionJwsIOSHandler = suspend (sku: String) -> String?
21702173
public typealias QueryHasActiveSubscriptionsHandler = suspend (subscriptionIds: List<String>?) -> Boolean
@@ -2183,6 +2186,7 @@ public data class QueryHandlers(
21832186
val getPendingTransactionsIOS: QueryGetPendingTransactionsIOSHandler? = null,
21842187
val getPromotedProductIOS: QueryGetPromotedProductIOSHandler? = null,
21852188
val getReceiptDataIOS: QueryGetReceiptDataIOSHandler? = null,
2189+
val getStorefront: QueryGetStorefrontHandler? = null,
21862190
val getStorefrontIOS: QueryGetStorefrontIOSHandler? = null,
21872191
val getTransactionJwsIOS: QueryGetTransactionJwsIOSHandler? = null,
21882192
val hasActiveSubscriptions: QueryHasActiveSubscriptionsHandler? = null,

openiap/src/main/java/dev/hyo/openiap/store/OpenIapStore.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,7 @@ class OpenIapStore(private val module: OpenIapModule) {
172172
val result = module.fetchProducts(ProductRequest(skus = skus, type = type))
173173
when (result) {
174174
is FetchProductsResultProducts -> {
175-
// Merge new in-app products with existing ones
175+
// Merge new products with existing ones
176176
val newProducts = result.value.orEmpty()
177177
val existingProductIds = _products.value.map { it.id }.toSet()
178178
val productsToAdd = newProducts.filter { it.id !in existingProductIds }
@@ -194,7 +194,7 @@ class OpenIapStore(private val module: OpenIapModule) {
194194
_products.value = _products.value + productsToAdd
195195
}
196196
is FetchProductsResultAll -> {
197-
// Replace all with the combined result
197+
// For All type, replace with combined results
198198
_products.value = result.products.orEmpty()
199199
_subscriptions.value = result.subscriptions.orEmpty()
200200
}

scripts/generate-types.sh

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#!/usr/bin/env bash
22
set -euo pipefail
33

4-
VERSION="1.0.8"
4+
VERSION=""
55
SKIP_DOWNLOAD=false
66

77
while [[ $# -gt 0 ]]; do
@@ -47,7 +47,14 @@ REPO_ROOT="$(cd "${SCRIPT_DIR}/.." && pwd)"
4747
TARGET_DIR="${REPO_ROOT}/openiap/src/main/java/dev/hyo/openiap"
4848
TARGET_FILE="${TARGET_DIR}/Types.kt"
4949
VERSION_FILE="${REPO_ROOT}/VERSION"
50+
VERSIONS_JSON="${REPO_ROOT}/openiap-versions.json"
5051

52+
# Try to get version from openiap-versions.json first
53+
if [[ -z "$VERSION" ]] && [[ -f "$VERSIONS_JSON" ]]; then
54+
VERSION="$(python3 -c "import json; print(json.load(open('$VERSIONS_JSON'))['gql'])" 2>/dev/null || true)"
55+
fi
56+
57+
# Fall back to VERSION file if not found
5158
if [[ -z "$VERSION" ]] && [[ -f "$VERSION_FILE" ]]; then
5259
VERSION="$(head -n1 "$VERSION_FILE" | tr -d ' \r')"
5360
fi

0 commit comments

Comments
 (0)