- 28,932 files - Full Java source code - Smali files - Resources Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
129 lines
4.5 KiB
Java
129 lines
4.5 KiB
Java
package com.applovin.impl;
|
|
|
|
import android.net.Uri;
|
|
import com.applovin.impl.mediation.MaxErrorImpl;
|
|
import com.applovin.impl.sdk.utils.CollectionUtils;
|
|
import com.applovin.impl.sdk.utils.JsonUtils;
|
|
import com.applovin.impl.sdk.utils.StringUtils;
|
|
import com.applovin.mediation.MaxError;
|
|
import com.applovin.mediation.adapter.MaxAdapterError;
|
|
import java.util.Collections;
|
|
import java.util.HashMap;
|
|
import java.util.Iterator;
|
|
import java.util.List;
|
|
import java.util.Map;
|
|
import org.json.JSONException;
|
|
import org.json.JSONObject;
|
|
|
|
/* loaded from: classes.dex */
|
|
public class rm extends yl {
|
|
private final String h;
|
|
private final List i;
|
|
private final pe j;
|
|
private final Map k;
|
|
private final Map l;
|
|
private final Map m;
|
|
private final MaxError n;
|
|
|
|
public rm(String str, List list, Map map, Map map2, MaxError maxError, pe peVar, com.applovin.impl.sdk.j jVar, boolean z) {
|
|
super("TaskFireMediationPostbacks", jVar);
|
|
this.h = str + "_urls";
|
|
this.i = list;
|
|
this.k = yp.a(map, jVar);
|
|
this.l = map2 == null ? new HashMap() : map2;
|
|
this.n = maxError != null ? maxError : new MaxErrorImpl(-1);
|
|
this.j = peVar;
|
|
HashMap hashMap = new HashMap(7);
|
|
hashMap.put("AppLovin-Event-Type", str);
|
|
if (z && peVar != null) {
|
|
hashMap.put("AppLovin-Ad-Network-Name", peVar.c());
|
|
}
|
|
if (peVar instanceof ge) {
|
|
ge geVar = (ge) peVar;
|
|
hashMap.put("AppLovin-Ad-Unit-Id", geVar.getAdUnitId());
|
|
hashMap.put("AppLovin-Ad-Format", geVar.getFormat().getLabel());
|
|
if (z) {
|
|
hashMap.put("AppLovin-Third-Party-Ad-Placement-Id", geVar.U());
|
|
}
|
|
}
|
|
if (maxError != null) {
|
|
hashMap.put("AppLovin-Error-Code", String.valueOf(maxError.getCode()));
|
|
hashMap.put("AppLovin-Error-Message", maxError.getMessage());
|
|
}
|
|
this.m = hashMap;
|
|
}
|
|
|
|
@Override // java.lang.Runnable
|
|
public void run() {
|
|
List f = f();
|
|
if (CollectionUtils.isEmpty(f)) {
|
|
return;
|
|
}
|
|
Map e = e();
|
|
Iterator it = f.iterator();
|
|
while (it.hasNext()) {
|
|
Uri parse = Uri.parse(a(b((String) it.next(), this.k), this.n));
|
|
Uri.Builder clearQuery = parse.buildUpon().clearQuery();
|
|
HashMap hashMap = new HashMap(this.l);
|
|
for (String str : parse.getQueryParameterNames()) {
|
|
String queryParameter = parse.getQueryParameter(str);
|
|
if (e.containsKey(queryParameter)) {
|
|
pe peVar = this.j;
|
|
if (peVar != null) {
|
|
hashMap.put(str, peVar.a((String) e.get(queryParameter)));
|
|
}
|
|
} else {
|
|
clearQuery.appendQueryParameter(str, queryParameter);
|
|
}
|
|
}
|
|
hashMap.putAll(this.a.y().e());
|
|
a(clearQuery.build().toString(), hashMap);
|
|
}
|
|
}
|
|
|
|
private void a(String str, Map map) {
|
|
b().X().e(com.applovin.impl.sdk.network.d.b().d(str).c("POST").a(this.m).a(false).c(map).c(((Boolean) this.a.a(ve.d8)).booleanValue()).a());
|
|
}
|
|
|
|
private List f() {
|
|
List list = this.i;
|
|
if (list != null) {
|
|
return list;
|
|
}
|
|
pe peVar = this.j;
|
|
if (peVar != null) {
|
|
return peVar.b(this.h);
|
|
}
|
|
return null;
|
|
}
|
|
|
|
private Map e() {
|
|
try {
|
|
return JsonUtils.toStringMap(new JSONObject((String) this.a.a(ve.X6)));
|
|
} catch (JSONException unused) {
|
|
return Collections.EMPTY_MAP;
|
|
}
|
|
}
|
|
|
|
private String b(String str, Map map) {
|
|
for (String str2 : map.keySet()) {
|
|
str = str.replace(str2, StringUtils.emptyIfNull((String) map.get(str2)));
|
|
}
|
|
return str;
|
|
}
|
|
|
|
private String a(String str, MaxError maxError) {
|
|
int i;
|
|
String str2;
|
|
if (maxError instanceof MaxAdapterError) {
|
|
MaxAdapterError maxAdapterError = (MaxAdapterError) maxError;
|
|
i = maxAdapterError.getMediatedNetworkErrorCode();
|
|
str2 = maxAdapterError.getMediatedNetworkErrorMessage();
|
|
} else {
|
|
i = 0;
|
|
str2 = "";
|
|
}
|
|
return str.replace("{ERROR_CODE}", String.valueOf(maxError.getCode())).replace("{ERROR_MESSAGE}", StringUtils.encodeUriString(maxError.getMessage())).replace("{THIRD_PARTY_SDK_ERROR_CODE}", String.valueOf(i)).replace("{THIRD_PARTY_SDK_ERROR_MESSAGE}", StringUtils.encodeUriString(str2));
|
|
}
|
|
}
|