Fix iap
This commit is contained in:
parent
c6555a71ac
commit
a0ca5e81e6
6 changed files with 23 additions and 10 deletions
|
@ -12,8 +12,8 @@ android {
|
|||
|
||||
defaultConfig {
|
||||
// versionCode and versionName must be hardcoded to support F-droid
|
||||
versionCode 800081
|
||||
versionName '8.0.8'
|
||||
versionCode 800091
|
||||
versionName '8.0.9'
|
||||
minSdkVersion 21
|
||||
targetSdkVersion 30
|
||||
multiDexEnabled true
|
||||
|
|
|
@ -8,8 +8,8 @@ android {
|
|||
|
||||
defaultConfig {
|
||||
// versionCode and versionName must be hardcoded to support F-droid
|
||||
versionCode 800081
|
||||
versionName '8.0.8'
|
||||
versionCode 800091
|
||||
versionName '8.0.9'
|
||||
minSdkVersion 21
|
||||
targetSdkVersion 30
|
||||
testInstrumentationRunner 'androidx.test.runner.AndroidJUnitRunner'
|
||||
|
|
|
@ -6,8 +6,8 @@ android {
|
|||
compileSdkVersion 30
|
||||
|
||||
defaultConfig {
|
||||
versionCode 800081
|
||||
versionName '8.0.8'
|
||||
versionCode 800091
|
||||
versionName '8.0.9'
|
||||
minSdkVersion 21
|
||||
targetSdkVersion 30
|
||||
}
|
||||
|
|
|
@ -10,8 +10,8 @@ android {
|
|||
compileSdkVersion 30
|
||||
|
||||
defaultConfig {
|
||||
versionCode 800081
|
||||
versionName '8.0.8'
|
||||
versionCode 800091
|
||||
versionName '8.0.9'
|
||||
minSdkVersion 21
|
||||
targetSdkVersion 30
|
||||
}
|
||||
|
|
|
@ -2,6 +2,7 @@ package dev.lucasnlm.external
|
|||
|
||||
import android.app.Activity
|
||||
import android.content.Context
|
||||
import com.android.billingclient.api.AcknowledgePurchaseParams
|
||||
import com.android.billingclient.api.BillingClient
|
||||
import com.android.billingclient.api.BillingClientStateListener
|
||||
import com.android.billingclient.api.BillingFlowParams
|
||||
|
@ -11,6 +12,7 @@ import com.android.billingclient.api.PurchasesUpdatedListener
|
|||
import com.android.billingclient.api.SkuDetailsParams
|
||||
import com.android.billingclient.api.querySkuDetails
|
||||
|
||||
|
||||
class BillingManager(
|
||||
private val context: Context,
|
||||
) : IBillingManager, BillingClientStateListener, PurchasesUpdatedListener {
|
||||
|
@ -30,6 +32,17 @@ class BillingManager(
|
|||
when (it?.purchaseState) {
|
||||
Purchase.PurchaseState.PURCHASED, Purchase.PurchaseState.PENDING -> true
|
||||
else -> false
|
||||
}.also { purchased ->
|
||||
if (purchased && it?.isAcknowledged == false) {
|
||||
val acknowledgePurchaseParams =
|
||||
AcknowledgePurchaseParams.newBuilder()
|
||||
.setPurchaseToken(it.purchaseToken)
|
||||
.build()
|
||||
|
||||
billingClient.acknowledgePurchase(acknowledgePurchaseParams) {
|
||||
// Purchase acknowledged
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -8,8 +8,8 @@ android {
|
|||
|
||||
defaultConfig {
|
||||
// versionCode and versionName must be hardcoded to support F-droid
|
||||
versionCode 800081
|
||||
versionName '8.0.8'
|
||||
versionCode 800091
|
||||
versionName '8.0.9'
|
||||
applicationId 'dev.lucasnlm.antimine'
|
||||
minSdkVersion 23
|
||||
targetSdkVersion 30
|
||||
|
|
Loading…
Reference in a new issue