Pixel Fusion v1.0.3版本的 MD5 值为:e0cc7f5615caec50798ef549b679d557
以下内容为反编译后的 x0.java 源代码,内容仅作参考
package com.chartboost.sdk.impl;
import android.text.TextUtils;
import android.util.Base64;
import com.chartboost.sdk.Analytics;
import com.unity3d.ads.metadata.InAppPurchaseMetaData;
import java.util.Arrays;
import java.util.Locale;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import kotlin.NoWhenBranchMatchedException;
import kotlin.jvm.internal.DcBba;
import kotlin.jvm.internal.cdaAcAdAD;
import kotlin.text.cdCCdCc;
import org.json.JSONArray;
import org.json.JSONObject;
public final class x0 {
public final qa f35229a;
public final q2 b;
public final ca c;
public final z4 d;
public class a {
public static final int[] f35230a;
static {
int[] iArr = new int[Analytics.IAPType.values().length];
try {
iArr[Analytics.IAPType.GOOGLE_PLAY.ordinal()] = 1;
} catch (NoSuchFieldError unused) {
}
try {
iArr[Analytics.IAPType.AMAZON.ordinal()] = 2;
} catch (NoSuchFieldError unused2) {
}
f35230a = iArr;
}
}
public x0(qa sdkInitializer, q2 networkService, ca requestBodyBuilder, z4 eventTracker) {
DcBba.daAbdddd(sdkInitializer, "sdkInitializer");
DcBba.daAbdddd(networkService, "networkService");
DcBba.daAbdddd(requestBodyBuilder, "requestBodyBuilder");
DcBba.daAbdddd(eventTracker, "eventTracker");
this.f35229a = sdkInitializer;
this.b = networkService;
this.c = requestBodyBuilder;
this.d = eventTracker;
}
public final void a(String eventLabel, Analytics.LevelType type, int i, int i2, String description, long j) {
DcBba.daAbdddd(eventLabel, "eventLabel");
DcBba.daAbdddd(type, "type");
DcBba.daAbdddd(description, "description");
try {
if (!a()) {
w7.b("AnalyticsApi", "You need call Chartboost.startWithAppId() before tracking in-app purchases");
return;
}
if (eventLabel.length() == 0) {
w7.b("AnalyticsApi", "Invalid value: event label cannot be empty or null");
return;
}
if (i >= 0 && i2 >= 0) {
if (description.length() == 0) {
w7.b("AnalyticsApi", "Invalid value: description cannot be empty or null");
return;
}
JSONArray jSONArray = new JSONArray();
JSONObject jSONObject = new JSONObject();
jSONObject.put("event_label", eventLabel);
jSONObject.put("event_field", type.getLevelType());
jSONObject.put("main_level", i);
jSONObject.put("sub_level", i2);
jSONObject.put("description", description);
jSONObject.put("timestamp", j);
jSONObject.put("data_type", "level_info");
jSONArray.put(jSONObject);
a(jSONArray);
return;
}
w7.b("AnalyticsApi", "Invalid value: Level number should be > 0");
} catch (Exception e) {
w7.b("AnalyticsApi", e.toString());
}
}
public final JSONObject b(String str, String str2) {
if (str != null && str.length() != 0 && str2 != null && str2.length() != 0) {
JSONObject jSONObject = new JSONObject();
jSONObject.put("purchaseData", str);
jSONObject.put("purchaseSignature", str2);
jSONObject.put("type", Analytics.IAPType.GOOGLE_PLAY.ordinal());
return jSONObject;
}
w7.b("AnalyticsApi", "Null object is passed for for purchase data or purchase signature");
return new JSONObject();
}
public final void a(String productID, String title, String description, String price, String currency, String str, String str2, String str3, String str4, Analytics.IAPType iapType) {
JSONObject b;
DcBba.daAbdddd(productID, "productID");
DcBba.daAbdddd(title, "title");
DcBba.daAbdddd(description, "description");
DcBba.daAbdddd(price, "price");
DcBba.daAbdddd(currency, "currency");
DcBba.daAbdddd(iapType, "iapType");
try {
if (!a()) {
w7.b("AnalyticsApi", "You need call Chartboost.startWithAppId() before tracking in-app purchases");
return;
}
float a2 = a(price);
if (a2 == -1.0f) {
return;
}
int i = a.f35230a[iapType.ordinal()];
if (i == 1) {
b = b(str, str2);
} else if (i == 2) {
b = a(str3, str4);
} else {
throw new NoWhenBranchMatchedException();
}
if (b.length() == 0) {
w7.b("AnalyticsApi", "Error while parsing the receipt to a JSON Object, ");
return;
}
String jSONObject = b.toString();
DcBba.bBCadBacC(jSONObject, "receipt.toString()");
byte[] bytes = jSONObject.getBytes(cdCCdCc.UTF_8);
DcBba.bBCadBacC(bytes, "this as java.lang.String).getBytes(charset)");
String encodeToString = Base64.encodeToString(bytes, 2);
JSONObject jSONObject2 = new JSONObject();
jSONObject2.put("localized-title", title);
jSONObject2.put("localized-description", description);
jSONObject2.put("price", Float.valueOf(a2));
jSONObject2.put(InAppPurchaseMetaData.KEY_CURRENCY, currency);
jSONObject2.put("productID", productID);
jSONObject2.put("receipt", encodeToString);
a(jSONObject2);
} catch (Exception e) {
w7.b("AnalyticsApi", e.toString());
}
}
public final boolean a() {
return this.f35229a.e();
}
public final JSONObject a(String str, String str2) {
if (str != null && str.length() != 0 && str2 != null && str2.length() != 0) {
JSONObject jSONObject = new JSONObject();
jSONObject.put("userID", str);
jSONObject.put("purchaseToken", str2);
jSONObject.put("type", Analytics.IAPType.AMAZON.ordinal());
return jSONObject;
}
w7.b("AnalyticsApi", "Null object is passed for for amazon user id or amazon purchase token");
return new JSONObject();
}
public final float a(String str) {
try {
Matcher matcher = Pattern.compile("(\\d+\\.\\d+)|(\\d+)").matcher(str);
matcher.find();
String result = matcher.group();
if (TextUtils.isEmpty(result)) {
w7.b("AnalyticsApi", "Invalid price object");
return -1.0f;
}
DcBba.bBCadBacC(result, "result");
return Float.parseFloat(result);
} catch (IllegalStateException unused) {
w7.b("AnalyticsApi", "Invalid price object");
return -1.0f;
}
}
public final void a(JSONObject jSONObject) {
cdaAcAdAD cdaacadad = cdaAcAdAD.f63874BbdcDCacCa;
String format = String.format(Locale.US, "%s%s", Arrays.copyOf(new Object[]{"/post-install-event/", InAppPurchaseMetaData.IAP_KEY}, 2));
DcBba.bBCadBacC(format, "format(locale, format, *args)");
t2 t2Var = new t2("https://live.chartboost.com", format, this.c.a(), i9.NORMAL, InAppPurchaseMetaData.IAP_KEY, null, this.d);
t2Var.a(InAppPurchaseMetaData.IAP_KEY, jSONObject);
t2Var.r = true;
this.b.a(t2Var);
}
public final void a(JSONArray jSONArray) {
t2 t2Var = new t2("https://live.chartboost.com", "/post-install-event/tracking", this.c.a(), i9.NORMAL, "tracking", null, this.d);
t2Var.a("track_info", jSONArray);
t2Var.r = true;
this.b.a(t2Var);
}
}