Picsart v24.6版本的 MD5 值为:21a61631d94e54da68d2ad9268b8b9d9

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


package com.applovin.impl.mediation.c.b;

import android.net.Uri;
import android.webkit.URLUtil;
import com.amazon.device.ads.DTBMetricsConfiguration;
import com.amazon.device.ads.DtbConstants;
import com.applovin.impl.sdk.AppLovinError;
import com.applovin.impl.sdk.e.w;
import com.applovin.impl.sdk.n;
import com.applovin.impl.sdk.nativeAd.AppLovinNativeAdLoadListener;
import com.applovin.impl.sdk.network.c;
import com.applovin.impl.sdk.utils.JsonUtils;
import com.applovin.impl.sdk.utils.StringUtils;
import com.applovin.impl.sdk.x;
import com.applovin.mediation.MaxAdFormat;
import com.applovin.mediation.adapter.parameters.MaxAdapterInitializationParameters;
import com.applovin.mediation.adapter.parameters.MaxAdapterResponseParameters;
import com.google.android.gms.measurement.api.AppMeasurementSdk;
import java.util.HashMap;
import java.util.Map;
import java.util.concurrent.TimeUnit;
import org.json.JSONArray;
import org.json.JSONObject;
public class a extends com.applovin.impl.mediation.c.b {
    public static final Uri awK = Uri.parse("https://api.taboola.com/");
    private String awC;
    private final Uri awL;
    private final Map<String, Object> awM;
    private String awN;
    private final String awz;

    public a(String str, String str2, String str3, n nVar) {
        super("TaboolaApiService", nVar);
        this.awC = "init";
        this.awN = "";
        this.awz = str;
        Uri parse = URLUtil.isValidUrl(str3) ? Uri.parse(str3) : awK;
        this.awL = Uri.withAppendedPath(parse, "2.0/json/" + str2);
        HashMap hashMap = new HashMap(3);
        this.awM = hashMap;
        hashMap.put("type", DTBMetricsConfiguration.APSMETRICS_LEVEL2_KEY);
        hashMap.put(DTBMetricsConfiguration.APSMETRICS_APIKEY, str);
        hashMap.put(AppMeasurementSdk.ConditionalUserProperty.ORIGIN, "SERVER");
    }

    private Integer a(MaxAdapterResponseParameters maxAdapterResponseParameters, String str, Integer num) {
        if (maxAdapterResponseParameters.getLocalExtraParameters().containsKey(str)) {
            Object obj = maxAdapterResponseParameters.getLocalExtraParameters().get(str);
            if (obj instanceof Integer) {
                return (Integer) obj;
            }
        }
        return Integer.valueOf(maxAdapterResponseParameters.getCustomParameters().getInt(str, num.intValue()));
    }

    private String a(MaxAdapterResponseParameters maxAdapterResponseParameters, String str, String str2) {
        if (maxAdapterResponseParameters.getLocalExtraParameters().containsKey(str)) {
            Object obj = maxAdapterResponseParameters.getLocalExtraParameters().get(str);
            if (obj instanceof String) {
                return (String) obj;
            }
        }
        return maxAdapterResponseParameters.getCustomParameters().getString(str, str2);
    }

    private JSONObject a(MaxAdapterResponseParameters maxAdapterResponseParameters) {
        Map<String, Object> Dr = this.sdk.Cr() != null ? this.sdk.Cr().Dr() : this.sdk.Co().Dr();
        String valueOf = String.valueOf(Dr.get("ua"));
        String valueOf2 = String.valueOf(Dr.get("idfa"));
        String str = this.awC;
        Map<String, Object> localExtraParameters = maxAdapterResponseParameters.getLocalExtraParameters();
        if (localExtraParameters.containsKey("taboola_session")) {
            Object obj = localExtraParameters.get("taboola_session");
            if (obj instanceof String) {
                str = (String) obj;
            }
        }
        JSONObject jSONObject = new JSONObject();
        JsonUtils.putString(jSONObject, "session", str);
        JsonUtils.putString(jSONObject, "agent", valueOf);
        JsonUtils.putString(jSONObject, "device", valueOf2);
        JsonUtils.putString(jSONObject, "id", this.awN);
        JsonUtils.putString(jSONObject, "realip", maxAdapterResponseParameters.getServerParameters().getString("s2s_ip", ""));
        return jSONObject;
    }

