渭南市核酸检测系统 v1.0.0版本的 MD5 值为:2198450e1f204316d16fc962c2ae4bf8
以下内容为反编译后的 PlusModule.java 源代码,内容仅作参考
package io.dcloud.feature.weex.extend;
import android.content.Intent;
import android.os.Build;
import android.os.Bundle;
import android.support.v4.media.session.PlaybackStateCompat;
import android.text.TextUtils;
import androidx.core.app.NotificationCompat;
import androidx.localbroadcastmanager.content.LocalBroadcastManager;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.taobao.weex.R;
import com.taobao.weex.WXSDKManager;
import com.taobao.weex.annotation.JSMethod;
import com.taobao.weex.bridge.JSCallback;
import com.taobao.weex.bridge.SimpleJSCallback;
import com.taobao.weex.bridge.WXBridgeManager;
import com.taobao.weex.common.WXModule;
import com.taobao.weex.el.parse.Operators;
import com.taobao.weex.ui.component.DCWXInput;
import io.dcloud.application.DCLoudApplicationImpl;
import io.dcloud.common.DHInterface.IActivityHandler;
import io.dcloud.common.DHInterface.IApp;
import io.dcloud.common.DHInterface.ICallBack;
import io.dcloud.common.DHInterface.IWebview;
import io.dcloud.common.adapter.ui.AdaUniWebView;
import io.dcloud.common.adapter.ui.webview.WebResUtil;
import io.dcloud.common.adapter.util.AndroidResources;
import io.dcloud.common.adapter.util.EventActionInfo;
import io.dcloud.common.adapter.util.Logger;
import io.dcloud.common.constant.AbsoluteConst;
import io.dcloud.common.util.BaseInfo;
import io.dcloud.common.util.IOUtil;
import io.dcloud.common.util.PdrUtil;
import io.dcloud.common.util.StringUtil;
import io.dcloud.common.util.ThreadPool;
import io.dcloud.common.util.language.LanguageUtil;
import io.dcloud.feature.internal.sdk.SDK;
import io.dcloud.feature.weex.WXBaseWrapper;
import io.dcloud.feature.weex.WXServiceWrapper;
import io.dcloud.feature.weex.WeexInstanceMgr;
import io.dcloud.weex.WXDotDataUtil;
import io.src.dcloud.adapter.DCloudAdapterUtil;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.InputStream;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
public class PlusModule extends WXModule {
private String EVENTS_DOCUMENT_EXECUTE = "javascript:!function(){(window.__html5plus__&&__html5plus__.isReady?__html5plus__:navigator.plus&&navigator.plus.isReady?navigator.plus:window.plus)||window.__load__plus__&&window.__load__plus__();var _=document.createEvent(\"HTMLEvents\");_.initEvent(\"%s\",!1,!0),_.targetId=\"%s\",_.originId=\"%s\",_.data=%s,document.dispatchEvent(_)}();";
ArrayList<JsData> chs = new ArrayList<>();
@JSMethod
public void postMessage(String str, String str2) {
WXServiceWrapper findWXServiceWrapper;
IWebview findWebview = WeexInstanceMgr.self().findWebview(this.mWXSDKInstance);
String str3 = this.EVENTS_DOCUMENT_EXECUTE;
Object[] objArr = new Object[4];
objArr[0] = "uniNViewMessage";
objArr[1] = "";
objArr[2] = findWebview != null ? findWebview.obtainFrameId() : "";
objArr[3] = str;
String format = StringUtil.format(str3, objArr);
if (findWebview == null && (findWXServiceWrapper = WeexInstanceMgr.self().findWXServiceWrapper(this.mWXSDKInstance)) != null && !BaseInfo.isWeexUniJs(findWXServiceWrapper.obtanApp())) {
findWXServiceWrapper.findWebViewToLoadUrL(format, str2);
} else if (findWebview != null) {
IWebview findWebview2 = PdrUtil.isEmpty(str2) ? findWebview : WeexInstanceMgr.self().findWebview(findWebview, findWebview.obtainApp(), findWebview.obtainApp().obtainAppId(), str2);
if (findWebview2 != null) {
if (findWebview2 instanceof AdaUniWebView) {
HashMap hashMap = new HashMap();
hashMap.put("targetId", str2);
hashMap.put("originId", findWebview != null ? findWebview.obtainFrameId() : "");
try {
hashMap.put("data", JSONObject.parseObject(str));
} catch (Exception unused) {
hashMap.put("data", str);
}
((AdaUniWebView) findWebview2).fireEvent(new EventActionInfo("uniNViewMessage", hashMap));
return;
}
findWebview2.loadUrl(format);
}
}
}
@JSMethod(uiThread = true)
public void exec(String str, String str2) {
if (this.mWXSDKInstance == null || !this.mWXSDKInstance.isDestroy()) {
IWebview findWebview = WeexInstanceMgr.self().findWebview(this.mWXSDKInstance);
if (findWebview instanceof AdaUniWebView) {
((AdaUniWebView) findWebview).prompt(str, str2);
}
}
}
class JsData {
public String data;
public String value;
JsData(String str, String str2) {
this.data = str;
this.value = str2;
}
}
@JSMethod(uiThread = false)
public String execSync(String str, String str2) {
if (this.mWXSDKInstance == null || !this.mWXSDKInstance.isDestroy()) {
IWebview findWebview = WeexInstanceMgr.self().findWebview(this.mWXSDKInstance);
return findWebview instanceof AdaUniWebView ? ((AdaUniWebView) findWebview).prompt(str, str2) : "";
}
return "";
}
@JSMethod(uiThread = true)
public void uniReady() {
WXBaseWrapper findWXBaseWrapper = WeexInstanceMgr.self().findWXBaseWrapper(this.mWXSDKInstance);
if (findWXBaseWrapper != null) {
findWXBaseWrapper.onReady();
}
}
@JSMethod(uiThread = false)
public void setLanguage(String str) {
if (this.mWXSDKInstance == null || this.mWXSDKInstance.getContext() == null || SDK.isUniMPSDK() || this.mWXSDKInstance.isDestroy() || Build.VERSION.SDK_INT < 21) {
return;
}
if ("auto".equalsIgnoreCase(str)) {
str = "";
}
LanguageUtil.updateLanguage(this.mWXSDKInstance.getContext(), str);
LocalBroadcastManager.getInstance(this.mWXSDKInstance.getContext()).sendBroadcast(new Intent(LanguageUtil.LanguageBroadCastIntent));
}
@JSMethod(uiThread = false)
public String getLanguage() {
return (Build.VERSION.SDK_INT < 21 || this.mWXSDKInstance == null || this.mWXSDKInstance.getContext() == null) ? "" : LanguageUtil.getCurrentLocaleLanguage(this.mWXSDKInstance.getContext());
}
private void runChData() {
if (this.chs.isEmpty()) {
return;
}
ArrayList arrayList = new ArrayList();
Iterator<JsData> it = this.chs.iterator();
while (it.hasNext()) {
JsData next = it.next();
exec(next.data, next.value);
arrayList.add(next);
}
this.chs.removeAll(arrayList);
}
@JSMethod(uiThread = false)
public Object getConfigInfo() {
IWebview findWebview = WeexInstanceMgr.self().findWebview(this.mWXSDKInstance);
if (findWebview instanceof AdaUniWebView) {
return ((AdaUniWebView) findWebview).getConfigInfo();
}
return null;
}
@JSMethod(uiThread = false)
public Object getRedirectInfo() {
JSONObject parseObject;
IWebview findWebview = WeexInstanceMgr.self().findWebview(this.mWXSDKInstance);
if (findWebview == null || !Boolean.valueOf(findWebview.obtainApp().obtainConfigProperty(IApp.ConfigProperty.UNI_RESTART_TO_DIRECT)).booleanValue() || (parseObject = JSON.parseObject(findWebview.obtainApp().obtainConfigProperty(AbsoluteConst.JSON_KEY_DEBUG_REFRESH))) == null || !parseObject.containsKey("arguments")) {
return null;
}
try {
return JSON.parseObject(parseObject.getString("arguments"));
} catch (Exception e) {
e.printStackTrace();
return null;
}
}
@JSMethod(uiThread = false)
public void setDefaultFontSize(String str) {
int intValue = Integer.valueOf(str).intValue();
if (intValue > 0) {
this.mWXSDKInstance.setDefaultFontSize(intValue);
}
}
@JSMethod(uiThread = true)
public void log(String str) {
Logger.d("console", "[LOG] " + str);
}
@JSMethod(uiThread = false)
public String getValue(String str) {
return ((DCWXInput) WXSDKManager.getInstance().getWXRenderManager().getWXComponent(this.mWXSDKInstance.getInstanceId(), str)).getValue();
}
@JSMethod(uiThread = true)
public void sendNativeEvent(String str, Object obj, JSCallback jSCallback) {
IWebview findWebview = WeexInstanceMgr.self().findWebview(this.mWXSDKInstance);
if (findWebview == null || findWebview.getActivity() == null || !(findWebview.getActivity() instanceof IActivityHandler)) {
return;
}
Bundle bundle = new Bundle();
bundle.putString("event", str);
bundle.putString("dataType", "String");
if (obj instanceof String) {
bundle.putString("data", String.valueOf(obj));
} else if (obj instanceof JSON) {
bundle.putString("data", ((JSON) obj).toJSONString());
bundle.putString("dataType", "JSON");
}
if (jSCallback instanceof SimpleJSCallback) {
bundle.putString("instanceId", this.mWXSDKInstance.getInstanceId());
bundle.putString(SDK.UNIMP_EVENT_CALLBACKID, ((SimpleJSCallback) jSCallback).getCallbackId());
}
((IActivityHandler) findWebview.getActivity()).callBack(SDK.UNIMP_JS_TO_NATIVE, bundle);
}
@JSMethod(uiThread = false)
public JSONObject getDotData() {
JSONObject deviceInfo = WXDotDataUtil.getDeviceInfo();
if (BaseInfo.SyncDebug) {
deviceInfo.put("maxMemory", (Object) ((Runtime.getRuntime().maxMemory() / PlaybackStateCompat.ACTION_SET_CAPTIONING_ENABLED) + "M"));
deviceInfo.put("totalMemory", (Object) ((Runtime.getRuntime().totalMemory() / PlaybackStateCompat.ACTION_SET_CAPTIONING_ENABLED) + "M"));
deviceInfo.put("appRuningTitme", (Object) Long.valueOf(BaseInfo.splashCloseTime - BaseInfo.startTime));
}
return deviceInfo;
}
@JSMethod(uiThread = false)
public JSONObject pushDebugData(Object obj) {
JSONObject jSONObject = new JSONObject();
jSONObject.put("data", obj);
return jSONObject;
}
@JSMethod
public void preloadReady(String str) {
ICallBack preUniMPCallBack = WeexInstanceMgr.self().getPreUniMPCallBack(str);
if (preUniMPCallBack != null) {
preUniMPCallBack.onCallBack(1, str);
}
}
@JSMethod(uiThread = true)
public void evalJSFiles(String str, final JSCallback jSCallback) {
final HashMap hashMap = new HashMap();
if (str == null) {
if (jSCallback != null) {
hashMap.put("type", -1);
hashMap.put(NotificationCompat.CATEGORY_MESSAGE, DCLoudApplicationImpl.self().getContext().getString(R.string.dcloud_feature_weex_msg_param_empty));
jSCallback.invoke(hashMap);
return;
}
return;
}
final JSONArray parseArray = JSON.parseArray(str);
if (parseArray != null) {
ThreadPool.self().addThreadTask(new Runnable() {
@Override
public void run() {
IWebview findWebview = WeexInstanceMgr.self().findWebview(PlusModule.this.mWXSDKInstance);
if (findWebview == null) {
if (jSCallback != null) {
hashMap.put("type", -1);
hashMap.put(NotificationCompat.CATEGORY_MESSAGE, DCLoudApplicationImpl.self().getContext().getString(R.string.dcloud_feature_weex_msg_page_destroyed));
jSCallback.invoke(hashMap);
return;
}
return;
}
byte obtainRunningAppMode = findWebview.obtainApp().obtainRunningAppMode();
String str2 = "";
for (int i = 0; i < parseArray.size(); i++) {
String string = parseArray.getString(i);
File file = new File(string);
InputStream inputStream = null;
if (file.exists()) {
try {
inputStream = new FileInputStream(file);
} catch (FileNotFoundException e) {
e.printStackTrace();
}
} else {
if (!string.startsWith("/storage") && obtainRunningAppMode == 1) {
string = findWebview.obtainApp().convert2AbsFullPath(findWebview.obtainFullUrl(), string);
if (string.startsWith(Operators.DIV)) {
string = string.substring(1, string.length());
}
} else {
string = findWebview.obtainApp().convert2WebviewFullPath(findWebview.obtainFullUrl(), string);
}
inputStream = WebResUtil.getEncryptionInputStream(string, findWebview.obtainApp());
}
if (inputStream != null) {
try {
String str3 = new String(IOUtil.toString(inputStream));
if (!TextUtils.isEmpty(str3)) {
str2 = str2 + str3;
}
} catch (Exception unused) {
}
} else if (jSCallback != null) {
hashMap.put("type", -1);
hashMap.put(NotificationCompat.CATEGORY_MESSAGE, string + DCLoudApplicationImpl.self().getContext().getString(R.string.dcloud_feature_weex_msg_cannot_find_file_by_path));
jSCallback.invoke(hashMap);
}
}
if (TextUtils.isEmpty(str2)) {
return;
}
WXBridgeManager.getInstance().syncExecJsOnInstanceWithResult(PlusModule.this.mWXSDKInstance.getInstanceId(), str2, -1);
if (jSCallback != null) {
hashMap.put("type", 1);
jSCallback.invoke(hashMap);
}
}
}, true);
} else if (jSCallback != null) {
hashMap.put("type", -1);
hashMap.put(NotificationCompat.CATEGORY_MESSAGE, DCLoudApplicationImpl.self().getContext().getString(R.string.dcloud_feature_weex_msg_param_invalid));
jSCallback.invoke(hashMap);
}
}
@JSMethod
public void getHostInfo(JSCallback jSCallback) {
JSONObject parseObject;
if (jSCallback == null) {
return;
}
JSONObject jSONObject = new JSONObject();
IWebview findWebview = WeexInstanceMgr.self().findWebview(this.mWXSDKInstance);
if (findWebview == null || findWebview.obtainApp() == null) {
jSCallback.invoke(jSONObject);
return;
}
String obtainAppInfo = findWebview.obtainApp().obtainAppInfo();
if (PdrUtil.isEmpty(obtainAppInfo)) {
jSCallback.invoke(jSONObject);
return;
}
if (PdrUtil.isUniMPHostForUniApp()) {
if (SDK.isUniMPSdk) {
if (!PdrUtil.isEmpty(SDK.mHostInfo) && (parseObject = JSON.parseObject(SDK.mHostInfo)) != null) {
jSONObject.putAll(parseObject);
}
} else {
JSONObject parseObject2 = JSON.parseObject(obtainAppInfo);
if (parseObject2 != null) {
jSONObject.putAll(parseObject2);
}
}
}
jSONObject.put("nativeName", (Object) AndroidResources.appName);
jSONObject.put("nativeAppid", (Object) AndroidResources.packageName);
jSONObject.put("nativeVersionName", (Object) AndroidResources.versionName);
jSONObject.put("nativeVersionCode", (Object) Integer.valueOf(AndroidResources.versionCode));
jSCallback.invoke(jSONObject);
}
@JSMethod(uiThread = false)
public int getAppState() {
IActivityHandler iActivityHandler;
IWebview findWebview = WeexInstanceMgr.self().findWebview(this.mWXSDKInstance);
if (findWebview == null || (iActivityHandler = DCloudAdapterUtil.getIActivityHandler(findWebview.getActivity())) == null) {
return 0;
}
return iActivityHandler.getActivityState();
}
}