From a3123dcee3b093328b3480ac6314577a5bb4ddb8 Mon Sep 17 00:00:00 2001 From: M66B Date: Thu, 2 Jul 2020 13:16:26 +0200 Subject: [PATCH] Refactoring --- .../eu/faircode/email/ActivityBilling.java | 21 +++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/app/src/iab/java/eu/faircode/email/ActivityBilling.java b/app/src/iab/java/eu/faircode/email/ActivityBilling.java index a136c1afa7..0d778911ac 100644 --- a/app/src/iab/java/eu/faircode/email/ActivityBilling.java +++ b/app/src/iab/java/eu/faircode/email/ActivityBilling.java @@ -506,19 +506,28 @@ public class ActivityBilling extends ActivityBase implements PurchasesUpdatedLis if (result == null) message = stage; else { + message = getBillingResponseText(result); + String debug = result.getDebugMessage(); - message = getBillingResponseText(result) + (debug == null ? "" : " " + debug) + " " + stage; + if (!TextUtils.isEmpty(debug)) + message += " " + debug; + + message += " " + stage; + } + + EntityLog.log(this, message); + if (result != null) { // https://developer.android.com/reference/com/android/billingclient/api/BillingClient.BillingResponse#service_disconnected if (result.getResponseCode() == BillingClient.BillingResponseCode.SERVICE_DISCONNECTED) retry(60); - } - EntityLog.log(this, message); + if (result.getResponseCode() == BillingClient.BillingResponseCode.USER_CANCELED) + return; + } - if (result.getResponseCode() != BillingClient.BillingResponseCode.USER_CANCELED) - for (IBillingListener listener : listeners) - listener.onError(message); + for (IBillingListener listener : listeners) + listener.onError(message); } private static String getBillingResponseText(BillingResult result) {