QQ浏览器 v12.2.3.7053版本的 MD5 值为:8285ab3059e5c8b521a264dfbc5c3685
以下内容为反编译后的 APWebProtocol.java 源代码,内容仅作参考
package com.tencent.midas.jsbridge;
import android.app.Activity;
import android.text.TextUtils;
import android.webkit.JsResult;
import android.webkit.WebView;
import com.tencent.midas.api.APMidasResponse;
import com.tencent.midas.comm.APLog;
import com.tencent.midas.control.APMidasPayHelper;
import com.tencent.midas.data.APPluginDataInterface;
import com.tencent.midas.data.APPluginReportManager;
import com.tencent.midas.plugin.APPluginUtils;
import java.net.URLEncoder;
import java.util.HashMap;
import org.json.JSONException;
import org.json.JSONObject;
import org.json.JSONTokener;
public class APWebProtocol {
public static String URL_KEY_HEAD_CONTROL = "midasheader";
public static String URL_KEY_HEAD_TITLE = "midastitle";
public static String WEBACTION_CLOSE = "closeWeb";
public static String WEBACTION_GETCGIEXTEND = "getCgiExtend";
public static String WEBACTION_HEAD = "setHead";
public static void AnalyzeWebEntry(Activity activity, Object obj, IAPWebPage iAPWebPage, String str) {
HashMap<String, String> url2Map = APPluginUtils.url2Map(str);
url2Map.get("page");
String str2 = url2Map.get("action");
url2Map.get("saveNumber");
url2Map.get("saveType");
String str3 = url2Map.get("callback");
if (WEBACTION_GETCGIEXTEND.equals(str2)) {
String reserv = APPluginDataInterface.singleton().getReserv();
APLog.d("APWebResultPage", "sendCgiExtends() callback=" + str3 + ", extendStr=" + reserv);
if (!TextUtils.isEmpty(reserv)) {
try {
reserv = URLEncoder.encode(reserv, "UTF-8");
} catch (Exception e) {
e.printStackTrace();
}
}
H5CallBack(obj, str3, reserv);
return;
}
if (!WEBACTION_CLOSE.equals(str2)) {
if (WEBACTION_HEAD.equals(str2)) {
try {
iAPWebPage.initHead(activity, url2Map.get(URL_KEY_HEAD_CONTROL), url2Map.get(URL_KEY_HEAD_TITLE));
return;
} catch (Exception e2) {
e2.printStackTrace();
return;
}
}
return;
}
APPluginReportManager.getInstance().insertData(APPluginDataInterface.singleton().getLaunchInterface(), APPluginReportManager.MIDASPLUGIN_WEBPAGE_WEBCLOSE, "", "");
APMidasResponse aPMidasResponse = new APMidasResponse();
aPMidasResponse.resultCode = 100;
aPMidasResponse.resultMsg = "关闭";
APMidasPayHelper.midasCallBack(aPMidasResponse);
if (activity != null) {
activity.finish();
}
}
public static void H5CallBack(Object obj, String str, String str2) {
boolean z;
Object nextValue;
try {
nextValue = new JSONTokener(str2).nextValue();
} catch (JSONException | Exception unused) {
}
try {
if (nextValue != null) {
if (!(nextValue instanceof JSONObject)) {
}
z = true;
String format = !z ? String.format("typeof window[\"%s\"]==='function' && window[\"%s\"](%s);", str, str, str2) : String.format("typeof window[\"%s\"]==='function' && window[\"%s\"](\"%s\");", str, str, str2);
APLog.i("callback", str);
APLog.i("cb", format);
if (!(obj instanceof WebView)) {
((WebView) obj).loadUrl("javascript:" + format);
return;
}
if (obj instanceof com.tencent.smtt.sdk.WebView) {
((com.tencent.smtt.sdk.WebView) obj).loadUrl("javascript:" + format);
return;
}
return;
}
if (!z) {
}
APLog.i("callback", str);
APLog.i("cb", format);
if (!(obj instanceof WebView)) {
}
} catch (Exception e) {
APLog.d("H5CallBack", "H5CallBack() ex = " + e.toString());
return;
}
z = false;
}
public static boolean hookH5Method(Activity activity, WebView webView, String str, String str2, JsResult jsResult, IAPWebViewCallback iAPWebViewCallback) {
if (TextUtils.isEmpty(str2) || !str2.startsWith("http://unipay.sdk.android/?")) {
return false;
}
iAPWebViewCallback.WebChromeClientJsAlert(webView, str, str2, jsResult);
return true;
}
public static boolean hookH5Method(Activity activity, com.tencent.smtt.sdk.WebView webView, String str, String str2, com.tencent.smtt.export.external.interfaces.JsResult jsResult, IAPX5WebViewCallback iAPX5WebViewCallback) {
if (TextUtils.isEmpty(str2) || !str2.startsWith("http://unipay.sdk.android/?")) {
return false;
}
iAPX5WebViewCallback.WebChromeClientJsAlert(webView, str, str2, jsResult);
return true;
}
}