react-native-iap 14.4.42 → 14.4.43
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -6,6 +6,7 @@ import com.margelo.nitro.core.Promise
|
|
|
6
6
|
import dev.hyo.openiap.AndroidSubscriptionOfferInput
|
|
7
7
|
import dev.hyo.openiap.DeepLinkOptions as OpenIapDeepLinkOptions
|
|
8
8
|
import dev.hyo.openiap.FetchProductsResult
|
|
9
|
+
import dev.hyo.openiap.FetchProductsResultAll
|
|
9
10
|
import dev.hyo.openiap.FetchProductsResultProducts
|
|
10
11
|
import dev.hyo.openiap.FetchProductsResultSubscriptions
|
|
11
12
|
import dev.hyo.openiap.OpenIapError as OpenIAPError
|
|
@@ -329,7 +330,22 @@ class HybridRnIap : HybridRnIapSpec() {
|
|
|
329
330
|
|
|
330
331
|
try {
|
|
331
332
|
initConnection(null).await()
|
|
332
|
-
|
|
333
|
+
|
|
334
|
+
// Ensure Activity is available for purchase flow
|
|
335
|
+
val activity = withContext(Dispatchers.Main) {
|
|
336
|
+
runCatching { context.currentActivity }
|
|
337
|
+
.getOrNull()
|
|
338
|
+
}
|
|
339
|
+
|
|
340
|
+
if (activity == null) {
|
|
341
|
+
RnIapLog.warn("requestPurchase: Activity is null - cannot start purchase flow")
|
|
342
|
+
sendPurchaseError(toErrorResult(OpenIAPError.ActivityUnavailable))
|
|
343
|
+
return@async defaultResult
|
|
344
|
+
}
|
|
345
|
+
|
|
346
|
+
withContext(Dispatchers.Main) {
|
|
347
|
+
openIap.setActivity(activity)
|
|
348
|
+
}
|
|
333
349
|
|
|
334
350
|
val missingSkus = androidRequest.skus.filterNot { productTypeBySku.containsKey(it) }
|
|
335
351
|
if (missingSkus.isNotEmpty()) {
|
|
@@ -727,6 +743,7 @@ class HybridRnIap : HybridRnIapSpec() {
|
|
|
727
743
|
private fun FetchProductsResult.productsOrEmpty(): List<ProductCommon> = when (this) {
|
|
728
744
|
is FetchProductsResultProducts -> this.value.orEmpty().filterIsInstance<ProductCommon>()
|
|
729
745
|
is FetchProductsResultSubscriptions -> this.value.orEmpty().filterIsInstance<ProductCommon>()
|
|
746
|
+
is FetchProductsResultAll -> this.value.orEmpty().filterIsInstance<ProductCommon>()
|
|
730
747
|
}
|
|
731
748
|
|
|
732
749
|
private fun dev.hyo.openiap.RequestPurchaseResult?.purchasesOrEmpty(): List<OpenIapPurchase> = when (this) {
|
package/package.json
CHANGED