    private void a(final b bVar) {
        HashMap hashMap = new HashMap(2);
        hashMap.put("app.type", DTBMetricsConfiguration.APSMETRICS_LEVEL2_KEY);
        hashMap.put("app.apikey", this.awz);
        c.a F = com.applovin.impl.sdk.network.c.F(this.sdk);
        this.sdk.Cj().b(new w<JSONObject>(F.da(this.awL.toString() + "/user.sync").db("GET").j(hashMap).ad(new JSONObject()).aU(false).aW(false).Jd(), this.sdk) {
            @Override
            public void a(String str, int i, String str2, JSONObject jSONObject) {
                if (x.FL()) {
                    x xVar = this.logger;
                    String str3 = this.tag;
                    xVar.i(str3, "Unable to fetch user id. Server returned " + i);
                }
                bVar.onInitialized(false, str2);
            }

            @Override
            public void a(String str, JSONObject jSONObject, int i) {
                if (i != 200 || jSONObject == null) {
                    String m = j.m("Unable to fetch user id. Server returned ", i);
                    if (x.FL()) {
                        this.logger.i(this.tag, m);
                    }
                    bVar.onInitialized(false, m);
                    return;
                }
                JSONObject jSONObject2 = JsonUtils.getJSONObject(jSONObject, "user", new JSONObject());
                a.this.awN = JsonUtils.getString(jSONObject2, "id", "");
                this.sdk.a(com.applovin.impl.mediation.c.c.awp, (com.applovin.impl.mediation.c.c<String>) a.this.awN, ((com.applovin.impl.mediation.c.b) a.this).awh);
                this.sdk.a(com.applovin.impl.mediation.c.c.awq, (com.applovin.impl.mediation.c.c<Long>) Long.valueOf(System.currentTimeMillis()), ((com.applovin.impl.mediation.c.b) a.this).awh);
                bVar.onInitialized(true, null);
            }
        });
    }

    private JSONObject b(MaxAdapterResponseParameters maxAdapterResponseParameters) {
        JSONObject jSONObject = new JSONObject();
        JsonUtils.putString(jSONObject, "type", maxAdapterResponseParameters.getCustomParameters().getString("source_type", ""));
        JsonUtils.putString(jSONObject, "id", maxAdapterResponseParameters.getCustomParameters().getString("source_id", ""));
        JsonUtils.putString(jSONObject, "url", maxAdapterResponseParameters.getCustomParameters().getString("source_url", ""));
        return jSONObject;
    }

    private JSONObject c(MaxAdapterResponseParameters maxAdapterResponseParameters) {
        JSONObject jSONObject = new JSONObject();
        JsonUtils.putString(jSONObject, "id", a(maxAdapterResponseParameters, "taboola_view_id", ""));
        return jSONObject;
    }

    private JSONArray d(MaxAdapterResponseParameters maxAdapterResponseParameters) {
        JSONArray jSONArray = new JSONArray();
        JSONObject jSONObject = new JSONObject();
        JsonUtils.putString(jSONObject, AppMeasurementSdk.ConditionalUserProperty.NAME, maxAdapterResponseParameters.getThirdPartyAdPlacementId());
        JsonUtils.putInt(jSONObject, "recCount", 1);
        JsonUtils.putString(jSONObject, "organicType", maxAdapterResponseParameters.getCustomParameters().getString("placement_type", "MIX"));
        Map<String, Object> localExtraParameters = maxAdapterResponseParameters.getLocalExtraParameters();
        if (localExtraParameters.containsKey("taboola_thumbnail_height") && localExtraParameters.containsKey("taboola_thumbnail_width")) {
            Integer a = a(maxAdapterResponseParameters, "taboola_thumbnail_height", (Integer) 0);
            Integer a2 = a(maxAdapterResponseParameters, "taboola_thumbnail_width", (Integer) 0);
            if (a.intValue() > 0 && a2.intValue() > 0) {
                JSONObject jSONObject2 = new JSONObject();
                JsonUtils.putInt(jSONObject2, "width", a.intValue());
                JsonUtils.putInt(jSONObject2, "height", a2.intValue());
                JsonUtils.putJSONObject(jSONObject, "thumbnail", jSONObject2);
            }
        }
        jSONArray.put(jSONObject);
        return jSONArray;
    }

