正在查看: Oolka v2.4.42 应用的 m0.java JAVA 源代码文件
本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。
正在查看: Oolka v2.4.42 应用的 m0.java JAVA 源代码文件
本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。
package one.upswing.sdk;
import android.os.AsyncTask;
import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.io.OutputStreamWriter;
import java.io.Reader;
import java.net.HttpURLConnection;
import java.net.URL;
import java.net.URLConnection;
import java.util.Locale;
import java.util.Map;
import kotlin.collections.CollectionsKt___CollectionsKt;
import kotlin.io.CloseableKt;
import kotlin.io.TextStreamsKt;
import kotlin.jvm.internal.Intrinsics;
import kotlin.text.Charsets;
import kotlin.text.StringsKt__StringsJVMKt;
public final class m0 extends AsyncTask {
public final String a = "https://dq0bg0ej8semd.cloudfront.net/partnerPreferenceConfig.json";
public final String b = "GET";
public final Map c;
public final p0 d;
public m0(Map map, p0 p0Var) {
this.c = map;
this.d = p0Var;
}
public static s1 a(HttpURLConnection httpURLConnection) {
int responseCode = httpURLConnection.getResponseCode();
String str = null;
if (responseCode == 200 || responseCode == 500) {
Reader inputStreamReader = new InputStreamReader(httpURLConnection.getInputStream(), Charsets.UTF_8);
BufferedReader bufferedReader = inputStreamReader instanceof BufferedReader ? (BufferedReader) inputStreamReader : new BufferedReader(inputStreamReader, 8192);
try {
String readText = TextStreamsKt.readText(bufferedReader);
CloseableKt.closeFinally(bufferedReader, null);
str = readText;
} finally {
}
}
return new s1(str, responseCode);
}
public static N b(String str) {
try {
URLConnection openConnection = new URL(str).openConnection();
Intrinsics.checkNotNull(openConnection, "null cannot be cast to non-null type java.net.HttpURLConnection");
HttpURLConnection httpURLConnection = (HttpURLConnection) openConnection;
httpURLConnection.setReadTimeout(5000);
httpURLConnection.setConnectTimeout(5000);
httpURLConnection.setRequestMethod("GET");
httpURLConnection.setDoInput(true);
if (StringsKt__StringsJVMKt.equals("GET", "POST", true)) {
httpURLConnection.setDoOutput(true);
}
return a(httpURLConnection);
} catch (Exception e) {
e.getLocalizedMessage();
x6 x6Var = x6.a;
return new r0("Error during GET request: " + e.getLocalizedMessage());
}
}
public static N c(String str, Map map) {
String joinToString$default;
try {
URLConnection openConnection = new URL(str).openConnection();
Intrinsics.checkNotNull(openConnection, "null cannot be cast to non-null type java.net.HttpURLConnection");
HttpURLConnection httpURLConnection = (HttpURLConnection) openConnection;
httpURLConnection.setReadTimeout(5000);
httpURLConnection.setConnectTimeout(5000);
httpURLConnection.setRequestMethod("POST");
httpURLConnection.setDoInput(true);
if (StringsKt__StringsJVMKt.equals("POST", "POST", true)) {
httpURLConnection.setDoOutput(true);
}
OutputStream outputStream = httpURLConnection.getOutputStream();
BufferedWriter bufferedWriter = new BufferedWriter(new OutputStreamWriter(outputStream, "UTF-8"));
joinToString$default = CollectionsKt___CollectionsKt.joinToString$default(map.entrySet(), "&", null, null, 0, null, J.c, 30, null);
bufferedWriter.write(joinToString$default);
bufferedWriter.flush();
bufferedWriter.close();
outputStream.close();
return a(httpURLConnection);
} catch (Exception e) {
e.getLocalizedMessage();
x6 x6Var = x6.a;
return new r0("Error during GET request: " + e.getLocalizedMessage());
}
}
@Override
public final Object doInBackground(Object[] objArr) {
try {
String upperCase = this.b.toUpperCase(Locale.ROOT);
Intrinsics.checkNotNullExpressionValue(upperCase, "this as java.lang.String).toUpperCase(Locale.ROOT)");
if (Intrinsics.areEqual(upperCase, "POST")) {
return c(this.a, this.c);
}
if (Intrinsics.areEqual(upperCase, "GET")) {
return b(this.a);
}
throw new IllegalArgumentException("Invalid HTTP method: " + this.b);
} catch (Exception e) {
x6 x6Var = x6.a;
String localizedMessage = e.getLocalizedMessage();
if (localizedMessage == null) {
localizedMessage = "Unknown error occurred";
}
return new r0(localizedMessage);
}
}
@Override
public final void onPostExecute(Object obj) {
p0 p0Var;
N n = (N) obj;
if (!(n instanceof s1)) {
if (!(n instanceof r0) || (p0Var = this.d) == null) {
return;
}
r0 r0Var = (r0) n;
r0Var.getClass();
x6 x6Var = x6.a;
p0Var.a.resumeWith(kotlin.g.b(r0Var.a));
return;
}
p0 p0Var2 = this.d;
if (p0Var2 != null) {
String str = ((s1) n).b;
if (str != null) {
try {
if (str.length() != 0) {
p0Var2.a.resumeWith(kotlin.g.b(str));
}
} catch (Exception e) {
kotlin.coroutines.g gVar = p0Var2.a;
String message = e.getMessage();
if (message == null) {
message = "Unknown error";
}
gVar.resumeWith(kotlin.g.b(message));
return;
}
}
p0Var2.a.resumeWith(kotlin.g.b("Empty response"));
}
}
}