Recover Files v1.3.9版本的 MD5 值为:27a8b2c239c6cb7111d74d6bb07d21b2

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


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

import android.net.Uri;
import android.webkit.URLUtil;
import androidx.annotation.Nullable;
import androidx.browser.trusted.sharing.ShareTarget;
import com.applovin.impl.sdk.AppLovinError;
import com.applovin.impl.sdk.e.d;
import com.applovin.impl.sdk.e.x;
import com.applovin.impl.sdk.nativeAd.AppLovinNativeAdLoadListener;
import com.applovin.impl.sdk.network.c;
import com.applovin.impl.sdk.o;
import com.applovin.impl.sdk.utils.JsonUtils;
import com.applovin.impl.sdk.utils.StringUtils;
import com.applovin.impl.sdk.y;
import com.applovin.mediation.MaxAdFormat;
import com.applovin.mediation.adapter.parameters.MaxAdapterInitializationParameters;
import com.applovin.mediation.adapter.parameters.MaxAdapterResponseParameters;
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.b.b {

    public static final Uri f9652d = Uri.parse("https://api.taboola.com/");

    private final String f9653e;

    private final Uri f9654f;

    private final Map<String, Object> f9655g;

    private String f9656h;

    private String f9657i;

    public a(String str, String str2, @Nullable String str3, o oVar) {
        super("TaboolaApiService", oVar);
        this.f9656h = "init";
        this.f9657i = "";
        this.f9653e = str;
        this.f9654f = Uri.withAppendedPath(URLUtil.isValidUrl(str3) ? Uri.parse(str3) : f9652d, "2.0/json/" + str2);
        HashMap hashMap = new HashMap(3);
        this.f9655g = hashMap;
        hashMap.put("type", "mobile");
        hashMap.put("apiKey", str);
        hashMap.put("origin", "SERVER");
    }

    private JSONObject d() {
        Map<String, Object> h10;
        JSONObject jSONObject = new JSONObject();
        if (this.f9642a.M() != null) {
            h10 = this.f9642a.M().e();
        } else {
            h10 = this.f9642a.K().h();
        }
        Object obj = h10.get("IABTCF_gdprApplies");
        if (obj != null) {
            JsonUtils.putObject(jSONObject, "gdpr_applies", obj);
            JsonUtils.putString(jSONObject, "daisyBit", String.valueOf(h10.get("IABTCF_TCString")));
        }
        return jSONObject;
    }

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

    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;
    }

    public void a(MaxAdapterInitializationParameters maxAdapterInitializationParameters, b bVar) {
        String str = (String) this.f9642a.b(com.applovin.impl.mediation.b.c.f9676a, null, this.f9644c);
        Long l10 = (Long) this.f9642a.b(com.applovin.impl.mediation.b.c.f9677b, null, this.f9644c);
        if (!StringUtils.isValidString(str) || l10 == null) {
            a(bVar);
        } else if (maxAdapterInitializationParameters.getServerParameters().getLong("user_id_expiration_millis", TimeUnit.DAYS.toMillis(30L)) - (System.currentTimeMillis() - l10.longValue()) > TimeUnit.HOURS.toMillis(1L)) {
            this.f9657i = str;
            bVar.onInitialized(true, null);
        } else {
            a(bVar);
        }
    }

    private JSONArray d(MaxAdapterResponseParameters maxAdapterResponseParameters) {
        JSONArray jSONArray = new JSONArray();
        JSONObject jSONObject = new JSONObject();
        JsonUtils.putString(jSONObject, "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 a10 = a(maxAdapterResponseParameters, "taboola_thumbnail_height", (Integer) 0);
            Integer a11 = a(maxAdapterResponseParameters, "taboola_thumbnail_width", (Integer) 0);
            if (a10.intValue() > 0 && a11.intValue() > 0) {
                JSONObject jSONObject2 = new JSONObject();
                JsonUtils.putInt(jSONObject2, "width", a10.intValue());
                JsonUtils.putInt(jSONObject2, "height", a11.intValue());
                JsonUtils.putJSONObject(jSONObject, "thumbnail", jSONObject2);
            }
        }
        jSONArray.put(jSONObject);
        return jSONArray;
    }

    public void a(final MaxAdapterResponseParameters maxAdapterResponseParameters, final AppLovinNativeAdLoadListener appLovinNativeAdLoadListener) {
        JSONObject jSONObject = new JSONObject();
        JsonUtils.putJSONObject(jSONObject, "app", new JSONObject(this.f9655g));
        JsonUtils.putJSONObject(jSONObject, "consent", d());
        JsonUtils.putJSONObject(jSONObject, "user", a(maxAdapterResponseParameters));
        JsonUtils.putJSONObject(jSONObject, "source", b(maxAdapterResponseParameters));
        JsonUtils.putJSONObject(jSONObject, "view", c(maxAdapterResponseParameters));
        JsonUtils.putJsonArray(jSONObject, "placements", d(maxAdapterResponseParameters));
        this.f9642a.G().a((d) new x<JSONObject>(com.applovin.impl.sdk.network.c.a(this.f9642a).a(this.f9654f.toString() + "/recommendations.get").b(ShareTarget.METHOD_POST).a(jSONObject).a((c.a) new JSONObject()).d(false).f(false).a(), this.f9642a) {
            @Override
            public void a(JSONObject jSONObject2, int i10) {
                if (i10 == 200 && jSONObject2 != null) {
                    a.this.f9656h = JsonUtils.getString(JsonUtils.getJSONObject(jSONObject2, "user", new JSONObject()), "session", "");
                    this.f10992f.G().a((d) new c(jSONObject2, maxAdapterResponseParameters, MaxAdFormat.NATIVE, appLovinNativeAdLoadListener, this.f10992f));
                    return;
                }
                if (y.a()) {
                    this.f10994h.e(this.f10993g, "Unable to fetch " + maxAdapterResponseParameters.getThirdPartyAdPlacementId() + " Taboola ad: server returned " + i10);
                }
                appLovinNativeAdLoadListener.onNativeAdLoadFailed(new AppLovinError(i10, "Taboola server returned with code: " + jSONObject2));
            }

            @Override
            public void a(int i10, String str, JSONObject jSONObject2) {
                if (y.a()) {
                    this.f10994h.e(this.f10993g, "Unable to fetch " + maxAdapterResponseParameters.getThirdPartyAdPlacementId() + " Taboola ad: server returned " + i10);
                }
                appLovinNativeAdLoadListener.onNativeAdLoadFailed(new AppLovinError(i10, "Taboola server returned with code: " + jSONObject2));
            }
        });
    }

    private void a(final b bVar) {
        HashMap hashMap = new HashMap(2);
        hashMap.put("app.type", "mobile");
        hashMap.put("app.apikey", this.f9653e);
        this.f9642a.G().a((d) new x<JSONObject>(com.applovin.impl.sdk.network.c.a(this.f9642a).a(this.f9654f.toString() + "/user.sync").b("GET").a((Map<String, String>) hashMap).a((c.a) new JSONObject()).d(false).f(false).a(), this.f9642a) {
            @Override
            public void a(JSONObject jSONObject, int i10) {
                if (i10 == 200 && jSONObject != null) {
                    JSONObject jSONObject2 = JsonUtils.getJSONObject(jSONObject, "user", new JSONObject());
                    a.this.f9657i = JsonUtils.getString(jSONObject2, "id", "");
                    this.f10992f.a(com.applovin.impl.mediation.b.c.f9676a, (com.applovin.impl.mediation.b.c<String>) a.this.f9657i, ((com.applovin.impl.mediation.b.b) a.this).f9644c);
                    this.f10992f.a(com.applovin.impl.mediation.b.c.f9677b, (com.applovin.impl.mediation.b.c<Long>) Long.valueOf(System.currentTimeMillis()), ((com.applovin.impl.mediation.b.b) a.this).f9644c);
                    bVar.onInitialized(true, null);
                    return;
                }
                String a10 = android.support.v4.media.c.a("Unable to fetch user id. Server returned ", i10);
                if (y.a()) {
                    this.f10994h.e(this.f10993g, a10);
                }
                bVar.onInitialized(false, a10);
            }

            @Override
            public void a(int i10, String str, JSONObject jSONObject) {
                if (y.a()) {
                    this.f10994h.e(this.f10993g, "Unable to fetch user id. Server returned " + i10);
                }
                bVar.onInitialized(false, str);
            }
        });
    }

    private JSONObject a(MaxAdapterResponseParameters maxAdapterResponseParameters) {
        Map<String, Object> d10;
        if (this.f9642a.M() != null) {
            d10 = this.f9642a.M().b();
        } else {
            d10 = this.f9642a.K().d();
        }
        String valueOf = String.valueOf(d10.get("ua"));
        String valueOf2 = String.valueOf(d10.get("idfa"));
        String str = this.f9656h;
        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, b5.a.f875d, valueOf2);
        JsonUtils.putString(jSONObject, "id", this.f9657i);
        JsonUtils.putString(jSONObject, "realip", maxAdapterResponseParameters.getServerParameters().getString("s2s_ip", ""));
        return jSONObject;
    }

    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 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()));
    }
}