package com.alipay.sdk.data; import android.content.Context; import android.text.TextUtils; import com.alipay.sdk.sys.b; import com.alipay.sdk.util.c; import com.alipay.sdk.util.j; import java.util.ArrayList; import java.util.List; import org.json.JSONArray; import org.json.JSONException; import org.json.JSONObject; public final class a { private static a k; /* renamed from: a reason: collision with root package name */ public boolean f1334a = false; private int b = 10000; private boolean c = false; private String d = "https://h5.m.taobao.com/mlapp/olist.html"; private int e = 10; private boolean f = true; private boolean g = true; private boolean h = false; private boolean i = false; private List<C0008a> j = null; public int a() { if (this.b < 1000 || this.b > 20000) { c.a("DynCon", "time(def) = 10000"); return 10000; } c.a("DynCon", "time = " + this.b); return this.b; } public boolean b() { return this.c; } public boolean c() { return this.f; } public boolean d() { return this.g; } public String e() { return this.d; } public int f() { return this.e; } public boolean g() { return this.h; } public boolean h() { return this.i; } public List<C0008a> i() { return this.j; } public static a j() { if (k == null) { k = new a(); k.k(); } return k; } private void k() { a(j.b(com.alipay.sdk.sys.a.a(), b.a().b(), "alipay_cashier_dynamic_config", null)); } private void a(String str) { if (!TextUtils.isEmpty(str)) { try { a(new JSONObject(str)); } catch (Throwable th) { c.a(th); } } } /* access modifiers changed from: private */ public void a(com.alipay.sdk.sys.a aVar) { try { j.a(aVar, b.a().b(), "alipay_cashier_dynamic_config", l().toString()); } catch (Exception e2) { c.a(e2); } } /* access modifiers changed from: private */ public void b(String str) { if (!TextUtils.isEmpty(str)) { try { JSONObject optJSONObject = new JSONObject(str).optJSONObject("st_sdk_config"); if (optJSONObject != null) { a(optJSONObject); } else { c.c("DynCon", "empty config"); } } catch (Throwable th) { c.a(th); } } } private JSONObject l() throws JSONException { JSONObject jSONObject = new JSONObject(); jSONObject.put("timeout", a()); jSONObject.put("h5_port_degrade", b()); jSONObject.put("tbreturl", e()); jSONObject.put("configQueryInterval", f()); jSONObject.put("launchAppSwitch", C0008a.a(i())); jSONObject.put("scheme_pay_2", c()); jSONObject.put("intercept_batch", d()); jSONObject.put("deg_log_mcgw", g()); jSONObject.put("deg_start_srv_first", h()); return jSONObject; } private void a(JSONObject jSONObject) { this.b = jSONObject.optInt("timeout", 10000); this.c = jSONObject.optBoolean("h5_port_degrade", false); this.d = jSONObject.optString("tbreturl", "https://h5.m.taobao.com/mlapp/olist.html").trim(); this.e = jSONObject.optInt("configQueryInterval", 10); this.j = C0008a.a(jSONObject.optJSONArray("launchAppSwitch")); this.f = jSONObject.optBoolean("scheme_pay_2", true); this.g = jSONObject.optBoolean("intercept_batch", true); this.h = jSONObject.optBoolean("deg_log_mcgw", false); this.i = jSONObject.optBoolean("deg_start_srv_first", false); } public void a(com.alipay.sdk.sys.a aVar, Context context) { new Thread(new b(this, aVar, context)).start(); } /* renamed from: com.alipay.sdk.data.a$a reason: collision with other inner class name */ public static final class C0008a { /* renamed from: a reason: collision with root package name */ public final String f1335a; public final int b; public final String c; public C0008a(String str, int i, String str2) { this.f1335a = str; this.b = i; this.c = str2; } public static C0008a a(JSONObject jSONObject) { if (jSONObject == null) { return null; } return new C0008a(jSONObject.optString("pn"), jSONObject.optInt("v", 0), jSONObject.optString("pk")); } public static List<C0008a> a(JSONArray jSONArray) { if (jSONArray == null) { return null; } ArrayList arrayList = new ArrayList(); int length = jSONArray.length(); for (int i = 0; i < length; i++) { C0008a a2 = a(jSONArray.optJSONObject(i)); if (a2 != null) { arrayList.add(a2); } } return arrayList; } public static JSONObject a(C0008a aVar) { if (aVar == null) { return null; } try { return new JSONObject().put("pn", aVar.f1335a).put("v", aVar.b).put("pk", aVar.c); } catch (JSONException e) { c.a(e); return null; } } public static JSONArray a(List<C0008a> list) { if (list == null) { return null; } JSONArray jSONArray = new JSONArray(); for (C0008a aVar : list) { jSONArray.put(a(aVar)); } return jSONArray; } public String toString() { return String.valueOf(a(this)); } } }