package com.lt.app.a; import android.app.Activity; import android.app.Application; import android.content.ClipData; import android.content.ClipboardManager; import android.content.Context; import android.content.Intent; import android.graphics.Bitmap; import android.hardware.Camera; import android.net.Uri; import android.os.Build; import android.os.VibrationEffect; import android.os.Vibrator; import android.text.TextUtils; import android.util.Log; import android.webkit.URLUtil; import android.widget.PopupWindow; import android.widget.Toast; import com.b.a.d; import com.c.e; import com.d.a.b.f; import com.huawei.hms.push.constant.RemoteMessageConst; import com.huawei.hms.support.hianalytics.HiAnalyticsConstant; import com.lt.app.App; import com.lt.app.WebActivity; import com.lt.app.a.j; import com.lt.app.a.k; import com.lt.app.a.p; import com.lt.app.a.s; import com.lt.app.c.n; import com.lt.app.c.q; import com.lt.app.c.r; import com.lt.plugin.ab; import com.lt.plugin.af; import com.lt.plugin.ai; import com.lt.plugin.ak; import com.lt.plugin.aq; import com.lt.plugin.as; import com.lt.plugin.au; import com.lt.plugin.c; import com.lt.plugin.o; import com.lt.plugin.u; import com.meizu.cloud.pushsdk.constants.PushConstants; import java.lang.reflect.Method; import java.math.BigDecimal; import java.net.URL; import java.util.ArrayList; import me.dhtv.app.R; import org.json.JSONArray; import org.json.JSONException; import org.json.JSONObject; /* compiled from: LTJsBridge */ public class k { /* renamed from: ʻ reason: contains not printable characters */ public static String f6082; /* renamed from: ʼ reason: contains not printable characters */ private boolean f6083 = false; /* renamed from: ʽ reason: contains not printable characters */ private e f6084; /* renamed from: ʾ reason: contains not printable characters */ private a f6085 = null; private k() { } /* renamed from: ʻ reason: contains not printable characters */ public static k m8316(e eVar) { k kVar = new k(); kVar.m8331(eVar); return kVar; } /* renamed from: ʽ reason: contains not printable characters */ private void m8331(e eVar) { if (this.f6084 == null) { this.f6084 = eVar; eVar.setLtHandler(new com.b.a.b() { /* class com.lt.app.a.k.AnonymousClass1 */ @Override // com.b.a.b /* renamed from: ʻ reason: contains not printable characters */ public boolean m8333(d dVar, com.b.a.e eVar) { return dVar != null && k.this.m8328(dVar.f4514, dVar.f4512, eVar); } }); } } /* renamed from: ʻ reason: contains not printable characters */ public boolean m8332(e eVar, String str, JSONObject jSONObject) { return m8328(str, jSONObject, (com.b.a.e) null); } /* renamed from: ʼ reason: contains not printable characters */ public static k m8330(e eVar) { k kVar = new k(); kVar.f6084 = eVar; return kVar; } /* access modifiers changed from: private */ /* access modifiers changed from: public */ /* renamed from: ʻ reason: contains not printable characters */ private boolean m8328(String str, Object obj, final com.b.a.e eVar) { Log.d("YM", "jsBridge call " + str + "(" + obj + ")"); if (!TextUtils.isEmpty(str) && (this.f6084.getContext() instanceof com.lt.plugin.a)) { if (obj == null) { try { obj = new JSONObject(); } catch (Exception e) { String str2 = str + " function not supported"; Toast.makeText(this.f6084.getContext(), str2, 1).show(); m8318(10, str2, eVar); e.printStackTrace(); } } if (!(obj instanceof JSONObject)) { Toast.makeText(this.f6084.getContext(), "Parameter should be JSON object", 1).show(); m8318(10, "Parameter should be JSON object", eVar); return false; } com.lt.plugin.a aVar = (com.lt.plugin.a) this.f6084.getContext(); if (str.indexOf(".") > 0) { as.m8826(str, (JSONObject) obj, aVar, eVar == null ? null : new aq() { /* class com.lt.app.a.k.AnonymousClass2 */ @Override // com.lt.plugin.aq /* renamed from: ʻ reason: contains not printable characters */ public void m8334(int i, String str, boolean z) { k.this.m8319((k) i, (int) str, (String) eVar, (com.b.a.e) z); } }, $$Lambda$k$bgqrgfDFtTfF2ajG_Z4b63AycgM.INSTANCE); return true; } aVar.runOnUiThread(new Runnable(a.class.getMethod(str, JSONObject.class, com.b.a.e.class), obj, eVar) { /* class com.lt.app.a.$$Lambda$k$7q7JA7u6BSeszCD3Anpfjglxd4 */ private final /* synthetic */ Method f$1; private final /* synthetic */ Object f$2; private final /* synthetic */ com.b.a.e f$3; { this.f$1 = r2; this.f$2 = r3; this.f$3 = r4; } public final void run() { k.this.m8325((k) this.f$1, (Method) this.f$2, (Object) this.f$3); } }); return true; } return false; } /* access modifiers changed from: private */ /* renamed from: ʻ reason: contains not printable characters */ public static /* synthetic */ Boolean m8317(Integer num) { return Boolean.valueOf(App.m8121(num.intValue(), true)); } /* access modifiers changed from: private */ /* renamed from: ʻ reason: contains not printable characters */ public /* synthetic */ void m8325(Method method, Object obj, com.b.a.e eVar) { try { if (this.f6085 == null) { this.f6085 = new a(); } method.invoke(this.f6085, obj, eVar); } catch (Exception e) { m8318(99, e.getMessage(), eVar); e.printStackTrace(); } } /* access modifiers changed from: private */ /* compiled from: LTJsBridge */ public class a { /* renamed from: ʼ reason: contains not printable characters */ private com.b.a.e f6093; private a() { this.f6093 = null; } public void debug(JSONObject jSONObject, com.b.a.e eVar) { k.this.f6083 = true; } public void contactOne(JSONObject jSONObject, final com.b.a.e eVar) { if (!App.m8121(22, true)) { Toast.makeText(k.this.f6084.getContext(), (int) R.string.m_n, 0).show(); return; } o r3 = as.m8891(); if (r3 == null) { au.m8964(k.this.f6084.getContext(), "", "contactOne"); } else { r3.m8984((com.lt.plugin.a) k.this.f6084.getContext(), new aq() { /* class com.lt.app.a.k.a.AnonymousClass1 */ @Override // com.lt.plugin.aq /* renamed from: ʻ reason: contains not printable characters */ public void m8345(int i, String str, boolean z) { k.this.m8318((k) i, (int) str, (String) eVar); } }); } } public void contactAll(JSONObject jSONObject, final com.b.a.e eVar) { if (!App.m8121(22, true)) { Toast.makeText(k.this.f6084.getContext(), (int) R.string.m_n, 0).show(); return; } o r4 = as.m8891(); if (r4 == null) { au.m8964(k.this.f6084.getContext(), "", "contactAll"); return; } final PopupWindow r0 = com.lt.app.d.m8539(k.this.f6084.getViewEx()); r4.m8985((com.lt.plugin.a) k.this.f6084.getContext(), new aq() { /* class com.lt.app.a.k.a.AnonymousClass12 */ @Override // com.lt.plugin.aq /* renamed from: ʻ reason: contains not printable characters */ public void m8346(int i, String str, boolean z) { r0.dismiss(); k.this.m8318((k) i, (int) str, (String) eVar); } }); } public void setClipboardText(JSONObject jSONObject, com.b.a.e eVar) { String optString = jSONObject.optString("text"); ClipboardManager clipboardManager = (ClipboardManager) k.this.f6084.getContext().getSystemService("clipboard"); if (clipboardManager != null) { clipboardManager.setPrimaryClip(ClipData.newPlainText(null, optString)); } } public void getClipboardText(JSONObject jSONObject, com.b.a.e eVar) { ClipboardManager clipboardManager = (ClipboardManager) k.this.f6084.getContext().getSystemService("clipboard"); if (clipboardManager != null) { ClipData primaryClip = clipboardManager.getPrimaryClip(); k.this.m8318((k) 0, (int) ((primaryClip == null || primaryClip.getItemCount() <= 0) ? null : primaryClip.getItemAt(0).coerceToText(k.this.f6084.getContext()).toString()), (String) eVar); } } public void qqLogin(JSONObject jSONObject, final com.b.a.e eVar) { Context context = k.this.f6084.getContext(); af r0 = as.m8925(); if (r0 == null) { Toast.makeText(context, (int) R.string.login_qq_not_config, 1).show(); } else if (!App.m8121(12, true)) { Toast.makeText(k.this.f6084.getContext(), (int) R.string.m_n, 0).show(); } else if (!(context instanceof com.lt.app.a)) { k.this.m8318((k) 10, (int) "System Error", (String) eVar); } else { r0.m8796((com.lt.plugin.a) context, new c<JSONObject, String>() { /* class com.lt.app.a.k.a.AnonymousClass15 */ /* renamed from: ʻ reason: contains not printable characters */ public void callback(JSONObject jSONObject, String str) { if (jSONObject != null) { k.this.m8318((k) 0, (int) jSONObject.toString(), (String) eVar); } else { k.this.m8318((k) 1, (int) str, (String) eVar); } } }); } } public void wxAppInstalled(JSONObject jSONObject, com.b.a.e eVar) { k.this.m8324((k) Boolean.valueOf(s.m8450()), (Boolean) eVar); } public void wxLogin(JSONObject jSONObject, com.b.a.e eVar) { com.lt.app.d.m8556(k.this.f6084.getViewEx(), 2500); s.m8444(k.this.f6084.getContext(), new s.a(eVar) { /* class com.lt.app.a.$$Lambda$k$a$LSpwCV8AGZGLg6pbNTtF4k6oCg */ private final /* synthetic */ com.b.a.e f$1; { this.f$1 = r2; } @Override // com.lt.app.a.s.a public final void onComplete(int i, String str) { k.a.this.m8337((k.a) this.f$1, (com.b.a.e) i, (int) str); } }); } /* access modifiers changed from: private */ /* renamed from: ʻ reason: contains not printable characters */ public /* synthetic */ void m8337(com.b.a.e eVar, int i, String str) { boolean z = i == 0; k kVar = k.this; if (z) { str = au.m8936(au.m8933(1).m8971("code", str).m8972()); } kVar.m8318((k) i, (int) str, (String) eVar); } public void scan(JSONObject jSONObject, com.b.a.e eVar) { r rVar = (r) au.m8935(jSONObject.toString(), r.class); if (rVar != null) { com.lt.app.c.m8495((com.lt.app.a) k.this.f6084.getContext(), rVar, rVar.needResult ? new com.lt.plugin.b(eVar, rVar.m8535()) { /* class com.lt.app.a.$$Lambda$k$a$ulP6dkqCvuMBPETM1Yrh1sOmXCc */ private final /* synthetic */ com.b.a.e f$1; private final /* synthetic */ boolean f$2; { this.f$1 = r2; this.f$2 = r3; } @Override // com.lt.plugin.b public final void callback(Object obj) { k.a.this.m8338((k.a) this.f$1, (com.b.a.e) this.f$2, (boolean) ((String) obj)); } } : null); } } /* access modifiers changed from: private */ /* renamed from: ʻ reason: contains not printable characters */ public /* synthetic */ void m8338(com.b.a.e eVar, boolean z, String str) { k.this.m8319((k) 0, (int) str, (String) eVar, (com.b.a.e) z); } public void scanFromAlbum(JSONObject jSONObject, com.b.a.e eVar) { r rVar = (r) au.m8935(jSONObject.toString(), r.class); if (rVar != null) { com.lt.app.c.m8496((com.lt.app.a) k.this.f6084.getContext(), new com.lt.plugin.b(rVar, eVar) { /* class com.lt.app.a.$$Lambda$k$a$3Z86EOR2uM5dJ1mzSIAp82CC2Og */ private final /* synthetic */ r f$1; private final /* synthetic */ com.b.a.e f$2; { this.f$1 = r2; this.f$2 = r3; } @Override // com.lt.plugin.b public final void callback(Object obj) { k.a.this.m8344(this.f$1, this.f$2, (String) obj); } }); } } /* access modifiers changed from: private */ /* renamed from: ʼ reason: contains not printable characters */ public /* synthetic */ void m8344(r rVar, com.b.a.e eVar, String str) { m8342(str, rVar.needResult, eVar); } public void scanFromUrl(JSONObject jSONObject, com.b.a.e eVar) { r rVar = (r) au.m8935(jSONObject.toString(), r.class); if (rVar != null) { com.lt.app.c.m8498(rVar.imageUrl, k.this.f6084.getViewEx(), new com.lt.plugin.b(rVar, eVar) { /* class com.lt.app.a.$$Lambda$k$a$KbFOHwVe0uvvXkIxxzcuQ7910l4 */ private final /* synthetic */ r f$1; private final /* synthetic */ com.b.a.e f$2; { this.f$1 = r2; this.f$2 = r3; } @Override // com.lt.plugin.b public final void callback(Object obj) { k.a.this.m8340((k.a) this.f$1, (r) this.f$2, (com.b.a.e) ((String) obj)); } }); } } /* access modifiers changed from: private */ /* renamed from: ʻ reason: contains not printable characters */ public /* synthetic */ void m8340(r rVar, com.b.a.e eVar, String str) { m8342(str, rVar.needResult, eVar); } /* renamed from: ʻ reason: contains not printable characters */ private void m8342(String str, boolean z, com.b.a.e eVar) { if (!TextUtils.isEmpty(str)) { Context context = k.this.f6084.getContext(); vibrate(null, null); if (!z) { try { com.lt.app.d.m8544(context, App.m8130().m8135(str)); } catch (Exception e) { e.printStackTrace(); } } } k.this.m8318((k) 0, (int) str, (String) eVar); } public void cacheSize(JSONObject jSONObject, final com.b.a.e eVar) { if (!App.m8121(6, true)) { Toast.makeText(k.this.f6084.getContext(), (int) R.string.m_n, 0).show(); } else { j.m8312(new j.b() { /* class com.lt.app.a.k.a.AnonymousClass16 */ @Override // com.lt.app.a.j.b /* renamed from: ʻ reason: contains not printable characters */ public void m8350(long j) { k.this.m8318((k) 0, (int) String.valueOf(j), (String) eVar); } }); } } public void clearCache(JSONObject jSONObject, final com.b.a.e eVar) { if (!App.m8121(6, true)) { Toast.makeText(k.this.f6084.getContext(), (int) R.string.m_n, 0).show(); } else { j.m8311(new j.a() { /* class com.lt.app.a.k.a.AnonymousClass17 */ @Override // com.lt.app.a.j.a public void onCompleted() { k.this.m8318((k) 0, (int) null, (String) eVar); } }, k.this.f6084); } } public void share(JSONObject jSONObject, com.b.a.e eVar) { p.e eVar2; b bVar = null; int i = -1; if (jSONObject.length() > 0) { eVar2 = new p.e(); eVar2.f6218 = jSONObject.optString("title"); eVar2.f6219 = jSONObject.optString("link"); eVar2.f6221 = jSONObject.optString("imgUrl"); eVar2.f6220 = jSONObject.optString("desc"); i = jSONObject.optInt(RemoteMessageConst.TO, -1); } else { eVar2 = null; } e eVar3 = k.this.f6084; if (eVar != null) { bVar = new b(eVar); } p.m8396(i, eVar3, eVar2, bVar, false); } public void shareText(JSONObject jSONObject, com.b.a.e eVar) { p.g gVar = new p.g(); gVar.f6222 = jSONObject.optInt(RemoteMessageConst.TO, -1); gVar.f6223 = jSONObject.optString("text"); m8341(gVar, eVar); } public void shareImage(JSONObject jSONObject, com.b.a.e eVar) { p.c cVar = new p.c(); cVar.f6208 = jSONObject.optInt(RemoteMessageConst.TO, -1); cVar.f6209 = jSONObject.optString("imgUrl"); m8341(cVar, eVar); } public void shareMusic(JSONObject jSONObject, com.b.a.e eVar) { p.d dVar = new p.d(); dVar.f6210 = jSONObject.optInt(RemoteMessageConst.TO, -1); dVar.f6211 = jSONObject.optString("title"); dVar.f6212 = jSONObject.optString("desc"); dVar.f6213 = jSONObject.optString("imgUrl"); dVar.f6214 = jSONObject.optString("targetUrl"); dVar.f6215 = jSONObject.optString("musicUrl"); dVar.f6216 = jSONObject.optString("songAlbumUrl"); dVar.f6217 = jSONObject.optString("songLyric"); m8341(dVar, eVar); } public void shareVideo(JSONObject jSONObject, com.b.a.e eVar) { p.h hVar = new p.h(); hVar.f6224 = jSONObject.optInt(RemoteMessageConst.TO, -1); hVar.f6225 = jSONObject.optString("title"); hVar.f6226 = jSONObject.optString("desc"); hVar.f6227 = jSONObject.optString("imgUrl"); hVar.f6228 = jSONObject.optString("videoUrl"); m8341(hVar, eVar); } public void shareWxMiniProgram(JSONObject jSONObject, com.b.a.e eVar) { p.i iVar = (p.i) au.m8935(jSONObject.toString(), p.i.class); if (iVar != null) { m8341(iVar, eVar); } } public void shareQqMiniProgram(JSONObject jSONObject, com.b.a.e eVar) { p.f fVar = (p.f) au.m8935(jSONObject.toString(), p.f.class); if (fVar != null) { m8341(fVar, eVar); } } /* renamed from: ʻ reason: contains not printable characters */ private void m8341(Object obj, com.b.a.e eVar) { p.m8399(obj, k.this.f6084, eVar == null ? null : new b(eVar)); } public void showImages(JSONObject jSONObject, com.b.a.e eVar) { int i = 1; if (!App.m8121(26, true)) { Toast.makeText(k.this.f6084.getContext(), (int) R.string.m_n, 0).show(); return; } ab r1 = as.m8854(); if (r1 == null) { com.lt.app.d.m8563(k.this.f6084.getContext(), (int) R.string.no_plugin); return; } com.lt.app.c.a r3 = App.m8128(); ab.a aVar = new ab.a(); if (jSONObject.has("screenOrientation")) { aVar.f6502 = jSONObject.optInt("screenOrientation", 0); } else { if (!r3.m8521(28)) { i = r3.m8521(29) ? 2 : 0; } aVar.f6502 = i; } if (jSONObject.has("save")) { aVar.f6503 = jSONObject.optBoolean("save"); } else { aVar.f6503 = r3.m8521(25); } if (jSONObject.has("share")) { aVar.f6504 = jSONObject.optBoolean("share"); } else { aVar.f6504 = r3.m8521(26); } if (jSONObject.has("share_text")) { aVar.f6505 = jSONObject.optString("share_text"); } else { aVar.f6505 = k.this.f6084.getTitle() + " " + k.this.f6084.getUrl(); } aVar.f6506 = jSONObject.optInt("startIndex", 0); JSONArray optJSONArray = jSONObject.optJSONArray("items"); if (optJSONArray != null && optJSONArray.length() > 0) { aVar.f6507 = new ArrayList(optJSONArray.length()); for (int i2 = 0; i2 < optJSONArray.length(); i2++) { JSONObject optJSONObject = optJSONArray.optJSONObject(i2); if (optJSONObject != null) { ab.b bVar = new ab.b(); bVar.f6508 = optJSONObject.optString("url"); bVar.f6509 = optJSONObject.optString("text"); if (com.lt.app.d.m8555(bVar.f6508)) { aVar.f6507.add(bVar); } } } } r1.m8791(k.this.f6084.getContext(), aVar); } public void saveVideoToAlbum(JSONObject jSONObject, final com.b.a.e eVar) { String str; String optString = jSONObject.optString("i"); if (TextUtils.isEmpty(optString)) { k.this.m8324((k) false, (Boolean) eVar); } else if (optString.startsWith("http://") || optString.startsWith("https://")) { final PopupWindow r0 = com.lt.app.d.m8539(k.this.f6084.getViewEx()); int lastIndexOf = optString.lastIndexOf("/"); if (lastIndexOf <= 0 || lastIndexOf >= optString.length() - 1) { str = System.currentTimeMillis() + ".mp4"; } else { str = optString.substring(lastIndexOf + 1); } au.m8947(k.this.f6084.getContext(), optString, au.m8966(k.this.f6084.getContext(), str), new c<Uri, String>() { /* class com.lt.app.a.k.a.AnonymousClass18 */ /* renamed from: ʻ reason: contains not printable characters */ public void callback(Uri uri, String str) { r0.dismiss(); if (uri != null) { au.m8962(k.this.f6084.getContext(), uri); } k.this.m8324((k) Boolean.valueOf(uri != null), (Boolean) eVar); } }); } else { k.this.m8324((k) false, (Boolean) eVar); } } public void saveImageToAlbum(JSONObject jSONObject, final com.b.a.e eVar) { String optString = jSONObject.optString("i"); if (TextUtils.isEmpty(optString)) { k.this.m8324((k) false, (Boolean) eVar); } else if (optString.startsWith("http://") || optString.startsWith("https://")) { final PopupWindow r0 = com.lt.app.d.m8539(k.this.f6084.getViewEx()); com.lt.app.c.m8492(k.this.f6084, optString, new u<Bitmap, Void>() { /* class com.lt.app.a.k.a.AnonymousClass19 */ /* renamed from: ʻ reason: contains not printable characters */ public Void process(Bitmap bitmap) { r0.dismiss(); au.m8944(k.this.f6084.getContext(), bitmap, new com.lt.plugin.b<Uri>() { /* class com.lt.app.a.k.a.AnonymousClass19.AnonymousClass1 */ /* renamed from: ʻ reason: contains not printable characters */ public void callback(Uri uri) { k.this.m8324((k) Boolean.valueOf(uri != null), (Boolean) eVar); } }); return null; } }); } else { au.m8944(k.this.f6084.getContext(), com.lt.app.c.m8502(optString), new com.lt.plugin.b<Uri>() { /* class com.lt.app.a.k.a.AnonymousClass20 */ /* renamed from: ʻ reason: contains not printable characters */ public void callback(Uri uri) { k.this.m8324((k) Boolean.valueOf(uri != null), (Boolean) eVar); } }); } } public void saveImagesToAlbum(JSONObject jSONObject, com.b.a.e eVar) { JSONArray optJSONArray = jSONObject.optJSONArray("i"); if (optJSONArray == null || optJSONArray.length() == 0) { k.this.m8324((k) false, (Boolean) eVar); } else { m8343(optJSONArray, 0, eVar, com.lt.app.d.m8539(k.this.f6084.getViewEx())); } } /* access modifiers changed from: private */ /* access modifiers changed from: public */ /* renamed from: ʻ reason: contains not printable characters */ private void m8343(final JSONArray jSONArray, final int i, final com.b.a.e eVar, final PopupWindow popupWindow) { if (i >= jSONArray.length()) { popupWindow.dismiss(); k.this.m8324((k) true, (Boolean) eVar); return; } String optString = jSONArray.optString(i); if (optString.startsWith("http://") || optString.startsWith("https://")) { com.lt.app.c.m8492(k.this.f6084, optString, new u<Bitmap, Void>() { /* class com.lt.app.a.k.a.AnonymousClass21 */ /* renamed from: ʻ reason: contains not printable characters */ public Void process(Bitmap bitmap) { au.m8944(k.this.f6084.getContext(), bitmap, new com.lt.plugin.b<Uri>() { /* class com.lt.app.a.k.a.AnonymousClass21.AnonymousClass1 */ /* renamed from: ʻ reason: contains not printable characters */ public void callback(Uri uri) { if (uri == null) { popupWindow.dismiss(); k.this.m8324((k) false, (Boolean) eVar); return; } a.this.m8343(jSONArray, i + 1, eVar, popupWindow); } }); return null; } }); return; } au.m8944(k.this.f6084.getContext(), com.lt.app.c.m8502(optString), new com.lt.plugin.b<Uri>() { /* class com.lt.app.a.k.a.AnonymousClass2 */ /* renamed from: ʻ reason: contains not printable characters */ public void callback(Uri uri) { if (uri == null) { popupWindow.dismiss(); k.this.m8324((k) false, (Boolean) eVar); return; } a.this.m8343(jSONArray, i + 1, eVar, popupWindow); } }); } public void saveScreenshotToAlbum(JSONObject jSONObject, final com.b.a.e eVar) { au.m8944(k.this.f6084.getContext(), k.this.f6084.m6426(false), new com.lt.plugin.b<Uri>() { /* class com.lt.app.a.k.a.AnonymousClass3 */ /* renamed from: ʻ reason: contains not printable characters */ public void callback(Uri uri) { k.this.m8324((k) Boolean.valueOf(uri != null), (Boolean) eVar); } }); } public void shareImages(JSONObject jSONObject, com.b.a.e eVar) { int i = 0; if (!App.m8121(23, true)) { Toast.makeText(k.this.f6084.getContext(), (int) R.string.m_n, 0).show(); return; } com.lt.app.a aVar = (com.lt.app.a) k.this.f6084.getContext(); ai r1 = as.m8880(); if (r1 == null) { com.lt.app.d.m8563(k.this.f6084.getContext(), (int) R.string.no_plugin); return; } String optString = jSONObject.optString("text"); JSONArray optJSONArray = jSONObject.optJSONArray("images"); ArrayList arrayList = new ArrayList(); while (optJSONArray != null && i < optJSONArray.length()) { arrayList.add(optJSONArray.optString(i)); i++; } r1.m8797(aVar, optString, arrayList); } public void pay(final JSONObject jSONObject, final com.b.a.e eVar) { BigDecimal bigDecimal; final Context context = k.this.f6084.getContext(); int optInt = jSONObject.optInt("channel"); if (optInt < 0 || optInt > 2) { Toast.makeText(context, "Parameter channel should be 0, 1 or 2", 1).show(); k.this.m8318((k) 40, (int) "Parameter channel should be 0, 1 or 2", (String) eVar); return; } if (optInt == 0) { if (TextUtils.isEmpty("")) { Toast.makeText(context, (int) R.string.pay_wx_not_config, 1).show(); k.this.m8318((k) 50, (int) context.getString(R.string.pay_wx_not_config), (String) eVar); return; } else if (!App.m8121(38, true)) { Toast.makeText(context, (int) R.string.m_n, 1).show(); k.this.m8318((k) 50, (int) context.getString(R.string.m_n), (String) eVar); return; } } if (optInt == 1 && !App.m8121(37, true)) { Toast.makeText(context, (int) R.string.m_n, 1).show(); k.this.m8318((k) 50, (int) context.getString(R.string.m_n), (String) eVar); } else if (optInt != 2 || App.m8121(62, true)) { String optString = jSONObject.optString("title"); if (TextUtils.isEmpty(optString)) { Toast.makeText(context, "Missing Parameter title", 1).show(); k.this.m8318((k) 40, (int) "Missing Parameter title", (String) eVar); return; } String optString2 = jSONObject.optString("orderid"); if (TextUtils.isEmpty(optString2)) { Toast.makeText(context, "Missing Parameter orderid", 1).show(); k.this.m8318((k) 40, (int) "Missing Parameter orderid", (String) eVar); return; } try { String optString3 = jSONObject.optString("amount"); if (TextUtils.isEmpty(optString3)) { optString3 = PushConstants.PUSH_TYPE_NOTIFY; } bigDecimal = new BigDecimal(optString3); } catch (Exception e) { bigDecimal = new BigDecimal(PushConstants.PUSH_TYPE_NOTIFY); e.printStackTrace(); } if (bigDecimal.compareTo(new BigDecimal("0.01")) == -1) { Toast.makeText(context, "amount can not less than 0.01", 1).show(); k.this.m8318((k) 40, (int) "amount can not less than 0.01", (String) eVar); return; } String optString4 = jSONObject.optString("attach"); final PopupWindow r6 = com.lt.app.d.m8539(k.this.f6084.getViewEx()); if (optInt == 0) { App.m8130().m8138(optString, optString2, bigDecimal, optString4, new f<q<com.lt.app.c.p>>() { /* class com.lt.app.a.k.a.AnonymousClass4 */ /* renamed from: ʻ reason: contains not printable characters */ public void m8360(Exception exc, q<com.lt.app.c.p> qVar) { r6.dismiss(); if (exc != null || qVar == null) { Toast.makeText(context, "Network Error", 1).show(); k.this.m8318((k) 60, (int) "Network Error", (String) eVar); } else if (qVar.e != 0 || qVar.d == null) { Toast.makeText(context, qVar.m, 1).show(); k.this.m8318((k) 60, (int) qVar.m, (String) eVar); } else { try { JSONObject jSONObject = new JSONObject(); jSONObject.put(HiAnalyticsConstant.HaKey.BI_KEY_APPID, qVar.d.appid); jSONObject.put("partnerid", qVar.d.partnerid); jSONObject.put("prepayid", qVar.d.prepayid); jSONObject.put("noncestr", qVar.d.noncestr); jSONObject.put("package", qVar.d.package_); jSONObject.put("timestamp", qVar.d.timestamp); jSONObject.put("sign", qVar.d.sign); k.this.f6085.wxPay(jSONObject, eVar); } catch (Exception e) { Toast.makeText(context, "System Error", 1).show(); k.this.m8318((k) 70, (int) "System Error", (String) eVar); e.printStackTrace(); } } } }); } else if (optInt == 1) { App.m8130().m8134(optString, optString2, bigDecimal, optString4, new f<q<com.lt.app.c.o>>() { /* class com.lt.app.a.k.a.AnonymousClass5 */ /* renamed from: ʻ reason: contains not printable characters */ public void m8362(Exception exc, q<com.lt.app.c.o> qVar) { r6.dismiss(); if (exc != null || qVar == null) { Toast.makeText(context, "Network Error", 1).show(); k.this.m8318((k) 60, (int) "Network Error", (String) eVar); } else if (qVar.e != 0 || qVar.d == null) { Toast.makeText(context, qVar.m, 1).show(); k.this.m8318((k) 60, (int) qVar.m, (String) eVar); } else { try { JSONObject jSONObject = new JSONObject(); jSONObject.put("orderString", qVar.d.orderString); k.this.f6085.aliPay(jSONObject, eVar); } catch (Exception e) { Toast.makeText(context, "System Error", 1).show(); k.this.m8318((k) 70, (int) "System Error", (String) eVar); e.printStackTrace(); } } } }); } else if (optInt == 2) { final ak r8 = as.m8909(); if (r8 == null) { r6.dismiss(); Toast.makeText(context, "没有打包银联插件", 1).show(); k.this.m8318((k) 40, (int) "没有打包银联插件", (String) eVar); return; } App.m8130().m8141(optString, optString2, bigDecimal, optString4, new f<q<String>>() { /* class com.lt.app.a.k.a.AnonymousClass6 */ /* renamed from: ʻ reason: contains not printable characters */ public void m8364(Exception exc, q<String> qVar) { r6.dismiss(); if (exc != null || qVar == null) { Toast.makeText(context, "Network Error", 1).show(); k.this.m8318((k) 60, (int) "Network Error", (String) eVar); } else if (qVar.e != 0 || qVar.d == null) { Toast.makeText(context, qVar.m, 1).show(); k.this.m8318((k) 60, (int) qVar.m, (String) eVar); } else { try { JSONObject jSONObject = new JSONObject(); jSONObject.put("tn", qVar.d); jSONObject.put("seType", jSONObject.optString("seType")); r8.pay(jSONObject, (com.lt.plugin.a) k.this.f6084.getContext(), new aq() { /* class com.lt.app.a.k.a.AnonymousClass6.AnonymousClass1 */ @Override // com.lt.plugin.aq /* renamed from: ʻ reason: contains not printable characters */ public void m8365(int i, String str, boolean z) { k.this.m8318((k) i, (int) str, (String) eVar); } }); } catch (Exception e) { Toast.makeText(context, "System Error", 1).show(); k.this.m8318((k) 70, (int) "System Error", (String) eVar); e.printStackTrace(); } } } }); } } else { Toast.makeText(context, (int) R.string.m_n, 1).show(); k.this.m8318((k) 50, (int) context.getString(R.string.m_n), (String) eVar); } } public void aliPay(JSONObject jSONObject, final com.b.a.e eVar) { if (!App.m8121(37, true)) { Toast.makeText(k.this.f6084.getContext(), (int) R.string.m_n, 0).show(); return; } String optString = jSONObject.optString("orderString"); if (TextUtils.isEmpty(optString)) { k.this.m8318((k) 100, (int) "Missing Parameter orderString", (String) eVar); return; } Activity activity = (Activity) k.this.f6084.getContext(); com.lt.plugin.j r1 = as.m8887(); if (r1 == null) { com.lt.app.d.m8563(activity, (int) R.string.no_plugin); } else { r1.m8980(activity, optString, new com.lt.plugin.b<String>() { /* class com.lt.app.a.k.a.AnonymousClass7 */ /* renamed from: ʻ reason: contains not printable characters */ public void callback(String str) { k.this.m8318((k) (TextUtils.isEmpty(str) ? 0 : 100), (int) str, (String) eVar); } }); } } public void wxPay(JSONObject jSONObject, final com.b.a.e eVar) { Context context = k.this.f6084.getContext(); if (TextUtils.isEmpty("")) { Toast.makeText(context, (int) R.string.pay_wx_not_config, 1).show(); k.this.m8318((k) 50, (int) context.getString(R.string.pay_wx_not_config), (String) eVar); } else if (!App.m8121(38, true)) { Toast.makeText(context, (int) R.string.m_n, 0).show(); } else { String optString = jSONObject.optString(HiAnalyticsConstant.HaKey.BI_KEY_APPID); if (TextUtils.isEmpty(optString)) { k.this.m8318((k) 30, (int) "Missing Parameter appid", (String) eVar); } else if (TextUtils.isEmpty("") || TextUtils.equals(optString, "")) { String optString2 = jSONObject.optString("partnerid"); if (TextUtils.isEmpty(optString2)) { k.this.m8318((k) 40, (int) "Missing Parameter partnerid", (String) eVar); return; } String optString3 = jSONObject.optString("prepayid"); if (TextUtils.isEmpty(optString3)) { k.this.m8318((k) 40, (int) "Missing Parameter prepayid", (String) eVar); return; } String optString4 = jSONObject.optString("noncestr"); if (TextUtils.isEmpty(optString4)) { k.this.m8318((k) 40, (int) "Missing Parameter noncestr", (String) eVar); return; } String optString5 = jSONObject.optString("package"); if (TextUtils.isEmpty(optString5)) { k.this.m8318((k) 40, (int) "Missing Parameter package", (String) eVar); return; } String optString6 = jSONObject.optString("timestamp"); if (TextUtils.isEmpty(optString6)) { k.this.m8318((k) 40, (int) "Missing Parameter timestamp", (String) eVar); return; } String optString7 = jSONObject.optString("sign"); if (TextUtils.isEmpty(optString7)) { k.this.m8318((k) 40, (int) "Missing Parameter sign", (String) eVar); } else { s.m8448(optString, optString2, optString3, optString4, optString5, optString6, optString7, context, new s.a() { /* class com.lt.app.a.k.a.AnonymousClass8 */ @Override // com.lt.app.a.s.a public void onComplete(int i, String str) { k.this.m8318((k) i, (int) str, (String) eVar); } }); } } else { k.this.m8318((k) 30, (int) "appid should be ", (String) eVar); } } } public void wxSubscribeMsg(JSONObject jSONObject, final com.b.a.e eVar) { Context context = k.this.f6084.getContext(); if (TextUtils.isEmpty("")) { Toast.makeText(context, (int) R.string.pay_wx_not_config, 1).show(); } else if (!App.m8121(72, true)) { Toast.makeText(context, (int) R.string.m_n, 1).show(); } else { String optString = jSONObject.optString("template_id"); if (TextUtils.isEmpty(optString)) { Toast.makeText(context, "Missing Parameter template_id", 1).show(); k.this.m8318((k) 20, (int) "Missing Parameter template_id", (String) eVar); return; } int optInt = jSONObject.optInt("scene", 0); if (optInt < 0 || optInt > 10000) { Toast.makeText(context, "Parameter scene should be 0-10000", 1).show(); k.this.m8318((k) 30, (int) "Parameter scene should be 0-10000", (String) eVar); return; } s.m8445(context, optString, optInt, new s.a() { /* class com.lt.app.a.k.a.AnonymousClass9 */ @Override // com.lt.app.a.s.a public void onComplete(int i, String str) { k.this.m8318((k) i, (int) str, (String) eVar); } }); } } public void wxLaunchMiniProgram(JSONObject jSONObject, final com.b.a.e eVar) { Context context = k.this.f6084.getContext(); if (TextUtils.isEmpty("")) { Toast.makeText(context, (int) R.string.pay_wx_not_config, 1).show(); } else if (!App.m8121(73, true)) { Toast.makeText(context, (int) R.string.m_n, 1).show(); } else { String optString = jSONObject.optString("user_name"); if (TextUtils.isEmpty(optString)) { Toast.makeText(context, "Missing Parameter user_name", 1).show(); k.this.m8318((k) 20, (int) "Missing Parameter user_name", (String) eVar); return; } s.m8446(context, optString, jSONObject.optString("path"), jSONObject.optInt("type", 0), new s.a() { /* class com.lt.app.a.k.a.AnonymousClass10 */ @Override // com.lt.app.a.s.a public void onComplete(int i, String str) { k.this.m8319((k) i, (int) str, (String) eVar, (com.b.a.e) true); } }); } } public void wxOpenLaunchAppExtinfo(JSONObject jSONObject, com.b.a.e eVar) { Context context = k.this.f6084.getContext(); if (TextUtils.isEmpty("")) { Toast.makeText(context, (int) R.string.pay_wx_not_config, 1).show(); } else if (!App.m8121(118, true)) { Toast.makeText(context, (int) R.string.m_n, 1).show(); } else { k.this.m8318((k) 0, (int) au.m8936(au.m8933(1).m8971("extinfo", s.m8452()).m8972()), (String) eVar); } } public void wxOpenCustomerServiceChat(JSONObject jSONObject, final com.b.a.e eVar) { Context context = k.this.f6084.getContext(); if (TextUtils.isEmpty("")) { Toast.makeText(context, (int) R.string.pay_wx_not_config, 1).show(); } else if (!App.m8121(133, true)) { Toast.makeText(context, (int) R.string.m_n, 1).show(); } else { String optString = jSONObject.optString("corpId"); if (TextUtils.isEmpty(optString)) { Toast.makeText(context, "Missing Parameter corpId", 1).show(); k.this.m8318((k) 20, (int) "Missing Parameter corpId", (String) eVar); return; } String optString2 = jSONObject.optString("url"); if (TextUtils.isEmpty(optString2)) { Toast.makeText(context, "Missing Parameter url", 1).show(); k.this.m8318((k) 30, (int) "Missing Parameter url", (String) eVar); return; } s.m8447(context, optString, optString2, new s.a() { /* class com.lt.app.a.k.a.AnonymousClass11 */ @Override // com.lt.app.a.s.a public void onComplete(int i, String str) { k.this.m8318((k) i, (int) str, (String) eVar); } }); } } public void getInstallId(JSONObject jSONObject, com.b.a.e eVar) { k.this.m8318((k) 0, (int) App.m8130().m8148(), (String) eVar); } public void getDeviceId(JSONObject jSONObject, com.b.a.e eVar) { k.this.m8318((k) 0, (int) App.m8130().m8147(), (String) eVar); } public void deviceInfo(JSONObject jSONObject, com.b.a.e eVar) { k.this.m8318((k) 0, (int) au.m8936(com.lt.app.c.m8489(k.this.f6084.getContext())), (String) eVar); } public void net(JSONObject jSONObject, com.b.a.e eVar) { if (k.this.f6084.getContext() instanceof com.lt.plugin.a) { f.m8291((com.lt.plugin.a) k.this.f6084.getContext(), false, jSONObject, eVar); } } public void netUploadFile(JSONObject jSONObject, com.b.a.e eVar) { if (k.this.f6084.getContext() instanceof com.lt.plugin.a) { f.m8291((com.lt.plugin.a) k.this.f6084.getContext(), true, jSONObject, eVar); } } public void action(JSONObject jSONObject, com.b.a.e eVar) { ArrayList arrayList; JSONArray optJSONArray = jSONObject.optJSONArray("btns"); if (optJSONArray == null || optJSONArray.length() <= 0) { arrayList = null; } else { arrayList = new ArrayList(optJSONArray.length()); for (int i = 0; i < optJSONArray.length(); i++) { arrayList.add(optJSONArray.optString(i)); } } new com.lt.app.views.b().m8647(arrayList, k.this.f6084).m1667(((com.lt.app.a) k.this.f6084.getContext()).m1697(), "action"); } public void appSettings(JSONObject jSONObject, com.b.a.e eVar) { com.lt.app.d.m8562(k.this.f6084.getContext()); } public void openSetting(JSONObject jSONObject, com.b.a.e eVar) { com.lt.app.d.m8542(k.this.f6084.getContext(), jSONObject.optInt("w", 0)); } public void getSettingState(JSONObject jSONObject, com.b.a.e eVar) { k.this.m8324((k) Boolean.valueOf(com.lt.app.d.m8559(k.this.f6084.getContext(), jSONObject.optInt("w", 0))), (Boolean) eVar); } public void appDownloads(JSONObject jSONObject, com.b.a.e eVar) { k.this.f6084.getContext().startActivity(new Intent("android.intent.action.VIEW_DOWNLOADS")); } public void appInfo(JSONObject jSONObject, com.b.a.e eVar) { k.this.m8318((k) 0, (int) App.m8130().m8140().toString(), (String) eVar); } public void uiNavigation(JSONObject jSONObject, com.b.a.e eVar) { if (k.this.f6084.getContext() instanceof i) { ((i) k.this.f6084.getContext()).m8307(Boolean.valueOf(jSONObject.optBoolean("b")).booleanValue()); } } public void uiShare(JSONObject jSONObject, com.b.a.e eVar) { if (k.this.f6084.getContext() instanceof i) { ((i) k.this.f6084.getContext()).m8308(Boolean.valueOf(jSONObject.optBoolean("b")).booleanValue()); } } public void uiRefresh(JSONObject jSONObject, com.b.a.e eVar) { if (k.this.f6084.getContext() instanceof i) { ((i) k.this.f6084.getContext()).m8310(jSONObject.optBoolean("b")); } } public void onAppEnterBackground(JSONObject jSONObject, com.b.a.e eVar) { if (k.this.f6084.getContext() instanceof i) { ((i) k.this.f6084.getContext()).m8305(eVar); } } public void onAppEnterForeground(JSONObject jSONObject, com.b.a.e eVar) { if (k.this.f6084.getContext() instanceof i) { ((i) k.this.f6084.getContext()).m8306(eVar); } } public void uiActions(JSONObject jSONObject, com.b.a.e eVar) { if (k.this.f6084.getContext() instanceof i) { ((i) k.this.f6084.getContext()).m8309(jSONObject.optBoolean("b")); } } public void canGoBack(JSONObject jSONObject, com.b.a.e eVar) { k kVar = k.this; kVar.m8324((k) Boolean.valueOf(kVar.f6084.canGoBack()), (Boolean) eVar); } public void canGoForward(JSONObject jSONObject, com.b.a.e eVar) { k kVar = k.this; kVar.m8324((k) Boolean.valueOf(kVar.f6084.canGoForward()), (Boolean) eVar); } public void backToHome(JSONObject jSONObject, com.b.a.e eVar) { com.lt.app.d.m8549(k.this.f6084, jSONObject.optBoolean("loadHomePage", false)); } public void toast(JSONObject jSONObject, com.b.a.e eVar) { String optString = jSONObject.optString("s"); if (!TextUtils.isEmpty(optString)) { Toast.makeText(k.this.f6084.getContext(), optString, 1).show(); } } public void progress(JSONObject jSONObject, com.b.a.e eVar) { if (k.this.f6084.getContext() instanceof h) { ((h) k.this.f6084.getContext()).m8304((n) au.m8935(jSONObject.toString(), n.class)); } } public void checkCamera(JSONObject jSONObject, com.b.a.e eVar) { JSONObject jSONObject2 = new JSONObject(); try { int numberOfCameras = Camera.getNumberOfCameras(); jSONObject2.put("count", numberOfCameras); boolean z = false; boolean z2 = false; for (int i = 0; i < numberOfCameras; i++) { Camera.CameraInfo cameraInfo = new Camera.CameraInfo(); Camera.getCameraInfo(i, cameraInfo); if (cameraInfo.facing == 1) { z = true; } else if (cameraInfo.facing == 0) { z2 = true; } } jSONObject2.put("front", z); jSONObject2.put("back", z2); } catch (JSONException e) { e.printStackTrace(); } k.this.m8318((k) 0, (int) jSONObject2.toString(), (String) eVar); } public void vibrate(JSONObject jSONObject, com.b.a.e eVar) { Vibrator vibrator = (Vibrator) k.this.f6084.getContext().getSystemService("vibrator"); if (vibrator == null) { return; } if (Build.VERSION.SDK_INT >= 26) { vibrator.vibrate(VibrationEffect.createOneShot(200, -1)); } else { vibrator.vibrate(100); } } public void clearCookie(JSONObject jSONObject, com.b.a.e eVar) { k.this.f6084.m6433(); } public void print(JSONObject jSONObject, com.b.a.e eVar) { String r3 = k.this.f6084.m6427(jSONObject.optString("name"), jSONObject.optString("html")); k.this.m8318((k) (!TextUtils.isEmpty(r3) ? 1 : 0), (int) r3, (String) eVar); } public void exit(JSONObject jSONObject, com.b.a.e eVar) { if (jSONObject.optBoolean("k", false)) { System.exit(0); } else { com.lt.app.d.m8565(k.this.f6084.getContext()); } } public synchronized void upgrade(JSONObject jSONObject, com.b.a.e eVar) { if (App.m8128() != null) { com.lt.app.c.s sVar = (com.lt.app.c.s) au.m8935(jSONObject.toString(), com.lt.app.c.s.class); App r4 = App.m8130(); String string = (sVar == null || TextUtils.isEmpty(sVar.title)) ? r4.getString(R.string.newUpdateAvailable) : sVar.title; new c(r4, r4.m8139("gu/?id=" + App.m8128().ltid)).m8254(string, (c<Long, Long>) null); } } public void restart(JSONObject jSONObject, com.b.a.e eVar) { com.lt.app.d.m8541((Application) App.m8130()); } public void home(JSONObject jSONObject, com.b.a.e eVar) { if (k.this.f6084.getContext() instanceof Activity) { ((Activity) k.this.f6084.getContext()).moveTaskToBack(true); } } public void openInBrowser(JSONObject jSONObject, com.b.a.e eVar) { String optString = jSONObject.optString("s"); if (!TextUtils.isEmpty(optString)) { com.lt.app.d.m8547(k.this.f6084.getContext(), optString, true); } } public void launch(JSONObject jSONObject, com.b.a.e eVar) { boolean z = false; if (jSONObject.has(com.umeng.analytics.pro.ak.av)) { String optString = jSONObject.optString(com.umeng.analytics.pro.ak.av); if (!TextUtils.isEmpty(optString) && com.lt.app.d.m8552(k.this.f6084.getContext(), optString, (l) null)) { z = true; } k.this.m8324((k) Boolean.valueOf(z), (Boolean) eVar); return; } int i = -1; JSONArray optJSONArray = jSONObject.optJSONArray("b"); if (optJSONArray != null && optJSONArray.length() > 0) { int i2 = 0; while (true) { if (i2 >= optJSONArray.length()) { break; } String optString2 = optJSONArray.optString(i2); if (!TextUtils.isEmpty(optString2) && com.lt.app.d.m8552(k.this.f6084.getContext(), optString2, (l) null)) { i = i2; break; } i2++; } } k kVar = k.this; kVar.m8318((k) 0, (int) (i + ""), (String) eVar); } public void canLaunch(JSONObject jSONObject, com.b.a.e eVar) { String optString = jSONObject.optString(com.umeng.analytics.pro.ak.aG); boolean z = false; if (TextUtils.isEmpty(optString)) { k.this.m8324((k) false, (Boolean) eVar); return; } try { Intent intent = new Intent("android.intent.action.VIEW"); intent.setData(Uri.parse(optString)); if (intent.resolveActivity(k.this.f6084.getContext().getPackageManager()) != null) { z = true; } } catch (Exception e) { e.printStackTrace(); } k.this.m8324((k) Boolean.valueOf(z), (Boolean) eVar); } public void launchPackage(JSONObject jSONObject, com.b.a.e eVar) { String optString = jSONObject.optString("s"); if (!TextUtils.isEmpty(optString)) { boolean z = false; Intent launchIntentForPackage = k.this.f6084.getContext().getPackageManager().getLaunchIntentForPackage(optString); if (launchIntentForPackage != null) { try { k.this.f6084.getContext().startActivity(launchIntentForPackage); z = true; } catch (Exception e) { e.printStackTrace(); } } k.this.m8324((k) Boolean.valueOf(z), (Boolean) eVar); } } public void miniProgram(JSONObject jSONObject, final com.b.a.e eVar) { com.lt.app.d.m8551(jSONObject.toString(), (com.lt.plugin.a) k.this.f6084.getContext(), new com.lt.plugin.b<String>() { /* class com.lt.app.a.k.a.AnonymousClass13 */ /* renamed from: ʻ reason: contains not printable characters */ public void callback(String str) { k.this.m8318((k) 0, (int) str, (String) eVar); } }); } public void setMiniProgramResult(JSONObject jSONObject, com.b.a.e eVar) { com.lt.app.d.m8550(jSONObject.optString("r"), (com.lt.plugin.a) k.this.f6084.getContext()); } public void open(JSONObject jSONObject, com.b.a.e eVar) { String optString = jSONObject.optString("url"); if (!TextUtils.isEmpty(optString)) { l r4 = m8336(jSONObject); r4.url = null; if (!URLUtil.isValidUrl(optString)) { try { optString = new URL(new URL(k.this.f6084.getUrl()), optString).toString(); } catch (Exception e) { e.printStackTrace(); } } com.lt.app.d.m8552(k.this.f6084.getContext(), optString, r4); } } public void close(JSONObject jSONObject, com.b.a.e eVar) { String optString = jSONObject.optString("f"); if (!TextUtils.isEmpty(optString) && !URLUtil.isJavaScriptUrl(optString)) { optString = "javascript:" + optString; } k.f6082 = optString; if (k.this.f6084.getContext() instanceof Activity) { Activity activity = (Activity) k.this.f6084.getContext(); if (!(activity instanceof WebActivity) || !((WebActivity) activity).m8224()) { activity.finish(); } else { Log.d("YM", "主窗口不可 close,请使用 exit"); } } } public void setOptions(JSONObject jSONObject, com.b.a.e eVar) { if (k.this.f6084.getContext() instanceof WebActivity) { l r3 = m8336(jSONObject); r3.url = jSONObject.optString("url"); ((WebActivity) k.this.f6084.getContext()).m8208(r3); } } public void sidebarIsOpen(JSONObject jSONObject, com.b.a.e eVar) { k.this.m8324((k) Boolean.valueOf(com.lt.app.views.d.m8664() != null && com.lt.app.views.d.m8664().m8674()), (Boolean) eVar); } public void sidebarOpen(JSONObject jSONObject, com.b.a.e eVar) { if (com.lt.app.views.d.m8664() != null) { com.lt.app.views.d.m8664().m8673(); } } public void sidebarClose(JSONObject jSONObject, com.b.a.e eVar) { if (com.lt.app.views.d.m8664() != null) { com.lt.app.views.d.m8664().m8672(); } } public void sidebarHeader(JSONObject jSONObject, com.b.a.e eVar) { if (com.lt.app.views.d.m8664() != null) { com.lt.app.views.d.m8664().m8671(jSONObject); } } public void evalInNavbar(JSONObject jSONObject, com.b.a.e eVar) { if (k.this.f6084.getContext() instanceof g) { String optString = jSONObject.optString("j"); if (!TextUtils.isEmpty(optString)) { ((g) k.this.f6084.getContext()).m8302(optString); } } } public void evalInToolbar(JSONObject jSONObject, com.b.a.e eVar) { if (k.this.f6084.getContext() instanceof g) { String optString = jSONObject.optString("j"); if (!TextUtils.isEmpty(optString)) { ((g) k.this.f6084.getContext()).m8303(optString); } } } public void captureWebPage(JSONObject jSONObject, com.b.a.e eVar) { com.lt.app.c.a r4 = App.m8128(); a.m8241(k.this.f6084, jSONObject.optBoolean("fullPage", r4.m8522(22)), jSONObject.optBoolean("share", r4.m8522(23))); } public void requestPermissions(JSONObject jSONObject, final com.b.a.e eVar) { ArrayList arrayList = new ArrayList(); JSONArray optJSONArray = jSONObject.optJSONArray(com.umeng.analytics.pro.ak.ax); if (optJSONArray != null && optJSONArray.length() > 0) { int length = optJSONArray.length(); for (int i = 0; i < length; i++) { String optString = optJSONArray.optString(i); char c = 65535; switch (optString.hashCode()) { case -1881978343: if (optString.equals("ReadPhoneState")) { c = '\b'; break; } break; case -1850180567: if (optString.equals("ReadContacts")) { c = 5; break; } break; case -1614873294: if (optString.equals("WriteContacts")) { c = 6; break; } break; case -1311911648: if (optString.equals("WritePhotos")) { c = 1; break; } break; case -930581174: if (optString.equals("Microphone")) { c = 3; break; } break; case -351669650: if (optString.equals("BlueTooth")) { c = 7; break; } break; case 1396220375: if (optString.equals("ReadPhotos")) { c = 0; break; } break; case 1965687765: if (optString.equals("Location")) { c = 4; break; } break; case 2011082565: if (optString.equals("Camera")) { c = 2; break; } break; } switch (c) { case 0: arrayList.add("android.permission.READ_EXTERNAL_STORAGE"); break; case 1: arrayList.add("android.permission.WRITE_EXTERNAL_STORAGE"); break; case 2: arrayList.add("android.permission.CAMERA"); break; case 3: arrayList.add("android.permission.RECORD_AUDIO"); break; case 4: arrayList.add("android.permission.ACCESS_FINE_LOCATION"); arrayList.add("android.permission.ACCESS_COARSE_LOCATION"); break; case 5: arrayList.add("android.permission.READ_CONTACTS"); break; case 6: arrayList.add("android.permission.WRITE_CONTACTS"); break; case 7: arrayList.add("android.permission.BLUETOOTH"); break; case '\b': arrayList.add("android.permission.READ_PHONE_STATE"); break; } } } if (arrayList.size() <= 0 || !(k.this.f6084.getContext() instanceof com.lt.plugin.a)) { k.this.m8318((k) 0, (int) "{\"granted\":false,\"neverAskAgain\":false}", (String) eVar); return; } String[] strArr = new String[arrayList.size()]; arrayList.toArray(strArr); ((com.lt.plugin.a) k.this.f6084.getContext()).m8779(new c<Boolean, Boolean>() { /* class com.lt.app.a.k.a.AnonymousClass14 */ /* renamed from: ʻ reason: contains not printable characters */ public void callback(Boolean bool, Boolean bool2) { k kVar = k.this; kVar.m8318((k) 0, (int) ("{\"granted\":" + bool + ",\"neverAskAgain\":" + bool2 + "}"), (String) eVar); } }, strArr); } /* renamed from: ʻ reason: contains not printable characters */ private l m8336(JSONObject jSONObject) { l lVar = new l(); int i = 0; lVar.showTitle = jSONObject.has("showTitle") ? jSONObject.optBoolean("showTitle", true) ? 1 : 0 : -1; lVar.titleColor = jSONObject.optString("titleColor"); lVar.titleText = jSONObject.optString("titleText"); lVar.titleTextColor = jSONObject.optString("titleTextColor"); lVar.fullScreen = jSONObject.has("fullScreen") ? jSONObject.optBoolean("fullScreen") ? 1 : 0 : -1; lVar.statusBarColor = jSONObject.optString("statusBarColor"); lVar.statusBarBlackText = jSONObject.has("statusBarBlackText") ? jSONObject.optBoolean("statusBarBlackText") ? 1 : 0 : -1; lVar.screenOrientation = jSONObject.has("screenOrientation") ? jSONObject.optInt("screenOrientation") : -1; if (!jSONObject.has("refresh")) { i = -1; } else if (jSONObject.optBoolean("refresh")) { i = 1; } lVar.refresh = i; return lVar; } public void _isRoot(JSONObject jSONObject, com.b.a.e eVar) { k.this.m8324((k) Boolean.valueOf((k.this.f6084.getContext() instanceof Activity) && ((Activity) k.this.f6084.getContext()).isTaskRoot()), (Boolean) eVar); } } /* access modifiers changed from: private */ /* access modifiers changed from: public */ /* renamed from: ʻ reason: contains not printable characters */ private void m8324(Boolean bool, com.b.a.e eVar) { m8318(0, bool.booleanValue() ? "true" : "false", eVar); } /* access modifiers changed from: private */ /* access modifiers changed from: public */ /* renamed from: ʻ reason: contains not printable characters */ private void m8318(int i, String str, com.b.a.e eVar) { m8319(i, str, eVar, false); } /* access modifiers changed from: private */ /* access modifiers changed from: public */ /* renamed from: ʻ reason: contains not printable characters */ private void m8319(int i, String str, com.b.a.e eVar, boolean z) { m8320((Activity) this.f6084.getContext(), i, str, eVar, z); } /* renamed from: ʻ reason: contains not printable characters */ public static void m8320(Activity activity, int i, String str, final com.b.a.e eVar, final boolean z) { int i2; if (eVar != null) { String str2 = ""; if (str == null) { str = str2; } if (i != 0) { JSONObject jSONObject = new JSONObject(); try { jSONObject.put("errorCode", i); jSONObject.put("errorMessage", str); } catch (JSONException e) { e.printStackTrace(); } str = jSONObject.toString(); i2 = 0; } else { i2 = 1; } if (str != null) { str2 = str; } JSONObject jSONObject2 = new JSONObject(); try { jSONObject2.put("success", i2); jSONObject2.put("text", str2); final String jSONObject3 = jSONObject2.toString(); Log.d("YM", "jsBridge back " + jSONObject3); activity.runOnUiThread(new Runnable() { /* class com.lt.app.a.k.AnonymousClass3 */ public void run() { try { com.b.a.e.this.m6384(jSONObject3, z); } catch (Exception e) { e.printStackTrace(); } } }); } catch (JSONException e2) { e2.printStackTrace(); } } } /* access modifiers changed from: private */ /* compiled from: LTJsBridge */ public class b implements p.b { /* renamed from: ʻ reason: contains not printable characters */ final com.b.a.e f6156; b(com.b.a.e eVar) { this.f6156 = eVar; } @Override // com.lt.app.a.p.b /* renamed from: ʻ reason: contains not printable characters */ public void m8367(int i, boolean z, String str) { JSONObject jSONObject = new JSONObject(); try { jSONObject.put(RemoteMessageConst.TO, i); jSONObject.put("message", App.m8114(z ? R.string.share_succ : R.string.share_fail)); } catch (JSONException e) { e.printStackTrace(); } k.this.m8318((k) (z ? 0 : 100), (int) jSONObject.toString(), (String) this.f6156); } } }