TIM v2.3.1版本的 MD5 值为:d6957e3ee7ce901ccc491cefdea0da8c
以下内容为反编译后的 PayJsPlugin.java 源代码,内容仅作参考
package com.tencent.biz.webviewplugin;
import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.os.Handler;
import android.os.Parcel;
import android.os.ResultReceiver;
import android.text.TextUtils;
import com.tencent.ark.ark;
import com.tencent.biz.pubaccount.CustomWebView;
import com.tencent.biz.pubaccount.util.PublicAccountUtil;
import com.tencent.common.app.AppInterface;
import com.tencent.common.app.BaseApplicationImpl;
import com.tencent.mobileqq.activity.PayBridgeActivity;
import com.tencent.mobileqq.activity.QQBrowserActivity;
import com.tencent.mobileqq.activity.qwallet.report.VACDReportUtil;
import com.tencent.mobileqq.app.PublicAccountObserver;
import com.tencent.mobileqq.statistics.ReportController;
import com.tencent.mobileqq.vaswebviewplugin.VasWebviewConstants;
import com.tencent.mobileqq.webview.swift.JsBridgeListener;
import com.tencent.mobileqq.webview.swift.JsWebViewPlugin;
import com.tencent.qphone.base.util.QLog;
import com.tencent.smtt.sdk.WebBackForwardList;
import cooperation.plugin.IPluginManager;
import cooperation.plugin.PluginInfo;
import cooperation.qwallet.plugin.QWalletHelper;
import cooperation.qwallet.plugin.QWalletPayBridge;
import java.net.URLEncoder;
import mqq.manager.TicketManager;
import org.json.JSONObject;
public class PayJsPlugin extends JsWebViewPlugin {
public static final String f83397a = "JsBridge.JsHandle.PayJsHandler";
public static final String f83398b = "pay";
protected long f6735a;
Activity f6736a;
protected Bundle f6737a;
protected MyResultRecevicer f6738a;
AppInterface f6739a;
private boolean f6740a;
public long f6741b;
private final String f83399c = "pay";
private final String d = "openTenpayView";
private final String e = "openService";
private final String f = "buyGoods";
private final String g = "rechargeGameCurrency";
private final String h = "rechargeQb";
private final String i = "preparePay";
private final String j = "subscribeMonthCardPay";
private final String k = "getQBRecord";
private final String l = "closeFullWindow";
private final String m = "launchWechatPaySign";
@Override
public void onCreate() {
this.f6736a = this.mRuntime.a();
this.f6739a = this.mRuntime.m9632a();
this.f6738a = new MyResultRecevicer(this, new Handler());
}
@Override
public boolean handleJsRequest(JsBridgeListener jsBridgeListener, String str, String str2, String str3, String... strArr) {
if (mo955a().equals(str2)) {
if ("pay".equals(str3)) {
this.f6741b = VACDReportUtil.a((String) null, "qqwallet", "pay-h5", "payinvoke", (String) null, 0, (String) null);
}
String str4 = "";
if (strArr != null && strArr.length > 0 && !TextUtils.isEmpty(strArr[0])) {
str4 = strArr[0];
}
this.f6735a = System.currentTimeMillis();
if (QLog.isColorLevel()) {
QLog.i(QWalletHelper.f69980a, 2, "" + this.f6735a + " PayJsPlugin.handleJsRequest params:" + str4);
}
if (str4 != null && "pay".equals(str3)) {
b(str4, jsBridgeListener);
} else if (str4 != null && "openTenpayView".equals(str3)) {
a(str4, jsBridgeListener);
} else if (str4 != null && "openService".equals(str3)) {
a(4, str4, jsBridgeListener);
} else if (str4 != null && "buyGoods".equals(str3)) {
a(7, str4, jsBridgeListener);
} else if (str4 != null && "rechargeGameCurrency".equals(str3)) {
a(6, str4, jsBridgeListener);
} else if (str4 != null && "rechargeQb".equals(str3)) {
a(8, str4, jsBridgeListener);
} else if (str4 != null && "subscribeMonthCardPay".equals(str3)) {
a(14, str4, jsBridgeListener);
} else if (str4 != null && "launchWechatPaySign".equals(str3)) {
a(17, str4, jsBridgeListener);
} else if ("preparePay".equals(str3)) {
a();
} else if (str4 != null && "getQBRecord".equals(str3)) {
b(str4);
} else if (!"closeFullWindow".equals(str3)) {
return false;
} else {
a(str4);
}
return true;
}
return false;
}
private void a(String str) {
String str2;
BaseApplicationImpl.f6970a.sendBroadcast(new Intent("cn.abel.action.broadcast"));
try {
str2 = new JSONObject(str).optString("url");
} catch (Exception e) {
e.printStackTrace();
str2 = null;
}
if (!TextUtils.isEmpty(str2)) {
Intent intent = new Intent(this.f6736a, QQBrowserActivity.class);
intent.putExtra("url", str2);
intent.putExtra(VasWebviewConstants.KEY_OPEN_PAGE_TIME, System.currentTimeMillis());
this.f6736a.startActivity(intent);
}
ReportController.b(null, "dc01332", "Vip_pay_mywallet", "", "wallet", "index.layila.intopage", 0, 0, "", "", "", "");
}
private void b(String str) {
String str2;
Bundle bundle = new Bundle();
bundle.putInt("PayInvokerId", 16);
String currentAccountUin = this.f6739a.getCurrentAccountUin();
TicketManager ticketManager = (TicketManager) this.f6739a.getManager(2);
if (ticketManager == null) {
str2 = "";
} else {
str2 = ticketManager.getSkey(currentAccountUin);
}
bundle.putString("uin", currentAccountUin);
bundle.putString("skey", str2);
bundle.putString("reqData", str);
if (this.f6738a != null) {
Parcel obtain = Parcel.obtain();
this.f6738a.writeToParcel(obtain, 0);
obtain.setDataPosition(0);
obtain.recycle();
bundle.putParcelable("_qwallet_payresult_receiver", (ResultReceiver) ResultReceiver.CREATOR.createFromParcel(obtain));
}
QWalletPayBridge.a(BaseApplicationImpl.f6970a, this.f6739a, bundle);
}
protected void a(String str, JsBridgeListener jsBridgeListener) {
if (QLog.isColorLevel()) {
QLog.i(f83397a, 2, "openTenpayView requet params json=" + str);
}
Bundle bundle = new Bundle();
bundle.putString(ark.ARKMETADATA_JSON, str);
bundle.putString("callbackSn", String.valueOf(jsBridgeListener.a()));
bundle.putInt(PayBridgeActivity.f10370d, 1);
bundle.putLong(PayBridgeActivity.f10372f, this.f6735a);
PayBridgeActivity.a(this.f6736a, 5, bundle);
}
protected void a() {
if (QLog.isColorLevel()) {
QLog.i(f83397a, 2, "pay requet preparePay");
}
if (this.mRuntime != null && this.mRuntime.a() != null && !QWalletHelper.a((Context) this.mRuntime.a())) {
Intent intent = new Intent(QWalletHelper.X);
IPluginManager.PluginParams pluginParams = new IPluginManager.PluginParams(0);
pluginParams.f69478b = PluginInfo.g;
pluginParams.d = "Wallet";
pluginParams.e = "com.qwallet.receiver.QWallPreloadReceiver";
pluginParams.f69471a = intent;
IPluginManager.a((Context) this.mRuntime.a(), pluginParams);
}
}
protected void a(int i, String str, JsBridgeListener jsBridgeListener) {
String string;
String valueOf = String.valueOf(jsBridgeListener.a());
Bundle bundle = new Bundle();
bundle.putString(PayBridgeActivity.f10374h, valueOf);
bundle.putString(PayBridgeActivity.f10375i, str);
bundle.putInt(PayBridgeActivity.f10370d, 1);
bundle.putLong(PayBridgeActivity.f10372f, this.f6735a);
this.f6737a = PayBridgeActivity.a(this.f6739a, this.f6736a, this.f6738a, i, bundle);
if (this.f6737a.getInt("retCode", -1) == 0 || (string = this.f6737a.getString("retJson")) == null) {
return;
}
callJs(valueOf, string);
}
protected void b(String str, JsBridgeListener jsBridgeListener) {
int indexOf;
if (QLog.isColorLevel()) {
QLog.i(f83397a, 2, "pay requet params json=" + str);
}
if (!this.f6740a) {
this.f6740a = true;
CustomWebView m9631a = this.mRuntime.m9631a();
String str2 = "";
if (m9631a != null) {
str2 = m9631a.getUrl();
}
try {
if (!TextUtils.isEmpty(str2)) {
str2 = URLEncoder.encode(str2, "utf-8");
}
} catch (Exception e) {
if (QLog.isDevelopLevel()) {
e.printStackTrace();
}
}
String str3 = "";
if (m9631a != null) {
WebBackForwardList copyBackForwardList = m9631a.copyBackForwardList();
if (copyBackForwardList.getSize() >= 1) {
String originalUrl = copyBackForwardList.getItemAtIndex(0).getOriginalUrl();
if (!TextUtils.isEmpty(originalUrl) && (indexOf = originalUrl.indexOf("qqwallet_appinfo=")) != -1) {
int indexOf2 = originalUrl.indexOf(38, "qqwallet_appinfo=".length() + indexOf);
if (indexOf2 == -1) {
indexOf2 = originalUrl.length();
}
str3 = originalUrl.substring(indexOf + "qqwallet_appinfo=".length(), indexOf2);
}
}
}
String valueOf = String.valueOf(jsBridgeListener.a());
Bundle bundle = new Bundle();
bundle.putString(PayBridgeActivity.f10374h, valueOf);
bundle.putString(PayBridgeActivity.f10375i, str);
bundle.putInt(PayBridgeActivity.f10370d, 1);
bundle.putLong(PayBridgeActivity.f10372f, this.f6735a);
bundle.putString(PayBridgeActivity.f10373g, str3);
bundle.putLong(PayBridgeActivity.f10378l, this.f6741b);
bundle.putString(PayBridgeActivity.f10371e, str2);
this.f6737a = PayBridgeActivity.a(this.f6739a, this.f6736a, this.f6738a, 9, bundle);
if (this.f6737a.getInt("retCode", -1) != 0) {
String string = this.f6737a.getString("retJson");
if (string != null) {
callJs(valueOf, string);
}
VACDReportUtil.a(this.f6741b, "parseurl", null, 668801, string);
}
this.f6740a = false;
}
}
protected void a(String str, String str2) {
super.callJs("javascript:window.JsBridge&&JsBridge.callback('" + str + "',{'r':0,'result':" + str2 + "});");
}
@Override
public String mo955a() {
return "pay";
}
public class MyResultRecevicer extends ResultReceiver {
protected PayJsPlugin f83400a;
public MyResultRecevicer(PayJsPlugin payJsPlugin, Handler handler) {
super(handler);
this.f83400a = payJsPlugin;
}
@Override
protected void onReceiveResult(int i, Bundle bundle) {
super.onReceiveResult(i, bundle);
if (this.f83400a != null && bundle != null) {
switch (i) {
case 4:
case 6:
case 7:
case 8:
case 14:
case 17:
String string = bundle.getString("callbackSn");
String string2 = bundle.getString("result");
if (this.f83400a.mRuntime != null && this.f83400a.mRuntime.m9631a() != null && string != null && string2 != null) {
this.f83400a.mRuntime.m9631a().loadUrl("javascript:window.JsBridge&&JsBridge.callback('" + string + "',{'r':0,'result':" + string2 + "});");
return;
}
return;
case 5:
case 10:
case 11:
case 12:
case 13:
case 15:
default:
return;
case 9:
String string3 = bundle.getString("callbackSn");
String string4 = bundle.getString("result");
String string5 = bundle.getString("upload_data");
boolean z = bundle.getBoolean("isChoosePubAcc", false);
String string6 = bundle.getString("pubAcc");
if (this.f83400a.mRuntime != null && this.f83400a.mRuntime.m9631a() != null && string3 != null && string4 != null) {
this.f83400a.mRuntime.m9631a().loadUrl("javascript:window.JsBridge&&JsBridge.callback('" + string3 + "',{'r':0,'result':" + string4 + "});");
}
if (string5 != null && string5.length() > 0) {
PayBridgeActivity.a(this.f83400a.f6739a, string5);
}
if (z && this.f83400a.f6739a != null && !TextUtils.isEmpty(string6)) {
PublicAccountUtil.a(this.f83400a.f6739a, (Context) this.f83400a.f6739a.getApp(), string6, (PublicAccountObserver) null, false);
return;
}
return;
case 16:
String string7 = bundle.getString("callback");
String string8 = bundle.getString("retData");
if (this.f83400a.mRuntime != null && this.f83400a.mRuntime.m9631a() != null && string7 != null && string8 != null) {
this.f83400a.a(string7, string8);
return;
}
return;
}
}
}
}
}