Dynamic Spot Pro v1.0版本的 MD5 值为:5adb64d1f11ed2f16f84b684ff810780
以下内容为反编译后的 j4.java 源代码,内容仅作参考
package a.a;
import a.a.s3;
import android.net.TrafficStats;
import android.os.Build;
import com.appsflyer.oaid.BuildConfig;
import java.io.InputStream;
import java.net.ConnectException;
import java.net.HttpURLConnection;
import java.net.URL;
import java.net.UnknownHostException;
import java.util.Scanner;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import javax.net.ssl.HttpsURLConnection;
import org.json.JSONObject;
public class j4 implements Runnable {
public final Thread[] f299e;
public final String f300f;
public final String f301g;
public final JSONObject f302h;
public final m4 f303i;
public final int f304j;
public final String k;
public j4(Thread[] threadArr, String str, String str2, JSONObject jSONObject, m4 m4Var, int i2, String str3) {
this.f299e = threadArr;
this.f300f = str;
this.f301g = str2;
this.f302h = jSONObject;
this.f303i = m4Var;
this.f304j = i2;
this.k = str3;
}
@Override
public void run() {
Thread[] threadArr;
HttpURLConnection httpURLConnection;
int i2;
String str;
Thread thread;
HttpURLConnection httpURLConnection2;
int i3;
int i4;
Thread thread2;
String headerField;
Throwable th;
String str2;
String group;
Thread[] threadArr2 = this.f299e;
String str3 = this.f300f;
String str4 = this.f301g;
JSONObject jSONObject = this.f302h;
m4 m4Var = this.f303i;
int i5 = this.f304j;
String str5 = this.k;
s3.u uVar = s3.u.WARN;
s3.u uVar2 = s3.u.DEBUG;
if (Build.VERSION.SDK_INT >= 26) {
TrafficStats.setThreadStatsTag(10000);
}
try {
s3.a(uVar2, "OneSignalRestClient: Making request to: https://api.onesignal.com/" + str3, null);
httpURLConnection2 = (HttpURLConnection) new URL("https://api.onesignal.com/" + str3).openConnection();
try {
if (Build.VERSION.SDK_INT < 22 && (httpURLConnection2 instanceof HttpsURLConnection)) {
HttpsURLConnection httpsURLConnection = (HttpsURLConnection) httpURLConnection2;
httpsURLConnection.setSSLSocketFactory(new a5(httpsURLConnection.getSSLSocketFactory()));
}
httpURLConnection2.setUseCaches(false);
httpURLConnection2.setConnectTimeout(i5);
httpURLConnection2.setReadTimeout(i5);
httpURLConnection2.setRequestProperty("SDK-Version", "onesignal/android/040802");
httpURLConnection2.setRequestProperty("Accept", "application/vnd.onesignal.v1+json");
if (jSONObject != null) {
httpURLConnection2.setDoInput(true);
}
if (str4 != null) {
httpURLConnection2.setRequestProperty("Content-Type", "application/json; charset=UTF-8");
httpURLConnection2.setRequestMethod(str4);
httpURLConnection2.setDoOutput(true);
}
if (jSONObject != null) {
String jSONObject2 = jSONObject.toString();
if (jSONObject.has("external_user_id")) {
Matcher matcher = Pattern.compile("(?<=\"external_user_id\":\").*?(?=\")").matcher(jSONObject2);
if (matcher.find() && (group = matcher.group(0)) != null) {
jSONObject2 = matcher.replaceAll(Matcher.quoteReplacement(group.replace("\\/", "/")));
}
}
s3.a(uVar2, "OneSignalRestClient: " + str4 + " SEND JSON: " + jSONObject2, null);
byte[] bytes = jSONObject2.getBytes("UTF-8");
httpURLConnection2.setFixedLengthStreamingMode(bytes.length);
httpURLConnection2.getOutputStream().write(bytes);
}
if (str5 != null) {
String f2 = d4.f(d4.f116a, "PREFS_OS_ETAG_PREFIX_" + str5, null);
if (f2 != null) {
httpURLConnection2.setRequestProperty("if-none-match", f2);
s3.a(uVar2, "OneSignalRestClient: Adding header if-none-match: " + f2, null);
}
}
int responseCode = httpURLConnection2.getResponseCode();
try {
s3.a(s3.u.VERBOSE, "OneSignalRestClient: After con.getResponseCode to: https://api.onesignal.com/" + str3, null);
String str6 = BuildConfig.FLAVOR;
threadArr = threadArr2;
if (responseCode == 200 || responseCode == 202) {
try {
StringBuilder sb = new StringBuilder();
i4 = responseCode;
try {
sb.append("OneSignalRestClient: Successfully finished request to: https://api.onesignal.com/");
sb.append(str3);
s3.a(uVar2, sb.toString(), null);
Scanner scanner = new Scanner(httpURLConnection2.getInputStream(), "UTF-8");
if (scanner.useDelimiter("\\A").hasNext()) {
str6 = scanner.next();
}
String str7 = str6;
scanner.close();
StringBuilder sb2 = new StringBuilder();
sb2.append("OneSignalRestClient: ");
sb2.append(str4 == null ? "GET" : str4);
sb2.append(" RECEIVED JSON: ");
sb2.append(str7);
s3.a(uVar2, sb2.toString(), null);
if (str5 != null && (headerField = httpURLConnection2.getHeaderField("etag")) != null) {
s3.a(uVar2, "OneSignalRestClient: Response has etag of " + headerField + " so caching the response.", null);
d4.h(d4.f116a, "PREFS_OS_ETAG_PREFIX_" + str5, headerField);
d4.h(d4.f116a, "PREFS_OS_HTTP_CACHE_PREFIX_" + str5, str7);
}
if (m4Var != null) {
thread2 = new Thread(new k4(m4Var, str7), "OS_REST_SUCCESS_CALLBACK");
thread2.start();
thread = thread2;
}
thread = null;
} catch (Throwable th2) {
th = th2;
httpURLConnection = httpURLConnection2;
i2 = i4;
try {
if (!(th instanceof ConnectException) && !(th instanceof UnknownHostException)) {
s3.a(uVar, "OneSignalRestClient: " + str4 + " Error thrown from network stack. ", th);
str = 0;
if (m4Var == null) {
thread = str;
} else {
Thread thread3 = new Thread(new l4(m4Var, i2, str, th), "OS_REST_FAILURE_CALLBACK");
thread3.start();
thread = thread3;
}
if (httpURLConnection != null) {
httpURLConnection2 = httpURLConnection;
httpURLConnection2.disconnect();
}
threadArr[0] = thread;
}
str = 0;
s3.a(s3.u.INFO, "OneSignalRestClient: Could not send last request, device is offline. Throwable: " + th.getClass().getName(), null);
if (m4Var == null) {
}
if (httpURLConnection != null) {
}
threadArr[0] = thread;
} catch (Throwable th3) {
if (httpURLConnection != null) {
httpURLConnection.disconnect();
}
throw th3;
}
}
} catch (Throwable th4) {
th = th4;
i4 = responseCode;
httpURLConnection = httpURLConnection2;
i2 = i4;
if (!(th instanceof ConnectException)) {
s3.a(uVar, "OneSignalRestClient: " + str4 + " Error thrown from network stack. ", th);
str = 0;
if (m4Var == null) {
}
if (httpURLConnection != null) {
}
threadArr[0] = thread;
}
str = 0;
s3.a(s3.u.INFO, "OneSignalRestClient: Could not send last request, device is offline. Throwable: " + th.getClass().getName(), null);
if (m4Var == null) {
}
if (httpURLConnection != null) {
}
threadArr[0] = thread;
}
} else {
try {
if (responseCode != 304) {
s3.a(uVar2, "OneSignalRestClient: Failed request to: https://api.onesignal.com/" + str3, null);
InputStream errorStream = httpURLConnection2.getErrorStream();
if (errorStream == null) {
errorStream = httpURLConnection2.getInputStream();
}
if (errorStream != null) {
Scanner scanner2 = new Scanner(errorStream, "UTF-8");
str2 = scanner2.useDelimiter("\\A").hasNext() ? scanner2.next() : BuildConfig.FLAVOR;
scanner2.close();
s3.a(uVar, "OneSignalRestClient: " + str4 + " RECEIVED JSON: " + str2, null);
th = null;
} else {
th = null;
s3.a(uVar, "OneSignalRestClient: " + str4 + " HTTP Code: " + responseCode + " No response body!", null);
str2 = null;
}
if (m4Var != null) {
Thread thread4 = new Thread(new l4(m4Var, responseCode, str2, th), "OS_REST_FAILURE_CALLBACK");
thread4.start();
thread = thread4;
}
} else {
String f3 = d4.f(d4.f116a, "PREFS_OS_HTTP_CACHE_PREFIX_" + str5, null);
StringBuilder sb3 = new StringBuilder();
sb3.append("OneSignalRestClient: ");
sb3.append(str4 == null ? "GET" : str4);
sb3.append(" - Using Cached response due to 304: ");
sb3.append(f3);
s3.a(uVar2, sb3.toString(), null);
if (m4Var != null) {
thread2 = new Thread(new k4(m4Var, f3), "OS_REST_SUCCESS_CALLBACK");
thread2.start();
thread = thread2;
}
}
thread = null;
} catch (Throwable th5) {
th = th5;
i3 = responseCode;
httpURLConnection = httpURLConnection2;
i2 = i3;
if (!(th instanceof ConnectException)) {
}
str = 0;
s3.a(s3.u.INFO, "OneSignalRestClient: Could not send last request, device is offline. Throwable: " + th.getClass().getName(), null);
if (m4Var == null) {
}
if (httpURLConnection != null) {
}
threadArr[0] = thread;
}
}
} catch (Throwable th6) {
th = th6;
threadArr = threadArr2;
}
} catch (Throwable th7) {
th = th7;
threadArr = threadArr2;
i3 = -1;
}
} catch (Throwable th8) {
th = th8;
threadArr = threadArr2;
httpURLConnection = null;
i2 = -1;
}
httpURLConnection2.disconnect();
threadArr[0] = thread;
}
}