121 lines
6.3 KiB
Java
121 lines
6.3 KiB
Java
package c.d.a.a;
|
|
|
|
import android.os.Bundle;
|
|
import android.text.TextUtils;
|
|
import c.i.a.f.h.n.a;
|
|
import com.android.billingclient.api.BillingResult;
|
|
import com.android.billingclient.api.Purchase;
|
|
import java.util.ArrayList;
|
|
import java.util.concurrent.Callable;
|
|
import org.json.JSONException;
|
|
/* compiled from: com.android.billingclient:billing@@3.0.3 */
|
|
public final class i implements Callable<Purchase.a> {
|
|
public final /* synthetic */ String i;
|
|
public final /* synthetic */ a j;
|
|
|
|
public i(a aVar, String str) {
|
|
this.j = aVar;
|
|
this.i = str;
|
|
}
|
|
|
|
/* Return type fixed from 'java.lang.Object' to match base method */
|
|
@Override // java.util.concurrent.Callable
|
|
public final Purchase.a call() throws Exception {
|
|
a aVar = this.j;
|
|
String str = this.i;
|
|
String valueOf = String.valueOf(str);
|
|
a.a("BillingClient", valueOf.length() != 0 ? "Querying owned items, item type: ".concat(valueOf) : new String("Querying owned items, item type: "));
|
|
ArrayList arrayList = new ArrayList();
|
|
boolean z2 = aVar.l;
|
|
boolean z3 = aVar.q;
|
|
String str2 = aVar.b;
|
|
Bundle bundle = new Bundle();
|
|
bundle.putString("playBillingLibraryVersion", str2);
|
|
int i = 1;
|
|
if (z2 && z3) {
|
|
bundle.putBoolean("enablePendingPurchases", true);
|
|
}
|
|
String str3 = null;
|
|
do {
|
|
try {
|
|
Bundle Q = aVar.l ? aVar.f.Q(9, aVar.e.getPackageName(), str, str3, bundle) : aVar.f.p0(3, aVar.e.getPackageName(), str, str3);
|
|
BillingResult billingResult = q.h;
|
|
if (Q == null) {
|
|
Object[] objArr = new Object[i];
|
|
objArr[0] = "getPurchase()";
|
|
a.b("BillingClient", String.format("%s got null owned items list", objArr));
|
|
} else {
|
|
int d = a.d(Q, "BillingClient");
|
|
String e = a.e(Q, "BillingClient");
|
|
BillingResult billingResult2 = new BillingResult();
|
|
billingResult2.a = d;
|
|
billingResult2.b = e;
|
|
if (d != 0) {
|
|
a.b("BillingClient", String.format("%s failed. Response code: %s", "getPurchase()", Integer.valueOf(d)));
|
|
billingResult = billingResult2;
|
|
i = 1;
|
|
} else if (!Q.containsKey("INAPP_PURCHASE_ITEM_LIST") || !Q.containsKey("INAPP_PURCHASE_DATA_LIST") || !Q.containsKey("INAPP_DATA_SIGNATURE_LIST")) {
|
|
i = 1;
|
|
a.b("BillingClient", String.format("Bundle returned from %s doesn't contain required fields.", "getPurchase()"));
|
|
} else {
|
|
ArrayList<String> stringArrayList = Q.getStringArrayList("INAPP_PURCHASE_ITEM_LIST");
|
|
ArrayList<String> stringArrayList2 = Q.getStringArrayList("INAPP_PURCHASE_DATA_LIST");
|
|
ArrayList<String> stringArrayList3 = Q.getStringArrayList("INAPP_DATA_SIGNATURE_LIST");
|
|
if (stringArrayList == null) {
|
|
i = 1;
|
|
a.b("BillingClient", String.format("Bundle returned from %s contains null SKUs list.", "getPurchase()"));
|
|
} else {
|
|
i = 1;
|
|
if (stringArrayList2 == null) {
|
|
a.b("BillingClient", String.format("Bundle returned from %s contains null purchases list.", "getPurchase()"));
|
|
} else if (stringArrayList3 == null) {
|
|
a.b("BillingClient", String.format("Bundle returned from %s contains null signatures list.", "getPurchase()"));
|
|
} else {
|
|
billingResult = q.i;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
if (billingResult != q.i) {
|
|
return new Purchase.a(billingResult, null);
|
|
}
|
|
ArrayList<String> stringArrayList4 = Q.getStringArrayList("INAPP_PURCHASE_ITEM_LIST");
|
|
ArrayList<String> stringArrayList5 = Q.getStringArrayList("INAPP_PURCHASE_DATA_LIST");
|
|
ArrayList<String> stringArrayList6 = Q.getStringArrayList("INAPP_DATA_SIGNATURE_LIST");
|
|
for (int i2 = 0; i2 < stringArrayList5.size(); i2++) {
|
|
String str4 = stringArrayList5.get(i2);
|
|
String str5 = stringArrayList6.get(i2);
|
|
String valueOf2 = String.valueOf(stringArrayList4.get(i2));
|
|
a.a("BillingClient", valueOf2.length() != 0 ? "Sku is owned: ".concat(valueOf2) : new String("Sku is owned: "));
|
|
try {
|
|
Purchase purchase = new Purchase(str4, str5);
|
|
if (TextUtils.isEmpty(purchase.a())) {
|
|
a.b("BillingClient", "BUG: empty/null token!");
|
|
}
|
|
arrayList.add(purchase);
|
|
} catch (JSONException e2) {
|
|
String valueOf3 = String.valueOf(e2);
|
|
StringBuilder sb = new StringBuilder(valueOf3.length() + 48);
|
|
sb.append("Got an exception trying to decode the purchase: ");
|
|
sb.append(valueOf3);
|
|
a.b("BillingClient", sb.toString());
|
|
return new Purchase.a(q.h, null);
|
|
}
|
|
}
|
|
str3 = Q.getString("INAPP_CONTINUATION_TOKEN");
|
|
String valueOf4 = String.valueOf(str3);
|
|
a.a("BillingClient", valueOf4.length() != 0 ? "Continuation token: ".concat(valueOf4) : new String("Continuation token: "));
|
|
} catch (Exception e3) {
|
|
String valueOf5 = String.valueOf(e3);
|
|
StringBuilder sb2 = new StringBuilder(valueOf5.length() + 57);
|
|
sb2.append("Got exception trying to get purchases: ");
|
|
sb2.append(valueOf5);
|
|
sb2.append("; try to reconnect");
|
|
a.b("BillingClient", sb2.toString());
|
|
return new Purchase.a(q.j, null);
|
|
}
|
|
} while (!TextUtils.isEmpty(str3));
|
|
return new Purchase.a(q.i, arrayList);
|
|
}
|
|
}
|