This commit is contained in:
Lucas Lima 2020-09-03 00:17:55 -03:00
parent c6555a71ac
commit a0ca5e81e6
No known key found for this signature in database
GPG key ID: C5EEF4C30BFBF8D7
6 changed files with 23 additions and 10 deletions

View file

@ -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

View file

@ -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'

View file

@ -6,8 +6,8 @@ android {
compileSdkVersion 30
defaultConfig {
versionCode 800081
versionName '8.0.8'
versionCode 800091
versionName '8.0.9'
minSdkVersion 21
targetSdkVersion 30
}

View file

@ -10,8 +10,8 @@ android {
compileSdkVersion 30
defaultConfig {
versionCode 800081
versionName '8.0.8'
versionCode 800091
versionName '8.0.9'
minSdkVersion 21
targetSdkVersion 30
}

View file

@ -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
}
}
}
}

View file

@ -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