mirror of
https://github.com/TeamAmaze/AmazeFileManager.git
synced 2026-10-16 20:51:21 +08:00
Merge pull request #4685 from TeamAmaze/feature/billing-8.0
Upgrade Google Play Billing library to 8.0.0
This commit is contained in:
committed by
EmmanuelMess
parent
5407007125
commit
0edffd0986
@@ -44,6 +44,7 @@ import com.android.billingclient.api.Purchase
|
||||
import com.android.billingclient.api.PurchasesUpdatedListener
|
||||
import com.android.billingclient.api.QueryProductDetailsParams
|
||||
import com.android.billingclient.api.QueryProductDetailsParams.Product
|
||||
import com.android.billingclient.api.QueryProductDetailsResult
|
||||
import org.slf4j.LoggerFactory
|
||||
import java.util.concurrent.Callable
|
||||
|
||||
@@ -59,13 +60,28 @@ class Billing(private val activity: BasicActivity) :
|
||||
private lateinit var productDetails: List<ProductDetails>
|
||||
|
||||
// create new donations client
|
||||
private lateinit var billingClient: BillingClient
|
||||
private var billingClient: BillingClient
|
||||
|
||||
// True if billing service is connected
|
||||
private var isServiceConnected = false
|
||||
|
||||
private lateinit var donationDialog: MaterialDialog
|
||||
|
||||
init {
|
||||
productList =
|
||||
listOf(
|
||||
createProductWith("donations"),
|
||||
createProductWith("donations_2"),
|
||||
createProductWith("donations_3"),
|
||||
createProductWith("donations_4"),
|
||||
)
|
||||
billingClient =
|
||||
BillingClient.newBuilder(activity).setListener(this).enablePendingPurchases(
|
||||
PendingPurchasesParams.newBuilder().enableOneTimeProducts().build(),
|
||||
).build()
|
||||
initiatePurchaseFlow()
|
||||
}
|
||||
|
||||
override fun onPurchasesUpdated(
|
||||
response: BillingResult,
|
||||
purchases: List<Purchase>?,
|
||||
@@ -93,11 +109,11 @@ class Billing(private val activity: BasicActivity) :
|
||||
|
||||
billingClient.queryProductDetailsAsync(
|
||||
params.build(),
|
||||
) { responseCode: BillingResult, queryResult: List<ProductDetails> ->
|
||||
if (queryResult.isNotEmpty()) {
|
||||
) { responseCode: BillingResult, queryResult: QueryProductDetailsResult ->
|
||||
if (queryResult.productDetailsList.isNotEmpty()) {
|
||||
// Successfully fetched product details
|
||||
productDetails = queryResult
|
||||
popProductsList(responseCode, queryResult)
|
||||
productDetails = queryResult.productDetailsList
|
||||
popProductsList(responseCode, queryResult.productDetailsList)
|
||||
} else {
|
||||
AppConfig.toast(activity, R.string.error_fetching_google_play_product_list)
|
||||
@Suppress("ktlint:standard:max-line-length")
|
||||
@@ -198,21 +214,6 @@ class Billing(private val activity: BasicActivity) :
|
||||
}
|
||||
}
|
||||
|
||||
init {
|
||||
productList =
|
||||
listOf(
|
||||
createProductWith("donations"),
|
||||
createProductWith("donations_2"),
|
||||
createProductWith("donations_3"),
|
||||
createProductWith("donations_4"),
|
||||
)
|
||||
billingClient =
|
||||
BillingClient.newBuilder(activity).setListener(this).enablePendingPurchases(
|
||||
PendingPurchasesParams.newBuilder().enableOneTimeProducts().build(),
|
||||
).build()
|
||||
initiatePurchaseFlow()
|
||||
}
|
||||
|
||||
/**
|
||||
* We executes a connection request to Google Play
|
||||
*
|
||||
|
||||
@@ -45,7 +45,7 @@ apacheMina = "2.0.16"
|
||||
mockito = "4.11.0"
|
||||
mockitoInline = "4.11.0"
|
||||
mockitoKotlin = "4.1.0"
|
||||
androidBilling = "7.1.1"
|
||||
androidBilling = "8.0.0"
|
||||
cloudrailSiAndroid = "2.22.4"
|
||||
junrar = "7.4.0"
|
||||
vectordrawableAnimated = "1.2.0"
|
||||
|
||||
Reference in New Issue
Block a user