Puzzle King v2.3.8版本的 MD5 值为:1734eb975c9d2843afa462aec387292e
以下内容为反编译后的 e.java 源代码,内容仅作参考
package com.applovin.impl.sdk.nativeAd;
import android.net.Uri;
import android.text.TextUtils;
import android.webkit.URLUtil;
import com.applovin.impl.sdk.f.o;
import com.applovin.impl.sdk.f.r;
import com.applovin.impl.sdk.n;
import com.applovin.impl.sdk.nativeAd.AppLovinNativeAdImpl;
import com.applovin.impl.sdk.nativeAd.a;
import com.applovin.impl.sdk.network.i;
import com.applovin.impl.sdk.utils.JsonUtils;
import com.applovin.impl.sdk.utils.StringUtils;
import com.applovin.impl.sdk.w;
import com.applovin.sdk.AppLovinAd;
import com.applovin.sdk.AppLovinAdLoadListener;
import com.applovin.sdk.AppLovinSdkUtils;
import com.google.firebase.analytics.FirebaseAnalytics;
import java.util.ArrayList;
import java.util.List;
import org.json.JSONArray;
import org.json.JSONObject;
public class e extends com.applovin.impl.sdk.f.a implements a.InterfaceC0074a, AppLovinAdLoadListener {
private final JSONObject a;
private final JSONObject c;
private final AppLovinNativeAdLoadListener d;
private String e;
private String f;
private String g;
private String h;
private Uri i;
private Uri j;
private Uri k;
private Uri l;
private com.applovin.impl.a.a m;
private Uri n;
private Uri o;
private final List<String> p;
private String q;
private final List<i> r;
private final List<i> s;
private final List<i> t;
private final List<i> u;
public e(JSONObject jSONObject, JSONObject jSONObject2, AppLovinNativeAdLoadListener appLovinNativeAdLoadListener, n nVar) {
super("TaskRenderNativeAd", nVar);
this.e = "";
this.f = "";
this.g = "";
this.h = "";
this.i = null;
this.j = null;
this.k = null;
this.l = null;
this.n = null;
this.o = null;
this.p = new ArrayList();
this.r = new ArrayList();
this.s = new ArrayList();
this.t = new ArrayList();
this.u = new ArrayList();
this.a = jSONObject;
this.c = jSONObject2;
this.d = appLovinNativeAdLoadListener;
}
private void a() {
AppLovinNativeAdImpl build = new AppLovinNativeAdImpl.Builder(JsonUtils.shallowCopy(this.a), JsonUtils.shallowCopy(this.c), this.b).setTitle(this.e).setAdvertiser(this.f).setBody(this.g).setCallToAction(this.h).setIconUri(this.i).setMainImageUri(this.j).setPrivacyIconUri(this.k).setVastAd(this.m).setPrivacyDestinationUri(this.l).setClickDestinationUri(this.n).setClickDestinationBackupUri(this.o).setClickTrackingUrls(this.p).setJsTracker(this.q).setImpressionRequests(this.r).setViewableMRC50Requests(this.s).setViewableMRC100Requests(this.t).setViewableVideo50Requests(this.u).build();
build.getAdEventTracker().b();
if (w.a()) {
a("Starting cache task for type: " + build.getType() + "...");
}
this.b.U().a(new a(build, this.b, this), o.a.MAIN);
}
private void a(JSONObject jSONObject) {
if (jSONObject == null) {
return;
}
String string = JsonUtils.getString(jSONObject, "url", null);
if (StringUtils.isValidString(string)) {
this.n = Uri.parse(string);
if (w.a()) {
a("Processed click destination URL: " + this.n);
}
}
String string2 = JsonUtils.getString(jSONObject, "fallback", null);
if (StringUtils.isValidString(string2)) {
this.o = Uri.parse(string2);
if (w.a()) {
a("Processed click destination backup URL: " + this.o);
}
}
JSONArray jSONArray = JsonUtils.getJSONArray(jSONObject, "clicktrackers", null);
if (jSONArray != null) {
try {
this.p.addAll(JsonUtils.toList(jSONArray));
if (w.a()) {
a("Processed click tracking URLs: " + this.p);
}
} catch (Throwable th) {
if (w.a()) {
a("Failed to render click tracking URLs", th);
}
}
}
}
public void b() {
this.d.onNativeAdLoadFailed(-6);
}
private void b(final AppLovinNativeAdImpl appLovinNativeAdImpl) {
AppLovinSdkUtils.runOnUiThread(new Runnable() {
@Override
public void run() {
if (w.a()) {
e.this.a("Preparing native ad view components...");
}
try {
appLovinNativeAdImpl.setUpNativeAdViewComponents();
if (w.a()) {
e.this.a("Successfully prepared native ad view components");
}
appLovinNativeAdImpl.getAdEventTracker().c();
e.this.d.onNativeAdLoaded(appLovinNativeAdImpl);
} catch (Throwable th) {
if (w.a()) {
e.this.a("Failed to prepare native ad view components", th);
}
e.this.b();
}
}
});
}
@Override
public void a(AppLovinNativeAdImpl appLovinNativeAdImpl) {
if (w.a()) {
a("Successfully cached and loaded ad");
}
b(appLovinNativeAdImpl);
}
@Override
public void adReceived(AppLovinAd appLovinAd) {
if (w.a()) {
a("VAST ad rendered successfully");
}
this.m = (com.applovin.impl.a.a) appLovinAd;
a();
}
@Override
public void failedToReceiveAd(int i) {
if (w.a()) {
d("VAST ad failed to render");
}
a();
}
@Override
public void run() {
StringBuilder sb;
String str;
StringBuilder sb2;
String str2;
StringBuilder sb3;
String str3;
StringBuilder sb4;
String str4;
String sb5;
String str5;
Uri uri;
?? r2 = 0;
String string = JsonUtils.getString(this.a, "privacy_icon_url", null);
if (URLUtil.isValidUrl(string)) {
this.k = Uri.parse(string);
}
String string2 = JsonUtils.getString(this.a, "privacy_url", null);
if (!URLUtil.isValidUrl(string2)) {
string2 = "https://www.applovin.com/privacy/";
}
this.l = Uri.parse(string2);
JSONObject jSONObject = JsonUtils.getJSONObject(this.a, "ortb_response", (JSONObject) null);
if (jSONObject == null || jSONObject.length() == 0) {
if (w.a()) {
d("No oRtb response provided: " + this.a);
}
b();
return;
}
String string3 = JsonUtils.getString(jSONObject, "version", null);
JSONObject jSONObject2 = JsonUtils.getJSONObject(jSONObject, "value", (JSONObject) null);
if (w.a()) {
a("Rendering native ad for oRTB version: " + string3);
}
JSONObject jSONObject3 = JsonUtils.getJSONObject(jSONObject2, "native", jSONObject2);
a(JsonUtils.getJSONObject(jSONObject3, "link", (JSONObject) null));
JSONArray jSONArray = JsonUtils.getJSONArray(jSONObject3, "assets", null);
if (jSONArray == null || jSONArray.length() == 0) {
if (w.a()) {
d("Unable to retrieve assets - failing ad load: " + this.a);
}
b();
return;
}
String str6 = "";
int i = 0;
while (i < jSONArray.length()) {
JSONObject jSONObject4 = JsonUtils.getJSONObject(jSONArray, i, (JSONObject) r2);
if (jSONObject4.has("title")) {
this.e = JsonUtils.getString(JsonUtils.getJSONObject(jSONObject4, "title", (JSONObject) r2), "text", r2);
if (w.a()) {
a("Processed title: " + this.e);
}
} else if (jSONObject4.has("link")) {
a(JsonUtils.getJSONObject(jSONObject4, "link", (JSONObject) r2));
} else if (jSONObject4.has("img")) {
int i2 = JsonUtils.getInt(jSONObject4, "id", -1);
JSONObject jSONObject5 = JsonUtils.getJSONObject(jSONObject4, "img", (JSONObject) r2);
int i3 = JsonUtils.getInt(jSONObject5, "type", -1);
String string4 = JsonUtils.getString(jSONObject5, "url", r2);
if (i3 == 1 || 3 == i2) {
this.i = Uri.parse(string4);
if (w.a()) {
sb3 = new StringBuilder();
sb3.append("Processed icon URL: ");
uri = this.i;
sb3.append(uri);
}
} else if (i3 == 3 || 2 == i2) {
this.j = Uri.parse(string4);
if (w.a()) {
sb3 = new StringBuilder();
sb3.append("Processed main image URL: ");
uri = this.j;
sb3.append(uri);
}
} else {
if (w.a()) {
c("Unrecognized image: " + jSONObject4);
}
int i4 = JsonUtils.getInt(jSONObject5, "w", -1);
int i5 = JsonUtils.getInt(jSONObject5, "h", -1);
if (i4 > 0 && i5 > 0) {
double d = i4 / i5;
boolean a = w.a();
if (d > 1.0d) {
if (a) {
a("Inferring main image from " + i4 + "x" + i5 + "...");
}
this.j = Uri.parse(string4);
} else {
if (a) {
a("Inferring icon image from " + i4 + "x" + i5 + "...");
}
this.i = Uri.parse(string4);
}
} else if (w.a()) {
sb5 = "Skipping...";
c(sb5);
}
}
str5 = sb3.toString();
a(str5);
} else {
if (jSONObject4.has("video")) {
str6 = JsonUtils.getString(JsonUtils.getJSONObject(jSONObject4, "video", (JSONObject) null), "vasttag", null);
if (StringUtils.isValidString(str6)) {
if (w.a()) {
str5 = "Processed VAST video";
a(str5);
}
} else if (w.a()) {
sb4 = new StringBuilder();
str4 = "Ignoring invalid \"vasttag\" for video: ";
sb4.append(str4);
sb4.append(jSONObject4);
sb5 = sb4.toString();
}
} else if (jSONObject4.has("data")) {
int i6 = JsonUtils.getInt(jSONObject4, "id", -1);
JSONObject jSONObject6 = JsonUtils.getJSONObject(jSONObject4, "data", (JSONObject) null);
int i7 = JsonUtils.getInt(jSONObject6, "type", -1);
String string5 = JsonUtils.getString(jSONObject6, "value", null);
if (i7 == 1 || i6 == 8) {
this.f = string5;
if (w.a()) {
sb3 = new StringBuilder();
sb3.append("Processed advertiser: ");
str3 = this.f;
sb3.append(str3);
}
} else if (i7 == 2 || i6 == 4) {
this.g = string5;
if (w.a()) {
sb3 = new StringBuilder();
sb3.append("Processed body: ");
str3 = this.g;
sb3.append(str3);
}
} else if (i7 == 12 || i6 == 5) {
this.h = string5;
if (w.a()) {
sb3 = new StringBuilder();
sb3.append("Processed cta: ");
str3 = this.h;
sb3.append(str3);
}
} else if (w.a()) {
sb4 = new StringBuilder();
str4 = "Skipping unsupported data: ";
sb4.append(str4);
sb4.append(jSONObject4);
sb5 = sb4.toString();
}
str5 = sb3.toString();
a(str5);
} else if (w.a()) {
d("Unsupported asset object: " + jSONObject4);
}
c(sb5);
}
i++;
r2 = 0;
}
String string6 = JsonUtils.getString(jSONObject3, "jstracker", null);
if (StringUtils.isValidString(string6)) {
this.q = string6;
a("Processed jstracker: " + string6);
}
Object obj = null;
JSONArray jSONArray2 = JsonUtils.getJSONArray(jSONObject3, "imptrackers", null);
if (jSONArray2 != null) {
int i8 = 0;
while (i8 < jSONArray2.length()) {
Object objectAtIndex = JsonUtils.getObjectAtIndex(jSONArray2, i8, obj);
if (objectAtIndex instanceof String) {
String str7 = (String) objectAtIndex;
if (!TextUtils.isEmpty(str7)) {
this.r.add(new i.a(this.b).a(str7).d(false).c(false).a());
if (w.a()) {
a("Processed imptracker URL: " + str7);
}
}
}
i8++;
obj = null;
}
}
JSONArray jSONArray3 = JsonUtils.getJSONArray(jSONObject3, "eventtrackers", null);
if (jSONArray3 != null) {
for (int i9 = 0; i9 < jSONArray3.length(); i9++) {
JSONObject jSONObject7 = JsonUtils.getJSONObject(jSONArray3, i9, (JSONObject) null);
int i10 = JsonUtils.getInt(jSONObject7, "event", -1);
int i11 = JsonUtils.getInt(jSONObject7, FirebaseAnalytics.Param.METHOD, -1);
String string7 = JsonUtils.getString(jSONObject7, "url", null);
if (!TextUtils.isEmpty(string7)) {
if (i11 == 1 || i11 == 2) {
i a2 = new i.a(this.b).a(string7).d(false).c(false).g(i11 == 2).a();
if (i10 == 1) {
this.r.add(a2);
if (w.a()) {
a("Processed impression URL: " + string7);
}
} else if (i10 == 2) {
this.s.add(a2);
if (w.a()) {
sb2 = new StringBuilder();
str2 = "Processed viewable MRC50 URL: ";
sb2.append(str2);
sb2.append(string7);
a(sb2.toString());
}
} else if (i10 == 3) {
this.t.add(a2);
if (w.a()) {
sb2 = new StringBuilder();
str2 = "Processed viewable MRC100 URL: ";
sb2.append(str2);
sb2.append(string7);
a(sb2.toString());
}
} else {
if (i10 == 4) {
this.u.add(a2);
if (w.a()) {
sb = new StringBuilder();
str = "Processed viewable video 50 URL: ";
sb.append(str);
sb.append(string7);
a(sb.toString());
}
} else if (i10 == 555) {
if (w.a()) {
sb = new StringBuilder();
str = "Ignoring processing of OMID URL: ";
sb.append(str);
sb.append(string7);
a(sb.toString());
}
} else if (w.a()) {
d("Unsupported event tracker: " + jSONObject7);
}
}
} else if (w.a()) {
d("Unsupported method for event tracker: " + jSONObject7);
}
}
}
}
if (!StringUtils.isValidString(str6)) {
a();
return;
}
if (w.a()) {
a("Processing VAST video...");
}
this.b.U().a((com.applovin.impl.sdk.f.a) r.a(str6, JsonUtils.shallowCopy(this.a), JsonUtils.shallowCopy(this.c), com.applovin.impl.sdk.ad.b.UNKNOWN, this, this.b));
}
}