From 734babb3a7348050fdffe845c560ba8b0b218152 Mon Sep 17 00:00:00 2001
From: mac <user@users-MacBook-Pro.local>
Date: 星期一, 20 十一月 2023 18:24:43 +0800
Subject: [PATCH] 2023年11月20日18:24:36

---
 app/src/main/java/com/hdl/photovoltaic/uni/HDLUniMPSDKManager.java |   63 ++++++++++++++++---------------
 1 files changed, 33 insertions(+), 30 deletions(-)

diff --git a/app/src/main/java/com/hdl/photovoltaic/uni/HDLUniMPSDKManager.java b/app/src/main/java/com/hdl/photovoltaic/uni/HDLUniMPSDKManager.java
index c434570..b6e4a7f 100644
--- a/app/src/main/java/com/hdl/photovoltaic/uni/HDLUniMPSDKManager.java
+++ b/app/src/main/java/com/hdl/photovoltaic/uni/HDLUniMPSDKManager.java
@@ -27,6 +27,7 @@
 import io.dcloud.feature.sdk.Interface.IUniMP;
 import io.dcloud.feature.sdk.Interface.IUniMPOnCloseCallBack;
 import io.dcloud.feature.unimp.DCUniMPJSCallback;
+import io.dcloud.feature.unimp.config.UniMPOpenConfiguration;
 
 
 public class HDLUniMPSDKManager {
@@ -100,7 +101,7 @@
             @Override
             public void onClose(String appid) {
                 if (AppConfigManage.isDebug()) {
-                    HdlLogLogic.print(TAG, "鏀跺埌灏忕▼搴忛�氱煡  琚叧闂簡");
+                    HdlLogLogic.print("鏀跺埌灏忕▼搴忛�氱煡  琚叧闂簡");
                 }
                 //灏忕▼搴忚鍏抽棴闇�瑕佸瀹炰緥缂撳瓨鍒犻櫎鎿嶄綔
                 if (mUniMPCaches.containsKey(appid)) {
@@ -118,7 +119,7 @@
             @Override
             public void onUniMPEventReceive(String appid, String event, Object data, DCUniMPJSCallback callback) {
 //                handelUniMPEventReceive(appid, event, data, callback);
-                HdlLogLogic.print(TAG, "鏀跺埌灏忕▼搴忛�氱煡    event=" + event);
+                HdlLogLogic.print("鏀跺埌灏忕▼搴忛�氱煡    event=" + event);
                 //鏆傛椂閫氳繃杩欎釜澶勭悊灏忕▼搴忓悓鏃跺鏉$浉鍚岀殑璇锋眰
                 if (data == null) {
                     return;
@@ -136,7 +137,7 @@
                     //鍥炰紶鏁版嵁缁欏皬绋嬪簭
                     JSONObject params = getAppParams();
                     callback.invoke(params);
-                    HdlLogLogic.print(TAG, "uni_GetAppParams callback:" + params.toString());
+                    HdlLogLogic.print( "uni_GetAppParams callback:" + params.toString());
                 } else {
                     //闄や簡缁熶竴澶勭悊锛屽墿浣欏叾瀹冪壒瀹氬満鏅殑浜嬩欢閫氱煡
                     if (onOtherUniMPEventCallBack != null) {
@@ -184,12 +185,12 @@
     public void checkUniMPResource(String uniAppId) {
         //2.涓嶆槸绗竴娆″惎鍔ㄤ簡锛屽厛鍒ゆ柇wgt鍖呬箣鍓嶆湁涔堟湁閮ㄧ讲杩�
         if (!DCUniMPSDK.getInstance().isExistsApp(uniAppId)) {
-            HdlLogLogic.print(TAG, "DCUni wgt涔嬪墠杩樻病閮ㄧ讲杩�");
+            HdlLogLogic.print("DCUni wgt涔嬪墠杩樻病閮ㄧ讲杩�");
             //涔嬪墠娌¢儴缃茶繃閲嶆柊閮ㄧ讲
             hdlReleaseAppResourceToRunPathWithAppid(uniAppId);
 //            [self hdlReleaseAppResourceToRunPathWithAppid:uniAppId];
         } else {
-            HdlLogLogic.print(TAG, "DCUni wgt宸茬粡閮ㄧ讲杩�");
+            HdlLogLogic.print("DCUni wgt宸茬粡閮ㄧ讲杩�");
         }
     }
 
@@ -202,7 +203,7 @@
         String wgtPath = mContext.getExternalFilesDir(Environment.DIRECTORY_DOWNLOADS) + "/" + uniAppId + ".wgt";
         boolean b = fileIsExists(wgtPath);
         if (b) {
-            HdlLogLogic.print(TAG, "wgt鍖呮湰鍦板瓨鍦�");
+            HdlLogLogic.print("wgt鍖呮湰鍦板瓨鍦�");
             DCUniMPSDK.getInstance().releaseWgtToRunPathFromePath(uniAppId, wgtPath, new ICallBack() {
                 @Override
                 public Object onCallBack(int code, Object pArgs) {
@@ -211,13 +212,13 @@
 
                     } else {
                         //閲婃斁wgt澶辫触
-                        HdlLogLogic.print(TAG, "璧勬簮閲婃斁澶辫触");
+                        HdlLogLogic.print("璧勬簮閲婃斁澶辫触");
                     }
                     return null;
                 }
             });
         } else {
-            HdlLogLogic.print(TAG, "wgt鍖呮湰鍦颁笉瀛樺湪");
+            HdlLogLogic.print( "wgt鍖呮湰鍦颁笉瀛樺湪");
         }
     }
 
@@ -243,15 +244,16 @@
     /**
      * 鎵撳紑灏忕▼搴�
      *
-     * @param uniAppId 灏忕▼搴廔D
-     * @param path     鎸囧畾璺緞
-     *                 渚嬶細pages/component/scroll-view/scroll-view?a=1&b=2&c=3
-     * @param callBack 鐩戝惉灏忕▼搴廜therUniMPEvent浜嬩欢
+     * @param uniAppId   灏忕▼搴廔D
+     * @param path       鎸囧畾璺緞
+     *                   渚嬶細pages/component/scroll-view/scroll-view?a=1&b=2&c=3
+     * @param jsonObject 闄勫姞鏁版嵁
+     * @param callBack   鐩戝惉灏忕▼搴廜therUniMPEvent浜嬩欢
      */
-    public void openUniMP(String uniAppId, String path, IOnOtherUniMPEventCallBack callBack) {
+    public void openUniMP(String uniAppId, String path, JSONObject jsonObject, IOnOtherUniMPEventCallBack callBack) {
         if (TextUtils.isEmpty(uniAppId)) {
             HdlThreadLogic.toast(mContext, "uni Id null");
-            HdlLogLogic.print(TAG, "灏忕▼搴廔D 涓嶈兘涓虹┖");
+            HdlLogLogic.print( "灏忕▼搴廔D 涓嶈兘涓虹┖");
             return;
         }
         try {
@@ -260,9 +262,10 @@
             if (TextUtils.isEmpty(path)) {
                 uniMP = DCUniMPSDK.getInstance().openUniMP(mContext, uniAppId);
             } else {
-//                UniMPOpenConfiguration uniMPOpenConfiguration = new UniMPOpenConfiguration();
-//                uniMPOpenConfiguration.path = path;
-                uniMP = DCUniMPSDK.getInstance().openUniMP(mContext, uniAppId, path);
+                UniMPOpenConfiguration uniMPOpenConfiguration = new UniMPOpenConfiguration();
+                uniMPOpenConfiguration.path = path;
+                uniMPOpenConfiguration.extraData = jsonObject;
+                uniMP = DCUniMPSDK.getInstance().openUniMP(mContext, uniAppId, uniMPOpenConfiguration);
             }
             mCurrentAppId = uniAppId;//璁板綍褰撳墠灏忕▼搴�
             mUniMPCaches.put(uniMP.getAppid(), uniMP);
@@ -270,7 +273,7 @@
             e.printStackTrace();
             HdlThreadLogic.toast(HDLApp.getInstance(), R.string.uni_open_error);
             initDCUniMPSDK(HDLApp.getInstance());
-            HdlLogLogic.print(TAG, "鎵撳紑澶辫触" + e.getMessage());
+            HdlLogLogic.print("鎵撳紑澶辫触===" + e.getMessage());
         }
     }
 
@@ -289,7 +292,7 @@
             @Override
             public void onInitFinished(boolean b) {
 
-                HdlLogLogic.print("unimp", "UniMPSDK 鍒濆鍖栧畬鎴�----" + b);
+                HdlLogLogic.print("UniMPSDK 鍒濆鍖栧畬鎴�----" + b);
             }
         });
 
@@ -312,19 +315,19 @@
      */
     public void openUniMP(String uniAppId, JSONObject arguments, IOnOtherUniMPEventCallBack callBack) {
         if (TextUtils.isEmpty(uniAppId)) {
-            HdlLogLogic.print(TAG, "灏忕▼搴廔D 涓嶈兘涓虹┖");
+            HdlLogLogic.print("灏忕▼搴廔D 涓嶈兘涓虹┖");
             return;
         }
         try {
             setOnOtherUniMPEventCallBack(callBack);
-//            UniMPOpenConfiguration uniMPOpenConfiguration = new UniMPOpenConfiguration();
-//            uniMPOpenConfiguration.extraData = arguments;
-            uniMP = DCUniMPSDK.getInstance().openUniMP(mContext, uniAppId, arguments);
+            UniMPOpenConfiguration uniMPOpenConfiguration = new UniMPOpenConfiguration();
+            uniMPOpenConfiguration.extraData = arguments;
+            uniMP = DCUniMPSDK.getInstance().openUniMP(mContext, uniAppId, uniMPOpenConfiguration);
             mCurrentAppId = uniAppId;//璁板綍褰撳墠灏忕▼搴�
             mUniMPCaches.put(uniMP.getAppid(), uniMP);
         } catch (Exception e) {
             e.printStackTrace();
-            HdlLogLogic.print(TAG, "鎵撳紑澶辫触" + e.getMessage());
+            HdlLogLogic.print( "鎵撳紑澶辫触===" + e.getMessage());
         }
     }
 
@@ -341,12 +344,12 @@
         if (mUniMPCaches.containsKey(uniAppId)) {
             if (mUniMPCaches.get(uniAppId) != null) {
                 mUniMPCaches.get(uniAppId).sendUniMPEvent(event, data);
-                HdlLogLogic.print(TAG, "鍙戦�侀�氱煡鎴愬姛锛歟vent锛�" + event + " data锛�" + new Gson().toJson(data));
+                HdlLogLogic.print("鍙戦�侀�氱煡鎴愬姛锛歟vent锛�" + event + " data锛�" + new Gson().toJson(data));
             } else {
-                HdlLogLogic.print(TAG, "鍙戦�佸け璐ワ紝灏忕▼搴忓璞′负绌猴細" + uniAppId);
+                HdlLogLogic.print("鍙戦�佸け璐ワ紝灏忕▼搴忓璞′负绌猴細" + uniAppId);
             }
         } else {
-            HdlLogLogic.print(TAG, "鍙戦�佸け璐ワ紝鎵句笉鍒板搴旂殑灏忕▼搴忥細" + uniAppId);
+            HdlLogLogic.print( "鍙戦�佸け璐ワ紝鎵句笉鍒板搴旂殑灏忕▼搴忥細" + uniAppId);
         }
 
     }
@@ -360,7 +363,7 @@
      */
     public void sendUniMPEventToCurrentOpenAppId(String event, Object data) {
         if (TextUtils.isEmpty(mCurrentAppId)) {
-            HdlLogLogic.print(TAG, "褰撳墠娌℃墦寮�鐨勫皬绋嬪簭");
+            HdlLogLogic.print("褰撳墠娌℃墦寮�鐨勫皬绋嬪簭");
             return;
         }
         sendUniMPEvent(mCurrentAppId, event, data);
@@ -388,7 +391,7 @@
 
     public void setOnOtherUniMPEventCallBack(IOnOtherUniMPEventCallBack onOtherUniMPEventCallBack) {
         this.onOtherUniMPEventCallBack = onOtherUniMPEventCallBack;
-        HdlLogLogic.print("onOtherUniMPEventCallBack", "set callback");
+        HdlLogLogic.print("onOtherUniMPEventCallBack set callback");
     }
 
     /**
@@ -399,7 +402,7 @@
     public void checkRemoveOtherUniMPEventCallBack(IOnOtherUniMPEventCallBack onOtherUniMPEventCallBack) {
         if (this.onOtherUniMPEventCallBack == onOtherUniMPEventCallBack) {
             this.onOtherUniMPEventCallBack = null;
-            HdlLogLogic.print("onOtherUniMPEventCallBack", "remove callback");
+            HdlLogLogic.print("onOtherUniMPEventCallBack remove callback");
         }
     }
 

--
Gitblit v1.8.0