Perfume Of Love v2.14.9版本的 MD5 值为:16011aefc5a55805771706ce3b259b4e

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


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

import android.net.Uri;
import android.webkit.URLUtil;
import androidx.browser.trusted.sharing.ShareTarget;
import com.applovin.impl.sdk.AppLovinError;
import com.applovin.impl.sdk.e.u;
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.v;
import com.applovin.mediation.MaxAdFormat;
import com.applovin.mediation.adapter.parameters.MaxAdapterInitializationParameters;
import com.applovin.mediation.adapter.parameters.MaxAdapterResponseParameters;
import com.onesignal.outcomes.data.OutcomeEventsTable;
import com.smaato.sdk.core.gdpr.CmpApiConstants;
import com.tapjoy.TapjoyConstants;
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 d = Uri.parse("https://api.taboola.com/");
    private final String e;
    private final Uri f;
    private final Map<String, Object> g;
    private String h;
    private String i;

    public a(String str, String str2, String str3, n nVar) {
        super("TaboolaApiService", nVar);
        this.h = "init";
        this.i = "";
        this.e = str;
        Uri parse = URLUtil.isValidUrl(str3) ? Uri.parse(str3) : d;
        this.f = Uri.withAppendedPath(parse, "2.0/json/" + str2);
        HashMap hashMap = new HashMap(3);
        this.g = hashMap;
        hashMap.put("type", TapjoyConstants.TJC_CONNECTION_TYPE_MOBILE);
        hashMap.put("apiKey", str);
        hashMap.put("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> a = this.a.O().a(false);
        String valueOf = String.valueOf(a.get("ua"));
        String valueOf2 = String.valueOf(a.get("idfa"));
        String str = this.h;
        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, OutcomeEventsTable.COLUMN_NAME_SESSION, str);
        if (valueOf == null) {
            valueOf = "";
        }
        JsonUtils.putString(jSONObject, "agent", valueOf);
        if (valueOf2 == null) {
            valueOf2 = "";
        }
        JsonUtils.putString(jSONObject, "device", valueOf2);
        JsonUtils.putString(jSONObject, "id", this.i);
        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", TapjoyConstants.TJC_CONNECTION_TYPE_MOBILE);
        hashMap.put("app.apikey", this.e);
        c.a a = com.applovin.impl.sdk.network.c.a(this.a);
        this.a.K().a((com.applovin.impl.sdk.e.a) new u<JSONObject>(a.a(this.f.toString() + "/user.sync").b(ShareTarget.METHOD_GET).a((Map<String, String>) hashMap).a((c.a) new JSONObject()).c(false).d(false).a(), this.a) {
            @Override
            public void a(int i, String str, JSONObject jSONObject) {
                v vVar = this.h;
                if (v.a()) {
                    v vVar2 = this.h;
                    String str2 = this.g;
                    vVar2.e(str2, "Unable to fetch user id. Server returned " + i);
                }
                bVar.onInitialized(false, str);
            }

            @Override
            public void a(JSONObject jSONObject, int i) {
                if (i == 200 && jSONObject != null) {
                    a.this.i = JsonUtils.getString(JsonUtils.getJSONObject(jSONObject, "user", new JSONObject()), "id", "");
                    this.f.a(com.applovin.impl.mediation.b.c.a, (com.applovin.impl.mediation.b.c<String>) a.this.i, a.this.c);
                    this.f.a(com.applovin.impl.mediation.b.c.b, (com.applovin.impl.mediation.b.c<Long>) Long.valueOf(System.currentTimeMillis()), a.this.c);
                    bVar.onInitialized(true, null);
                    return;
                }
                String str = "Unable to fetch user id. Server returned " + i;
                v vVar = this.h;
                if (v.a()) {
                    this.h.e(this.g, str);
                }
                bVar.onInitialized(false, str);
            }
        });
    }

    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, "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 d() {
        JSONObject jSONObject = new JSONObject();
        Object obj = this.a.O().h().get(CmpApiConstants.IABTCF_GDPR_APPLIES);
        if (obj != null) {
            JsonUtils.putObject(jSONObject, "gdpr_applies", obj);
            JsonUtils.putString(jSONObject, "daisyBit", String.valueOf(this.a.O().h().get(CmpApiConstants.IABTCF_TC_STRING)));
        }
        return jSONObject;
    }

    public void a(MaxAdapterInitializationParameters maxAdapterInitializationParameters, b bVar) {
        String str = (String) this.a.b(com.applovin.impl.mediation.b.c.a, null, this.c);
        Long l = (Long) this.a.b(com.applovin.impl.mediation.b.c.b, null, this.c);
        if (!StringUtils.isValidString(str) || l == null || maxAdapterInitializationParameters.getServerParameters().getLong("user_id_expiration_millis", TimeUnit.DAYS.toMillis(30L)) - (System.currentTimeMillis() - l.longValue()) <= TimeUnit.HOURS.toMillis(1L)) {
            a(bVar);
            return;
        }
        this.i = 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.g));
        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));
        c.a a = com.applovin.impl.sdk.network.c.a(this.a);
        this.a.K().a((com.applovin.impl.sdk.e.a) new u<JSONObject>(a.a(this.f.toString() + "/recommendations.get").b(ShareTarget.METHOD_POST).a(jSONObject).a((c.a) new JSONObject()).c(false).d(false).a(), this.a) {
            @Override
            public void a(int i, String str, JSONObject jSONObject2) {
                v vVar = this.h;
                if (v.a()) {
                    v vVar2 = this.h;
                    String str2 = this.g;
                    vVar2.e(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));
            }

            @Override
            public void a(JSONObject jSONObject2, int i) {
                if (i == 200 && jSONObject2 != null) {
                    JSONObject jSONObject3 = JsonUtils.getJSONObject(jSONObject2, "user", new JSONObject());
                    a.this.h = JsonUtils.getString(jSONObject3, OutcomeEventsTable.COLUMN_NAME_SESSION, "");
                    this.f.K().a((com.applovin.impl.sdk.e.a) new c(jSONObject2, maxAdapterResponseParameters, MaxAdFormat.NATIVE, appLovinNativeAdLoadListener, this.f));
                    return;
                }
                v vVar = this.h;
                if (v.a()) {
                    v vVar2 = this.h;
                    String str = this.g;
                    vVar2.e(str, "Unable to fetch " + maxAdapterResponseParameters.getThirdPartyAdPlacementId() + " Taboola ad: server returned " + i);
                }
                AppLovinNativeAdLoadListener appLovinNativeAdLoadListener2 = appLovinNativeAdLoadListener;
                appLovinNativeAdLoadListener2.onNativeAdLoadFailed(new AppLovinError(i, "Taboola server returned with code: " + jSONObject2));
            }
        });
    }
}