    private JSONObject zR() {
        JSONObject jSONObject = new JSONObject();
        Map<String, Object> Ef = this.sdk.Cr() != null ? this.sdk.Cr().Ef() : this.sdk.Co().Dx();
        Object obj = Ef.get(DtbConstants.IABTCF_GDPR_APPLIES);
        if (obj != null) {
            JsonUtils.putObject(jSONObject, "gdpr_applies", obj);
            JsonUtils.putString(jSONObject, "daisyBit", String.valueOf(Ef.get(DtbConstants.IABTCF_TC_STRING)));
        }
        return jSONObject;
    }

    public void a(MaxAdapterInitializationParameters maxAdapterInitializationParameters, b bVar) {
        String str = (String) this.sdk.b(com.applovin.impl.mediation.c.c.awp, null, this.awh);
        Long l = (Long) this.sdk.b(com.applovin.impl.mediation.c.c.awq, null, this.awh);
        if (!StringUtils.isValidString(str) || l == null) {
            a(bVar);
        } else if (maxAdapterInitializationParameters.getServerParameters().getLong("user_id_expiration_millis", TimeUnit.DAYS.toMillis(30L)) - (System.currentTimeMillis() - l.longValue()) <= TimeUnit.HOURS.toMillis(1L)) {
            a(bVar);
        } else {
            this.awN = str;
            bVar.onInitialized(true, null);
        }
    }

    public void a(final MaxAdapterResponseParameters maxAdapterResponseParameters, final AppLovinNativeAdLoadListener appLovinNativeAdLoadListener) {
        JSONObject jSONObject = new JSONObject();
        JsonUtils.putJSONObject(jSONObject, "app", new JSONObject(this.awM));
        JsonUtils.putJSONObject(jSONObject, "consent", zR());
        JsonUtils.putJSONObject(jSONObject, "user", a(maxAdapterResponseParameters));
        JsonUtils.putJSONObject(jSONObject, "source", b(maxAdapterResponseParameters));
        JsonUtils.putJSONObject(jSONObject, "view", c(maxAdapterResponseParameters));
        JsonUtils.putJsonArray(jSONObject, "placements", d(maxAdapterResponseParameters));
        c.a F = com.applovin.impl.sdk.network.c.F(this.sdk);
        this.sdk.Cj().b(new w<JSONObject>(F.da(this.awL.toString() + "/recommendations.get").db("POST").L(jSONObject).ad(new JSONObject()).aU(false).aW(false).Jd(), this.sdk) {
            @Override
            public void a(String str, int i, String str2, JSONObject jSONObject2) {
                if (x.FL()) {
                    x xVar = this.logger;
                    String str3 = this.tag;
                    xVar.i(str3, "Unable to fetch " + maxAdapterResponseParameters.getThirdPartyAdPlacementId() + " Taboola ad: server returned " + i);
                }
                AppLovinNativeAdLoadListener appLovinNativeAdLoadListener2 = appLovinNativeAdLoadListener;
                appLovinNativeAdLoadListener2.onNativeAdLoadFailed(new AppLovinError(i, "Taboola server returned with code: " + jSONObject2));
            }

            @Override
            public void a(String str, JSONObject jSONObject2, int i) {
                if (i == 200 && jSONObject2 != null) {
                    JSONObject jSONObject3 = JsonUtils.getJSONObject(jSONObject2, "user", new JSONObject());
                    a.this.awC = JsonUtils.getString(jSONObject3, "session", "");
                    this.sdk.Cj().b(new c(jSONObject2, maxAdapterResponseParameters, MaxAdFormat.NATIVE, appLovinNativeAdLoadListener, this.sdk));
                    return;
                }
                if (x.FL()) {
                    x xVar = this.logger;
                    String str2 = this.tag;
                    xVar.i(str2, "Unable to fetch " + maxAdapterResponseParameters.getThirdPartyAdPlacementId() + " Taboola ad: server returned " + i);
                }
                AppLovinNativeAdLoadListener appLovinNativeAdLoadListener2 = appLovinNativeAdLoadListener;
                appLovinNativeAdLoadListener2.onNativeAdLoadFailed(new AppLovinError(i, "Taboola server returned with code: " + jSONObject2));
            }
        });
    }
}