Skip to content

Commit

Permalink
Testing fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
SpertsyanKM committed Nov 23, 2023
1 parent 0624497 commit 4fa938c
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -443,7 +443,6 @@ internal class QProductCenterManager internal constructor(
}

launchResultCache.productPermissions?.let {
// todo check that old flow still has subscriptionId
val purchasedProduct = launchResult.products.values.find { product ->
product.storeID == purchase.productId
} ?: run {
Expand Down Expand Up @@ -780,7 +779,11 @@ internal class QProductCenterManager internal constructor(
return
}

callbacks.forEach { it.onSuccess(launchResult.products) }
val products = launchResult.products.values.toList()
billingService.enrichStoreData(products)
callbacks.forEach { callback ->
callback.onSuccess(products.associateBy { it.qonversionID })
}
}

@Synchronized
Expand Down Expand Up @@ -882,9 +885,7 @@ internal class QProductCenterManager internal constructor(
}

private fun handlePurchases(purchases: List<Purchase>) {
val products = launchResultCache.getLaunchResult()?.products?.values?.toList()
?: emptyList()
billingService.consumePurchases(purchases, products)
billingService.consumePurchases(purchases)

purchases.forEach { purchase ->
val purchaseCallback = purchasingCallbacks[purchase.productId]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ internal interface BillingService {
updatePolicy: QPurchaseUpdatePolicy? = null
)

fun consumePurchases(purchases: List<Purchase>, products: List<QProduct>)
fun consumePurchases(purchases: List<Purchase>)

fun consumeHistoryRecords(historyRecords: List<PurchaseHistory>)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ internal class QonversionBillingService internal constructor(
}
}

override fun consumePurchases(purchases: List<Purchase>, products: List<QProduct>) {
override fun consumePurchases(purchases: List<Purchase>) {
if (isAnalyticsMode) {
return
}
Expand Down

0 comments on commit 4fa938c

Please sign in to comment.