package com.mb.rn.webview; import android.app.Activity; import android.app.AlertDialog; import android.content.ComponentName; import android.content.DialogInterface; import android.content.Intent; import android.net.Uri; import android.view.View; import android.webkit.JavascriptInterface; import cn.app.client.download.DownImageUrl; import cn.app.client.view.X5WebView; import com.facebook.react.bridge.Arguments; import com.facebook.react.bridge.ReactApplicationContext; import com.facebook.react.bridge.WritableMap; import com.facebook.react.uimanager.events.RCTEventEmitter; import com.tencent.smtt.sdk.TbsConfig; import java.io.PrintStream; public class XJsInterface { /* renamed from: a reason: collision with root package name */ private Activity f2606a; private View b; private ReactApplicationContext c; public XJsInterface(Activity activity, View view, ReactApplicationContext reactApplicationContext) { this.f2606a = activity; this.b = view; this.c = reactApplicationContext; } @JavascriptInterface public void reciveJsMessage(String str) { WritableMap b2 = Arguments.b(); WritableMap b3 = Arguments.b(); b3.putString("data", str); b2.putString("name", "reactNative"); b2.a("body", b3); ((RCTEventEmitter) this.c.a(RCTEventEmitter.class)).receiveEvent(this.b.getId(), "webMessage", b2); PrintStream printStream = System.out; printStream.println(">>>>>来自网页的消息:" + str); if (str.startsWith("uri:")) { new DownImageUrl(str.substring(4), this.f2606a); } else if (str.startsWith("url:weixin")) { System.out.println(">>>>>正在打开微信"); Intent intent = new Intent(); ComponentName componentName = new ComponentName(TbsConfig.APP_WX, "com.tencent.mm.ui.LauncherUI"); intent.setAction("android.intent.action.MAIN"); intent.addCategory("android.intent.category.LAUNCHER"); intent.addFlags(268435456); intent.setComponent(componentName); this.f2606a.startActivity(intent); } else if (str.startsWith("url:alipays:") || str.startsWith("url:alipay")) { try { this.f2606a.startActivity(new Intent("android.intent.action.VIEW", Uri.parse(str.substring(4)))); } catch (Exception unused) { new AlertDialog.Builder(this.f2606a).setMessage("未检测到支付宝客户端,请安装后重试。").setPositiveButton("立即安装", new DialogInterface.OnClickListener() { /* class com.mb.rn.webview.XJsInterface.AnonymousClass1 */ public void onClick(DialogInterface dialogInterface, int i) { XJsInterface.this.f2606a.startActivity(new Intent("android.intent.action.VIEW", Uri.parse("https://d.alipay.com"))); } }).setNegativeButton("取消", (DialogInterface.OnClickListener) null).show(); } } } /* renamed from: com.mb.rn.webview.XJsInterface$2 reason: invalid class name */ class AnonymousClass2 implements Runnable { /* renamed from: a reason: collision with root package name */ final /* synthetic */ String f2608a; final /* synthetic */ XJsInterface b; public void run() { String str = "document.nativeMessage('" + this.f2608a + "')"; if (this.b.b instanceof X5WebView) { ((X5WebView) this.b.b).evaluateJavascript(str, null); } } } }