Merge pull request #166 from lucasnlm/fix-iap

Fix iap
This commit is contained in:
Lucas Nunes 2020-09-03 00:32:25 -03:00 committed by GitHub
commit 4887201120
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 22 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
@ -30,6 +31,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