hxb
2025-04-25 5a43cb75120f69a57d5238e855eef8e82b3e4544
app/src/main/java/com/hdl/photovoltaic/uni/HDLUniMPSDKManager.java
@@ -2,8 +2,11 @@
import android.app.Application;
import android.content.Context;
import android.os.Build;
import android.os.Environment;
import android.os.Process;
import android.text.TextUtils;
import android.util.Log;
import com.google.gson.Gson;
@@ -25,6 +28,7 @@
import java.util.HashMap;
import io.dcloud.common.DHInterface.ICallBack;
import io.dcloud.common.util.RuningAcitvityUtil;
import io.dcloud.feature.sdk.DCSDKInitConfig;
import io.dcloud.feature.sdk.DCUniMPSDK;
import io.dcloud.feature.sdk.Interface.IDCUniMPPreInitCallback;
@@ -134,10 +138,11 @@
            public void onUniMPEventReceive(String appid, String event, Object data, DCUniMPJSCallback callback) {
//                handelUniMPEventReceive(appid, event, data, callback);
                HdlLogLogic.print("收到小程序通知    event=" + event);
                String processMessage=Process.myPid()+" ";
                HdlLogLogic.print("进程信息:" + processMessage);
                //暂时通过这个处理小程序同时多条相同的请求
                if (data == null) {
                    HdlLogLogic.print("收到小程序通知,data数据为null。", true);
                    return;
                }
//                String key= MD5Utils.getMd5(event+data.toString());
@@ -159,9 +164,10 @@
                    if (onOtherUniMPEventCallBack != null) {
                        onOtherUniMPEventCallBack.onOtherUniMPEventReceive(appid, event, data, callback);
                    } else {
                        HdlLogLogic.print("收到小程序通知,回调事件为null,无法回调事件并执行业务逻辑--->event=" + event + "\r\n" + "data=" + data, true);
                        HdlLogLogic.print("收到小程序通知,回调事件为null,无法回调事件并执行业务逻辑---event=" + event + "\r\n" + "data=" + data, true);
                        //有可能是系统回收掉activity导致回调为null,这样情况下强制返回登录界面;
                        //todo 长时间没响应将退出登录界面重新登录
                        HdlLogLogic.print("回调事件为null退出登录---", true);
                        HDLLinkPMUser.getInstance().logout(0);
                    }
                }
@@ -277,11 +283,10 @@
                UniMPOpenConfiguration uniMPOpenConfiguration = new UniMPOpenConfiguration();
                uniMPOpenConfiguration.path = path;
                uniMPOpenConfiguration.extraData = jsonObject;
                if(UserConfigManage.getInstance().isBAccount()){
                    uniMPOpenConfiguration.splashClass = BSplashView.class;
                }
                else {
                if (UserConfigManage.getInstance().getUniBottomSafeDistanceBackgroundColor() == 0) {
                    uniMPOpenConfiguration.splashClass = CSplashView.class;
                } else {
                    uniMPOpenConfiguration.splashClass = BSplashView.class;
                }
                uniMP = DCUniMPSDK.getInstance().openUniMP(mContext, uniAppId, uniMPOpenConfiguration);
            }
@@ -369,12 +374,12 @@
        if (mUniMPCaches.containsKey(uniAppId)) {
            if (mUniMPCaches.get(uniAppId) != null) {
                mUniMPCaches.get(uniAppId).sendUniMPEvent(topic, data);
                HdlLogLogic.print("Android---通知---uni---主题:" + topic + "---发送数据:" + new Gson().toJson(data));
//                HdlLogLogic.print("Android---通知---uni---主题:" + topic + "---发送数据:" + new Gson().toJson(data));
            } else {
                HdlLogLogic.print("Android---通知---uni---失败---小程序对象为空:" + uniAppId);
//                HdlLogLogic.print("Android---通知---uni---失败---小程序对象为空:" + uniAppId);
            }
        } else {
            HdlLogLogic.print("Android---通知---uni--->失败---¬小程序对象为空:" + uniAppId);
//            HdlLogLogic.print("Android---通知---uni---失败---¬小程序对象为空:" + uniAppId);
        }
    }
@@ -425,6 +430,7 @@
     * @param onOtherUniMPEventCallBack -
     */
    public void checkRemoveOtherUniMPEventCallBack(IOnOtherUniMPEventCallBack onOtherUniMPEventCallBack) {
        HdlLogLogic.print("onOtherUniMPEventCallBack", true);
        if (this.onOtherUniMPEventCallBack == onOtherUniMPEventCallBack) {
            this.onOtherUniMPEventCallBack = null;
            HdlLogLogic.print("onOtherUniMPEventCallBack remove callback", true);