discord-jadx/app/src/main/java/c/d/a/a/k.java

106 lines
4.7 KiB
Java

package c.d.a.a;
import android.os.Bundle;
import c.i.a.f.h.n.a;
import com.android.billingclient.api.SkuDetails;
import java.util.ArrayList;
import java.util.List;
import java.util.Objects;
import java.util.concurrent.Callable;
import org.json.JSONException;
/* compiled from: com.android.billingclient:billing@@3.0.3 */
public final class k implements Callable<Void> {
public final /* synthetic */ String i;
public final /* synthetic */ List j;
public final /* synthetic */ g k;
public final /* synthetic */ a l;
public k(a aVar, String str, List list, g gVar) {
this.l = aVar;
this.i = str;
this.j = list;
this.k = gVar;
}
/* Return type fixed from 'java.lang.Object' to match base method */
@Override // java.util.concurrent.Callable
public final Void call() throws Exception {
r rVar;
a aVar = this.l;
String str = this.i;
List list = this.j;
Objects.requireNonNull(aVar);
ArrayList arrayList = new ArrayList();
int size = list.size();
int i = 0;
while (true) {
if (i >= size) {
rVar = new r(0, "", arrayList);
break;
}
int i2 = i + 20;
ArrayList arrayList2 = new ArrayList(list.subList(i, i2 > size ? size : i2));
ArrayList<String> arrayList3 = new ArrayList<>();
int size2 = arrayList2.size();
for (int i3 = 0; i3 < size2; i3++) {
arrayList3.add(((s) arrayList2.get(i3)).a);
}
Bundle bundle = new Bundle();
bundle.putStringArrayList("ITEM_ID_LIST", arrayList3);
bundle.putString("playBillingLibraryVersion", aVar.b);
try {
Bundle K = aVar.m ? aVar.f.K(10, aVar.e.getPackageName(), str, bundle, a.f(aVar.j, aVar.q, aVar.b, null, arrayList2)) : aVar.f.k0(3, aVar.e.getPackageName(), str, bundle);
if (K == null) {
a.b("BillingClient", "querySkuDetailsAsync got null sku details list");
rVar = new r(4, "Item is unavailable for purchase.", null);
break;
} else if (K.containsKey("DETAILS_LIST")) {
ArrayList<String> stringArrayList = K.getStringArrayList("DETAILS_LIST");
if (stringArrayList == null) {
a.b("BillingClient", "querySkuDetailsAsync got null response list");
rVar = new r(4, "Item is unavailable for purchase.", null);
break;
}
for (int i4 = 0; i4 < stringArrayList.size(); i4++) {
try {
SkuDetails skuDetails = new SkuDetails(stringArrayList.get(i4));
String valueOf = String.valueOf(skuDetails);
StringBuilder sb = new StringBuilder(valueOf.length() + 17);
sb.append("Got sku details: ");
sb.append(valueOf);
a.a("BillingClient", sb.toString());
arrayList.add(skuDetails);
} catch (JSONException unused) {
a.b("BillingClient", "Got a JSON exception trying to decode SkuDetails.");
rVar = new r(6, "Error trying to decode SkuDetails.", null);
}
}
i = i2;
} else {
int d = a.d(K, "BillingClient");
String e = a.e(K, "BillingClient");
if (d != 0) {
StringBuilder sb2 = new StringBuilder(50);
sb2.append("getSkuDetails() failed. Response code: ");
sb2.append(d);
a.b("BillingClient", sb2.toString());
rVar = new r(d, e, arrayList);
} else {
a.b("BillingClient", "getSkuDetails() returned a bundle with neither an error nor a detail list.");
rVar = new r(6, e, arrayList);
}
}
} catch (Exception e2) {
String valueOf2 = String.valueOf(e2);
StringBuilder sb3 = new StringBuilder(valueOf2.length() + 63);
sb3.append("querySkuDetailsAsync got a remote exception (try to reconnect).");
sb3.append(valueOf2);
a.b("BillingClient", sb3.toString());
rVar = new r(-1, "Service connection is disconnected.", null);
}
}
this.l.h(new j(this, rVar));
return null;
}
}