- 28,932 files - Full Java source code - Smali files - Resources Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
130 lines
5.0 KiB
Java
130 lines
5.0 KiB
Java
package com.ea.nimble;
|
|
|
|
import com.ea.nimble.Log;
|
|
import com.facebook.internal.security.CertificateUtil;
|
|
import com.ironsource.v8;
|
|
import com.unity3d.ads.core.domain.InitializeAndroidBoldSDK;
|
|
import java.io.UnsupportedEncodingException;
|
|
import java.net.MalformedURLException;
|
|
import java.net.URL;
|
|
import java.net.URLEncoder;
|
|
import java.util.Map;
|
|
|
|
/* loaded from: classes2.dex */
|
|
public class Network {
|
|
public static final String COMPONENT_ID = "com.ea.nimble.network";
|
|
|
|
/* renamed from: com.ea.nimble.Network$1, reason: invalid class name */
|
|
public static /* synthetic */ class AnonymousClass1 {
|
|
static final /* synthetic */ int[] $SwitchMap$com$ea$nimble$Network$Status;
|
|
|
|
static {
|
|
int[] iArr = new int[Status.values().length];
|
|
$SwitchMap$com$ea$nimble$Network$Status = iArr;
|
|
try {
|
|
iArr[Status.NONE.ordinal()] = 1;
|
|
} catch (NoSuchFieldError unused) {
|
|
}
|
|
try {
|
|
$SwitchMap$com$ea$nimble$Network$Status[Status.DEAD.ordinal()] = 2;
|
|
} catch (NoSuchFieldError unused2) {
|
|
}
|
|
try {
|
|
$SwitchMap$com$ea$nimble$Network$Status[Status.OK.ordinal()] = 3;
|
|
} catch (NoSuchFieldError unused3) {
|
|
}
|
|
}
|
|
}
|
|
|
|
public enum Status {
|
|
UNKNOWN,
|
|
NONE,
|
|
DEAD,
|
|
OK;
|
|
|
|
@Override // java.lang.Enum
|
|
public String toString() {
|
|
int i = AnonymousClass1.$SwitchMap$com$ea$nimble$Network$Status[ordinal()];
|
|
return i != 1 ? i != 2 ? i != 3 ? "NET UNKNOWN" : "NET OK" : "NET DEAD" : "NET NONE";
|
|
}
|
|
}
|
|
|
|
public static INetwork getComponent() {
|
|
return (INetwork) Base.getComponent("com.ea.nimble.network");
|
|
}
|
|
|
|
public static String generateParameterString(Map<String, String> map) {
|
|
Log.Helper.LOGPUBLICFUNCS("NimbleNetwork");
|
|
if (map == null || map.size() == 0) {
|
|
return null;
|
|
}
|
|
String str = "";
|
|
for (Map.Entry<String, String> entry : map.entrySet()) {
|
|
String key = entry.getKey();
|
|
String value = entry.getValue();
|
|
if ("".equals(key)) {
|
|
Log.Helper.LOGWS(InitializeAndroidBoldSDK.MSG_NETWORK, "URL parameters map contains invalid key", new Object[0]);
|
|
} else {
|
|
try {
|
|
String encode = URLEncoder.encode(key, "UTF-8");
|
|
if ("".equals(value)) {
|
|
Log.Helper.LOGWS(InitializeAndroidBoldSDK.MSG_NETWORK, "URL parameters map contains invalid value", new Object[0]);
|
|
} else {
|
|
try {
|
|
String encode2 = URLEncoder.encode(value, "UTF-8");
|
|
str = (((str + encode) + v8.i.b) + encode2) + v8.i.c;
|
|
} catch (UnsupportedEncodingException unused) {
|
|
Log.Helper.LOGWS(InitializeAndroidBoldSDK.MSG_NETWORK, "URL parameters map contains invalid value", new Object[0]);
|
|
}
|
|
}
|
|
} catch (UnsupportedEncodingException unused2) {
|
|
Log.Helper.LOGWS(InitializeAndroidBoldSDK.MSG_NETWORK, "URL parameters map contains invalid key", new Object[0]);
|
|
}
|
|
}
|
|
}
|
|
if (str.length() == 0) {
|
|
return null;
|
|
}
|
|
return str.substring(0, str.length() - 1);
|
|
}
|
|
|
|
public static URL generateURL(String str, Map<String, String> map) {
|
|
Log.Helper.LOGPUBLICFUNCS("NimbleNetwork");
|
|
if ("".equals(str)) {
|
|
Log.Helper.LOGWS(InitializeAndroidBoldSDK.MSG_NETWORK, "Base url is blank, return null", new Object[0]);
|
|
return null;
|
|
}
|
|
String generateParameterString = generateParameterString(map);
|
|
if (generateParameterString == null) {
|
|
Log.Helper.LOGWS(InitializeAndroidBoldSDK.MSG_NETWORK, "Generated URL with only base url = %s", str);
|
|
} else {
|
|
str = str + "?" + generateParameterString;
|
|
Log.Helper.LOGVS(InitializeAndroidBoldSDK.MSG_NETWORK, "Generated URL = %s", str);
|
|
}
|
|
try {
|
|
return new URL(str);
|
|
} catch (MalformedURLException unused) {
|
|
Log.Helper.LOGES(InitializeAndroidBoldSDK.MSG_NETWORK, "Malformed URL from %s", str);
|
|
return null;
|
|
}
|
|
}
|
|
|
|
public static String getHttpProxy() {
|
|
Log.Helper.LOGPUBLICFUNCS("NimbleNetwork");
|
|
try {
|
|
String property = System.getProperty("http.proxyHost");
|
|
if (property == null) {
|
|
return null;
|
|
}
|
|
String property2 = System.getProperty("http.proxyPort");
|
|
if (property2 == null) {
|
|
return property;
|
|
}
|
|
return property + CertificateUtil.DELIMITER + property2;
|
|
} catch (Exception e) {
|
|
Log.Helper.LOGES(InitializeAndroidBoldSDK.MSG_NETWORK, "Unable to get system proxy settings. %s", e.toString());
|
|
return null;
|
|
}
|
|
}
|
|
}
|