Weather Tracker v1.0.0版本的 MD5 值为:3edef27647e42a8ea0e7c0d2dbf56f97

以下内容为反编译后的 o0.java 源代码,内容仅作参考


package com.chartboost.sdk.impl;

import android.text.TextUtils;
import android.util.Base64;
import com.chartboost.sdk.Analytics;
import com.mbridge.msdk.foundation.entity.CampaignEx;
import java.util.Arrays;
import java.util.Locale;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import kotlin.Metadata;
import kotlin.NoWhenBranchMatchedException;
import kotlin.jvm.internal.Intrinsics;
import kotlin.jvm.internal.StringCompanionObject;
import kotlin.text.Charsets;
import org.json.JSONArray;
import org.json.JSONObject;
@Metadata(d1 = {"\u0000\\\n\u0002\u0018\u0002\n\u0002\u0010\u0000\n\u0002\u0010\u000e\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0010\b\n\u0002\b\u0003\n\u0002\u0010\t\n\u0000\n\u0002\u0010\u0002\n\u0002\b\t\n\u0002\u0018\u0002\n\u0000\n\u0002\u0010\u000b\n\u0002\u0018\u0002\n\u0000\n\u0002\u0010\u0007\n\u0000\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0002\b\u0006\u0018\u00002\u00020\u0001B\u001f\u0012\u0006\u0010 \u001a\u00020\u001e\u0012\u0006\u0010#\u001a\u00020!\u0012\u0006\u0010'\u001a\u00020$¢\u0006\u0004\b(\u0010)J6\u0010\r\u001a\u00020\f2\u0006\u0010\u0003\u001a\u00020\u00022\u0006\u0010\u0005\u001a\u00020\u00042\u0006\u0010\u0007\u001a\u00020\u00062\u0006\u0010\b\u001a\u00020\u00062\u0006\u0010\t\u001a\u00020\u00022\u0006\u0010\u000b\u001a\u00020\nJ^\u0010\r\u001a\u00020\f2\u0006\u0010\u000e\u001a\u00020\u00022\u0006\u0010\u000f\u001a\u00020\u00022\u0006\u0010\t\u001a\u00020\u00022\u0006\u0010\u0010\u001a\u00020\u00022\u0006\u0010\u0011\u001a\u00020\u00022\b\u0010\u0012\u001a\u0004\u0018\u00010\u00022\b\u0010\u0013\u001a\u0004\u0018\u00010\u00022\b\u0010\u0014\u001a\u0004\u0018\u00010\u00022\b\u0010\u0015\u001a\u0004\u0018\u00010\u00022\u0006\u0010\u0017\u001a\u00020\u0016J\b\u0010\r\u001a\u00020\u0018H\u0002J\u001c\u0010\u001a\u001a\u00020\u00192\b\u0010\u0012\u001a\u0004\u0018\u00010\u00022\b\u0010\u0013\u001a\u0004\u0018\u00010\u0002H\u0002J\u001c\u0010\r\u001a\u00020\u00192\b\u0010\u0014\u001a\u0004\u0018\u00010\u00022\b\u0010\u0015\u001a\u0004\u0018\u00010\u0002H\u0002J\u0010\u0010\r\u001a\u00020\u001b2\u0006\u0010\u0010\u001a\u00020\u0002H\u0002J\u0010\u0010\r\u001a\u00020\f2\u0006\u0010\u001c\u001a\u00020\u0019H\u0002J\u0010\u0010\r\u001a\u00020\f2\u0006\u0010\u001c\u001a\u00020\u001dH\u0002R\u0014\u0010 \u001a\u00020\u001e8\u0002X\u0082\u0004¢\u0006\u0006\n\u0004\b\r\u0010\u001fR\u0014\u0010#\u001a\u00020!8\u0002X\u0082\u0004¢\u0006\u0006\n\u0004\b\u001a\u0010\"R\u0014\u0010'\u001a\u00020$8\u0002X\u0082\u0004¢\u0006\u0006\n\u0004\b%\u0010&¨\u0006*"}, d2 = {"Lcom/chartboost/sdk/impl/o0;", "", "", "eventLabel", "Lcom/chartboost/sdk/Analytics$LevelType;", "type", "", "mainLevel", "subLevel", "description", "", "timestamp", "", "a", "productID", CampaignEx.JSON_KEY_TITLE, "price", "currency", "purchaseData", "purchaseSignature", "userID", "purchaseToken", "Lcom/chartboost/sdk/Analytics$IAPType;", "iapType", "", "Lorg/json/JSONObject;", "b", "", "requestData", "Lorg/json/JSONArray;", "Lcom/chartboost/sdk/impl/u8;", "Lcom/chartboost/sdk/impl/u8;", "sdkInitializer", "Lcom/chartboost/sdk/impl/z1;", "Lcom/chartboost/sdk/impl/z1;", "networkService", "Lcom/chartboost/sdk/impl/h8;", "c", "Lcom/chartboost/sdk/impl/h8;", "requestBodyBuilder", "<init>", "(Lcom/chartboost/sdk/impl/u8;Lcom/chartboost/sdk/impl/z1;Lcom/chartboost/sdk/impl/h8;)V", "Chartboost-9.4.1_productionRelease"}, k = 1, mv = {1, 8, 0})
public final class o0 {
    public final u8 a;
    public final z1 f2306b;
    public final h8 c;

