正在查看: Fancy Optimizer v4.6.3 应用的 a.java JAVA 源代码文件
本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。
正在查看: Fancy Optimizer v4.6.3 应用的 a.java JAVA 源代码文件
本页面展示 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.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.mbridge.msdk.MBridgeConstans;
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 f5158d = Uri.parse("https://api.taboola.com/");
private final String f5159e;
private final Uri f5160f;
private final Map<String, Object> f5161g;
private String f5162h;
private String f5163i;
public a(String str, String str2, @Nullable String str3, n nVar) {
super("TaboolaApiService", nVar);
this.f5162h = "init";
this.f5163i = "";
this.f5159e = str;
this.f5160f = Uri.withAppendedPath(URLUtil.isValidUrl(str3) ? Uri.parse(str3) : f5158d, "2.0/json/" + str2);
HashMap hashMap = new HashMap(3);
this.f5161g = hashMap;
hashMap.put("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 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 a2 = a(maxAdapterResponseParameters, "taboola_thumbnail_height", (Integer) 0);
Integer a3 = a(maxAdapterResponseParameters, "taboola_thumbnail_width", (Integer) 0);
if (a2.intValue() > 0 && a3.intValue() > 0) {
JSONObject jSONObject2 = new JSONObject();
JsonUtils.putInt(jSONObject2, "width", a2.intValue());
JsonUtils.putInt(jSONObject2, "height", a3.intValue());
JsonUtils.putJSONObject(jSONObject, "thumbnail", jSONObject2);
}
}
jSONArray.put(jSONObject);
return jSONArray;
}
private JSONObject c(MaxAdapterResponseParameters maxAdapterResponseParameters) {
JSONObject jSONObject = new JSONObject();
JsonUtils.putString(jSONObject, "id", a(maxAdapterResponseParameters, "taboola_view_id", ""));
return jSONObject;
}
private JSONObject d() {
JSONObject jSONObject = new JSONObject();
Object obj = this.f5150a.O().h().get("IABTCF_gdprApplies");
if (obj != null) {
JsonUtils.putObject(jSONObject, "gdpr_applies", obj);
JsonUtils.putString(jSONObject, "daisyBit", String.valueOf(this.f5150a.O().h().get("IABTCF_TCString")));
}
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;
}
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> a2 = this.f5150a.O().a(false);
String valueOf = String.valueOf(a2.get("ua"));
String valueOf2 = String.valueOf(a2.get("idfa"));
String str = this.f5162h;
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.f5163i);
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", "mobile");
hashMap.put("app.apikey", this.f5159e);
this.f5150a.K().a((com.applovin.impl.sdk.e.a) new u<JSONObject>(com.applovin.impl.sdk.network.c.a(this.f5150a).a(this.f5160f.toString() + "/user.sync").b(ShareTarget.METHOD_GET).a((Map<String, String>) hashMap).a((c.a) new JSONObject()).c(false).d(false).a(), this.f5150a) {
@Override
public void a(int i2, String str, JSONObject jSONObject) {
if (v.a()) {
this.f6070h.e(this.f6069g, "Unable to fetch user id. Server returned " + i2);
}
bVar.onInitialized(false, str);
}
@Override
public void a(JSONObject jSONObject, int i2) {
if (i2 == 200 && jSONObject != null) {
JSONObject jSONObject2 = JsonUtils.getJSONObject(jSONObject, "user", new JSONObject());
a.this.f5163i = JsonUtils.getString(jSONObject2, "id", "");
this.f6068f.a(com.applovin.impl.mediation.b.c.f5179a, (com.applovin.impl.mediation.b.c<String>) a.this.f5163i, ((com.applovin.impl.mediation.b.b) a.this).f5151c);
this.f6068f.a(com.applovin.impl.mediation.b.c.b, (com.applovin.impl.mediation.b.c<Long>) Long.valueOf(System.currentTimeMillis()), ((com.applovin.impl.mediation.b.b) a.this).f5151c);
bVar.onInitialized(true, null);
return;
}
String i3 = android.support.v4.media.b.i("Unable to fetch user id. Server returned ", i2);
if (v.a()) {
this.f6070h.e(this.f6069g, i3);
}
bVar.onInitialized(false, i3);
}
});
}
public void a(MaxAdapterInitializationParameters maxAdapterInitializationParameters, b bVar) {
String str = (String) this.f5150a.b(com.applovin.impl.mediation.b.c.f5179a, null, this.f5151c);
Long l2 = (Long) this.f5150a.b(com.applovin.impl.mediation.b.c.b, null, this.f5151c);
if (!StringUtils.isValidString(str) || l2 == null || maxAdapterInitializationParameters.getServerParameters().getLong("user_id_expiration_millis", TimeUnit.DAYS.toMillis(30L)) - (System.currentTimeMillis() - l2.longValue()) <= TimeUnit.HOURS.toMillis(1L)) {
a(bVar);
} else {
this.f5163i = 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.f5161g));
JsonUtils.putJSONObject(jSONObject, "consent", d());
JsonUtils.putJSONObject(jSONObject, "user", a(maxAdapterResponseParameters));
JsonUtils.putJSONObject(jSONObject, "source", b(maxAdapterResponseParameters));
JsonUtils.putJSONObject(jSONObject, MBridgeConstans.DYNAMIC_VIEW_KEY_VIEW, c(maxAdapterResponseParameters));
JsonUtils.putJsonArray(jSONObject, "placements", d(maxAdapterResponseParameters));
this.f5150a.K().a((com.applovin.impl.sdk.e.a) new u<JSONObject>(com.applovin.impl.sdk.network.c.a(this.f5150a).a(this.f5160f.toString() + "/recommendations.get").b(ShareTarget.METHOD_POST).a(jSONObject).a((c.a) new JSONObject()).c(false).d(false).a(), this.f5150a) {
@Override
public void a(int i2, String str, JSONObject jSONObject2) {
if (v.a()) {
this.f6070h.e(this.f6069g, "Unable to fetch " + maxAdapterResponseParameters.getThirdPartyAdPlacementId() + " Taboola ad: server returned " + i2);
}
appLovinNativeAdLoadListener.onNativeAdLoadFailed(new AppLovinError(i2, "Taboola server returned with code: " + jSONObject2));
}
@Override
public void a(JSONObject jSONObject2, int i2) {
if (i2 == 200 && jSONObject2 != null) {
a.this.f5162h = JsonUtils.getString(JsonUtils.getJSONObject(jSONObject2, "user", new JSONObject()), "session", "");
this.f6068f.K().a((com.applovin.impl.sdk.e.a) new c(jSONObject2, maxAdapterResponseParameters, MaxAdFormat.NATIVE, appLovinNativeAdLoadListener, this.f6068f));
return;
}
if (v.a()) {
this.f6070h.e(this.f6069g, "Unable to fetch " + maxAdapterResponseParameters.getThirdPartyAdPlacementId() + " Taboola ad: server returned " + i2);
}
appLovinNativeAdLoadListener.onNativeAdLoadFailed(new AppLovinError(i2, "Taboola server returned with code: " + jSONObject2));
}
});
}
}