正在查看: bbinstant v6.24.0 应用的 h.java JAVA 源代码文件
本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。
正在查看: bbinstant v6.24.0 应用的 h.java JAVA 源代码文件
本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。
package com.simpl.android.zeroClickSdk.internal;
import android.content.Context;
import android.os.Handler;
import android.os.Looper;
import com.simpl.android.fingerprint.commons.exception.ExceptionNotifier;
import com.simpl.android.zeroClickSdk.SimplZeroClickTokenAuthorization;
import com.simpl.android.zeroClickSdk.SimplZeroClickTokenListener;
import com.simpl.approvalsdk.SimplUser;
import com.snowplowanalytics.snowplow.tracker.constants.Parameters;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.lang.ref.WeakReference;
import java.net.URL;
import javax.net.ssl.HttpsURLConnection;
import org.json.JSONArray;
import org.json.JSONObject;
public class h {
public static final String a = "h";
private WeakReference<Context> b;
private SimplZeroClickTokenListener c;
final class a implements Runnable {
final SimplUser a;
final String b;
a(SimplUser simplUser, String str) {
this.a = simplUser;
this.b = str;
}
@Override
public final void run() {
String valueOf;
HttpsURLConnection httpsURLConnection;
h hVar;
Throwable th;
HttpsURLConnection httpsURLConnection2 = null;
try {
try {
JSONObject jSONObject = new JSONObject();
jSONObject.put("phone_number", this.a.getPrimaryId());
if (h.this.b.get() != null) {
jSONObject.put("app_hash", h.a((Context) h.this.b.get()));
}
valueOf = String.valueOf(jSONObject);
StringBuilder sb = new StringBuilder();
i iVar = (i) i.a();
sb.append(iVar.b ? "https://subscriptions-api.stagingsimpl.com/api/v3/" : iVar.a ? "https://sandbox-subscriptions-api.getsimpl.com/api/v3/" : "https://subscriptions-api.getsimpl.com/api/v3/");
sb.append("zero_click_tokens/initiate");
httpsURLConnection = (HttpsURLConnection) new URL(sb.toString()).openConnection();
} catch (Throwable th2) {
th = th2;
}
} catch (Exception e2) {
e = e2;
}
try {
httpsURLConnection.setRequestProperty("client-id", this.b);
httpsURLConnection.setRequestProperty("Content-Type", "application/json");
httpsURLConnection.setReadTimeout(30000);
httpsURLConnection.setConnectTimeout(30000);
StringBuilder sb2 = new StringBuilder();
sb2.append(valueOf.getBytes().length);
httpsURLConnection.setRequestProperty("Content-length", sb2.toString());
httpsURLConnection.setDoInput(true);
httpsURLConnection.setDoOutput(true);
int i2 = 0;
httpsURLConnection.setUseCaches(false);
OutputStream outputStream = httpsURLConnection.getOutputStream();
outputStream.write(valueOf.getBytes("UTF-8"));
outputStream.close();
if (httpsURLConnection.getResponseCode() == 200) {
BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(httpsURLConnection.getInputStream()));
StringBuilder sb3 = new StringBuilder();
while (true) {
String readLine = bufferedReader.readLine();
if (readLine == null) {
break;
} else {
sb3.append(readLine);
}
}
bufferedReader.close();
JSONObject jSONObject2 = new JSONObject(sb3.toString());
if (jSONObject2.optBoolean("success")) {
SimplZeroClickTokenAuthorization simplZeroClickTokenAuthorization = new SimplZeroClickTokenAuthorization();
simplZeroClickTokenAuthorization.setZeroClickVerificationUrl(jSONObject2.optJSONObject(Parameters.DATA).optString("verification_url"));
h.a(h.this, simplZeroClickTokenAuthorization);
} else {
h.a(h.this, new Throwable(jSONObject2.optString("error_code")));
}
} else {
if (httpsURLConnection.getResponseCode() >= 400) {
BufferedReader bufferedReader2 = new BufferedReader(new InputStreamReader(httpsURLConnection.getErrorStream()));
StringBuilder sb4 = new StringBuilder();
while (true) {
String readLine2 = bufferedReader2.readLine();
if (readLine2 == null) {
break;
} else {
sb4.append(readLine2);
}
}
bufferedReader2.close();
JSONObject jSONObject3 = new JSONObject(sb4.toString());
StringBuilder sb5 = new StringBuilder();
JSONArray jSONArray = jSONObject3.getJSONArray("errors");
while (i2 < jSONArray.length()) {
sb5.append(jSONArray.getString(i2));
sb5.append("\n");
i2++;
}
String str = h.a;
new StringBuilder("Error while init zeroclick user => ").append(sb5.toString());
hVar = h.this;
th = new Throwable(sb5.toString() + "\n" + jSONObject3.getString("error_code"));
} else {
BufferedReader bufferedReader3 = new BufferedReader(new InputStreamReader(httpsURLConnection.getInputStream()));
StringBuilder sb6 = new StringBuilder();
while (true) {
String readLine3 = bufferedReader3.readLine();
if (readLine3 == null) {
break;
} else {
sb6.append(readLine3);
}
}
bufferedReader3.close();
JSONObject jSONObject4 = new JSONObject(sb6.toString());
StringBuilder sb7 = new StringBuilder();
JSONArray jSONArray2 = jSONObject4.getJSONArray("errors");
while (i2 < jSONArray2.length()) {
sb7.append(jSONArray2.getString(i2));
sb7.append("\n");
i2++;
}
hVar = h.this;
th = new Throwable(sb7.toString() + "\n" + jSONObject4.getString("error_message"));
}
h.a(hVar, th);
}
httpsURLConnection.disconnect();
} catch (Exception e3) {
e = e3;
httpsURLConnection2 = httpsURLConnection;
String str2 = h.a;
ExceptionNotifier.getSharedInstance().send(e);
h.a(h.this, e);
if (httpsURLConnection2 != null) {
httpsURLConnection2.disconnect();
}
} catch (Throwable th3) {
th = th3;
httpsURLConnection2 = httpsURLConnection;
if (httpsURLConnection2 != null) {
httpsURLConnection2.disconnect();
}
throw th;
}
}
}
final class b implements Runnable {
final SimplZeroClickTokenAuthorization a;
b(SimplZeroClickTokenAuthorization simplZeroClickTokenAuthorization) {
this.a = simplZeroClickTokenAuthorization;
}
@Override
public final void run() {
h.this.c.onSuccess(this.a);
}
}
final class c implements Runnable {
final Throwable a;
c(Throwable th) {
this.a = th;
}
@Override
public final void run() {
h.this.c.onFailure(this.a);
}
}
public h(WeakReference<Context> weakReference, SimplZeroClickTokenListener simplZeroClickTokenListener) {
this.b = weakReference;
this.c = simplZeroClickTokenListener;
}
static String a(Context context) {
return new com.simpl.android.zeroClickSdk.internal.a(context.getApplicationContext()).a().get(0);
}
static void a(h hVar, SimplZeroClickTokenAuthorization simplZeroClickTokenAuthorization) {
a(hVar.new b(simplZeroClickTokenAuthorization));
}
static void a(h hVar, Throwable th) {
a(hVar.new c(th));
}
private static void a(Runnable runnable) {
new Handler(Looper.getMainLooper()).post(runnable);
}
}