From a53b71927e184c6337490618ea34ff7502ad7117 Mon Sep 17 00:00:00 2001 From: Max Muthig Date: Wed, 2 Feb 2022 17:30:47 +0100 Subject: [PATCH 1/5] fixed cancel dialog listener not triggering --- .../main/java/com/anjlab/android/iab/v3/BillingProcessor.java | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/library/src/main/java/com/anjlab/android/iab/v3/BillingProcessor.java b/library/src/main/java/com/anjlab/android/iab/v3/BillingProcessor.java index 8b757e56..cb4e7c69 100644 --- a/library/src/main/java/com/anjlab/android/iab/v3/BillingProcessor.java +++ b/library/src/main/java/com/anjlab/android/iab/v3/BillingProcessor.java @@ -260,6 +260,10 @@ else if (responseCode == BillingClient.BillingResponseCode.ITEM_ALREADY_OWNED) savePurchasePayload(null); } } + else if (responseCode == BillingClient.BillingResponseCode.USER_CANCELED) + { + reportBillingError(BillingClient.BillingResponseCode.USER_CANCELED, new Throwable(billingResult.getDebugMessage())); + } } }; From 1964b2d178a9630b86024e2c36b9fdd471394f8c Mon Sep 17 00:00:00 2001 From: Max Muthig Date: Wed, 2 Feb 2022 17:48:54 +0100 Subject: [PATCH 2/5] build setting fixes for making it compile again --- .gitignore | 2 +- gradle.properties | 6 ++++++ .../src/com/anjlab/android/iab/v3/sample2/MainActivity.java | 2 +- 3 files changed, 8 insertions(+), 2 deletions(-) create mode 100644 gradle.properties diff --git a/.gitignore b/.gitignore index 456c0dd7..2dbe75c5 100644 --- a/.gitignore +++ b/.gitignore @@ -4,7 +4,7 @@ gen/ !.idea/codeStyleSettings.xml build local.properties -gradle.properties +#gradle.properties .gradle *.iml .DS_Store diff --git a/gradle.properties b/gradle.properties new file mode 100644 index 00000000..6b5ba814 --- /dev/null +++ b/gradle.properties @@ -0,0 +1,6 @@ +# Project-wide Gradle settings. + +android.useAndroidX=true +android.enableJetifier=true + + diff --git a/sample/src/com/anjlab/android/iab/v3/sample2/MainActivity.java b/sample/src/com/anjlab/android/iab/v3/sample2/MainActivity.java index 50e1a56f..4dd1948f 100644 --- a/sample/src/com/anjlab/android/iab/v3/sample2/MainActivity.java +++ b/sample/src/com/anjlab/android/iab/v3/sample2/MainActivity.java @@ -39,7 +39,7 @@ public class MainActivity extends Activity { // PRODUCT & SUBSCRIPTION IDS private static final String PRODUCT_ID = "com.anjlab.test.iab.s2.p5"; private static final String SUBSCRIPTION_ID = "com.anjlab.test.iab.subs1"; - private static final String LICENSE_KEY = BuildConfig.licenceKey; // PUT YOUR MERCHANT KEY HERE; + private static final String LICENSE_KEY = "THE_KEY"; //BuildConfig.LICENSE_KEY; // PUT YOUR MERCHANT KEY HERE; // put your Google merchant id here (as stated in public profile of your Payments Merchant Center) // if filled library will provide protection against Freedom alike Play Market simulators private static final String MERCHANT_ID=null; From f37f8b8f5576573f8a5ced6d14b2a7533db157d2 Mon Sep 17 00:00:00 2001 From: Max Muthig Date: Wed, 2 Feb 2022 18:00:21 +0100 Subject: [PATCH 3/5] removed malformatted comment --- .../src/main/java/com/anjlab/android/iab/v3/PurchaseInfo.java | 4 ---- 1 file changed, 4 deletions(-) diff --git a/library/src/main/java/com/anjlab/android/iab/v3/PurchaseInfo.java b/library/src/main/java/com/anjlab/android/iab/v3/PurchaseInfo.java index 5464d665..14615366 100644 --- a/library/src/main/java/com/anjlab/android/iab/v3/PurchaseInfo.java +++ b/library/src/main/java/com/anjlab/android/iab/v3/PurchaseInfo.java @@ -29,10 +29,6 @@ * a purchase from the google play store on his own * server. An example implementation of how to verify * a purchase you can find here: - *
- * See  here 
- * 
*/ public class PurchaseInfo implements Parcelable { From d4020b5797ebca10c7cc78434dd7d0808a429821 Mon Sep 17 00:00:00 2001 From: Max Muthig Date: Wed, 2 Feb 2022 18:13:31 +0100 Subject: [PATCH 4/5] additionally covered all other missing errors. Some (like developer error) might come double now, but better double then not receiving the errors --- .../anjlab/android/iab/v3/BillingProcessor.java | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/library/src/main/java/com/anjlab/android/iab/v3/BillingProcessor.java b/library/src/main/java/com/anjlab/android/iab/v3/BillingProcessor.java index cb4e7c69..bc4c1b40 100644 --- a/library/src/main/java/com/anjlab/android/iab/v3/BillingProcessor.java +++ b/library/src/main/java/com/anjlab/android/iab/v3/BillingProcessor.java @@ -259,10 +259,20 @@ else if (responseCode == BillingClient.BillingResponseCode.ITEM_ALREADY_OWNED) handleItemAlreadyOwned(purchasePayload.split(":")[1]); savePurchasePayload(null); } + + reportBillingError(responseCode, new Throwable(billingResult.getDebugMessage())); + } - else if (responseCode == BillingClient.BillingResponseCode.USER_CANCELED) + else if (responseCode == BillingClient.BillingResponseCode.USER_CANCELED + || responseCode == BillingClient.BillingResponseCode.SERVICE_UNAVAILABLE + || responseCode == BillingClient.BillingResponseCode.BILLING_UNAVAILABLE + || responseCode == BillingClient.BillingResponseCode.ITEM_UNAVAILABLE + || responseCode == BillingClient.BillingResponseCode.DEVELOPER_ERROR + || responseCode == BillingClient.BillingResponseCode.ERROR + || responseCode == BillingClient.BillingResponseCode.ITEM_ALREADY_OWNED + || responseCode == BillingClient.BillingResponseCode.ITEM_NOT_OWNED) { - reportBillingError(BillingClient.BillingResponseCode.USER_CANCELED, new Throwable(billingResult.getDebugMessage())); + reportBillingError(responseCode, new Throwable(billingResult.getDebugMessage())); } } }; From 10688b720a056bbb360707f4163ecef340752ed2 Mon Sep 17 00:00:00 2001 From: Max Muthig Date: Wed, 9 Feb 2022 09:23:19 +0100 Subject: [PATCH 5/5] removed item already owned unnecessary check --- .../main/java/com/anjlab/android/iab/v3/BillingProcessor.java | 1 - 1 file changed, 1 deletion(-) diff --git a/library/src/main/java/com/anjlab/android/iab/v3/BillingProcessor.java b/library/src/main/java/com/anjlab/android/iab/v3/BillingProcessor.java index bc4c1b40..548ec517 100644 --- a/library/src/main/java/com/anjlab/android/iab/v3/BillingProcessor.java +++ b/library/src/main/java/com/anjlab/android/iab/v3/BillingProcessor.java @@ -269,7 +269,6 @@ else if (responseCode == BillingClient.BillingResponseCode.USER_CANCELED || responseCode == BillingClient.BillingResponseCode.ITEM_UNAVAILABLE || responseCode == BillingClient.BillingResponseCode.DEVELOPER_ERROR || responseCode == BillingClient.BillingResponseCode.ERROR - || responseCode == BillingClient.BillingResponseCode.ITEM_ALREADY_OWNED || responseCode == BillingClient.BillingResponseCode.ITEM_NOT_OWNED) { reportBillingError(responseCode, new Throwable(billingResult.getDebugMessage()));