    @Metadata(k = 3, mv = {1, 8, 0}, xi = 48)
    public class a {
        public static final int[] a;

        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) {
            }
            a = iArr;
        }
    }

    public o0(u8 sdkInitializer, z1 networkService, h8 requestBodyBuilder) {
        Intrinsics.checkNotNullParameter(sdkInitializer, "sdkInitializer");
        Intrinsics.checkNotNullParameter(networkService, "networkService");
        Intrinsics.checkNotNullParameter(requestBodyBuilder, "requestBodyBuilder");
        this.a = sdkInitializer;
        this.f2306b = networkService;
        this.c = requestBodyBuilder;
    }

    public final void a(String eventLabel, Analytics.LevelType type, int i, int i2, String description, long j) {
        Intrinsics.checkNotNullParameter(eventLabel, "eventLabel");
        Intrinsics.checkNotNullParameter(type, "type");
        Intrinsics.checkNotNullParameter(description, "description");
        try {
            if (!a()) {
                f6.b("AnalyticsApi", "You need call Chartboost.startWithAppId() before tracking in-app purchases");
                return;
            }
            boolean z = true;
            if (eventLabel.length() == 0) {
                f6.b("AnalyticsApi", "Invalid value: event label cannot be empty or null");
                return;
            }
            if (i >= 0 && i2 >= 0) {
                if (description.length() != 0) {
                    z = false;
                }
                if (z) {
                    f6.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;
            }
            f6.b("AnalyticsApi", "Invalid value: Level number should be > 0");
        } catch (Exception e) {
            f6.b("AnalyticsApi", e.toString());
        }
    }

    public final JSONObject b(String str, String str2) {
        boolean z = false;
        if (!(str == null || str.length() == 0)) {
            if (str2 == null || str2.length() == 0) {
                z = true;
            }
            if (!z) {
                JSONObject jSONObject = new JSONObject();
                jSONObject.put("purchaseData", str);
                jSONObject.put("purchaseSignature", str2);
                jSONObject.put("type", Analytics.IAPType.GOOGLE_PLAY.ordinal());
                return jSONObject;
            }
        }
        f6.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 b2;
        Intrinsics.checkNotNullParameter(productID, "productID");
        Intrinsics.checkNotNullParameter(title, "title");
        Intrinsics.checkNotNullParameter(description, "description");
        Intrinsics.checkNotNullParameter(price, "price");
        Intrinsics.checkNotNullParameter(currency, "currency");
        Intrinsics.checkNotNullParameter(iapType, "iapType");
        try {
            if (!a()) {
                f6.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.a[iapType.ordinal()];
            if (i == 1) {
                b2 = b(str, str2);
            } else if (i != 2) {
                throw new NoWhenBranchMatchedException();
            } else {
                b2 = a(str3, str4);
            }
            if (b2.length() == 0) {
                f6.b("AnalyticsApi", "Error while parsing the receipt to a JSON Object, ");
                return;
            }
            String jSONObject = b2.toString();
            Intrinsics.checkNotNullExpressionValue(jSONObject, "receipt.toString()");
            byte[] bytes = jSONObject.getBytes(Charsets.UTF_8);
            Intrinsics.checkNotNullExpressionValue(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("currency", currency);
            jSONObject2.put("productID", productID);
            jSONObject2.put("receipt", encodeToString);
            a(jSONObject2);
        } catch (Exception e) {
            f6.b("AnalyticsApi", e.toString());
        }
    }

    public final boolean a() {
        return this.a.e();
    }

    public final JSONObject a(String str, String str2) {
        boolean z = false;
        if (!(str == null || str.length() == 0)) {
            if (str2 == null || str2.length() == 0) {
                z = true;
            }
            if (!z) {
                JSONObject jSONObject = new JSONObject();
                jSONObject.put("userID", str);
                jSONObject.put("purchaseToken", str2);
                jSONObject.put("type", Analytics.IAPType.AMAZON.ordinal());
                return jSONObject;
            }
        }
        f6.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)) {
                f6.b("AnalyticsApi", "Invalid price object");
                return -1.0f;
            }
            Intrinsics.checkNotNullExpressionValue(result, "result");
            return Float.parseFloat(result);
        } catch (IllegalStateException unused) {
            f6.b("AnalyticsApi", "Invalid price object");
            return -1.0f;
        }
    }

    public final void a(JSONObject jSONObject) {
        StringCompanionObject stringCompanionObject = StringCompanionObject.INSTANCE;
        String format = String.format(Locale.US, "%s%s", Arrays.copyOf(new Object[]{"/post-install-event/", "iap"}, 2));
        Intrinsics.checkNotNullExpressionValue(format, "format(locale, format, *args)");
        c2 c2Var = new c2("https://live.chartboost.com", format, this.c.build(), o7.NORMAL, "iap", null);
        c2Var.a("iap", jSONObject);
        c2Var.o = true;
        this.f2306b.a(c2Var);
    }

    public final void a(JSONArray jSONArray) {
        c2 c2Var = new c2("https://live.chartboost.com", "/post-install-event/tracking", this.c.build(), o7.NORMAL, "tracking", null);
        c2Var.a("track_info", jSONArray);
        c2Var.o = true;
        this.f2306b.a(c2Var);
    }
}