wjc
18 小时以前 2f5411b86c59706d31f6ec7de629d8f860725e46
app/src/main/java/com/hdl/photovoltaic/uni/HDLUniMPSDKManager.java
@@ -50,6 +50,10 @@
     */
    public static boolean isExistsActivity = false;
    /**
     * 小程序是否开启
     */
    public static boolean  uinEnabled = false;
    /**
     * context
     */
    private Application mContext;
@@ -119,6 +123,7 @@
        DCUniMPSDK.getInstance().setUniMPOnCloseCallBack(new IUniMPOnCloseCallBack() {
            @Override
            public void onClose(String appid) {
                HDLUniMPSDKManager.uinEnabled=false;
//                if (AppConfigManage.isDebug()) {
//                    HdlLogLogic.print("收到小程序通知  被关闭了");
//                }
@@ -145,6 +150,7 @@
        DCUniMPSDK.getInstance().setOnUniMPEventCallBack(new IOnUniMPEventCallBack() {
            @Override
            public void onUniMPEventReceive(String appid, String event, Object data, DCUniMPJSCallback callback) {
                HDLUniMPSDKManager.uinEnabled=true;
//                handelUniMPEventReceive(appid, event, data, callback);
                HdlLogLogic.print("收到小程序通知    event=" + event);
//                String processMessage = Process.myPid() + " ";
@@ -213,6 +219,55 @@
     */
    public Boolean isInitialize() {
        return DCUniMPSDK.getInstance().isInitialize();
    }
    /**
     * 检查当前小程序组件是否正在运行
     *
     * @return true表示正在运行,false表示未运行
     */
    public Boolean isRuning() {
        Log.d(TAG,"isRuning");
        if (this.getUniMP() == null) {
            return false;
        }
        return this.getUniMP().isRuning();
    }
    /**
     * 显示已创建的小程序组件
     *
     * @return 通常与 hideUniMP() 配对使用,用于控制组件的可见性
     */
    public Boolean showUniMP() {
        Log.d(TAG,"showUniMP");
        if (this.getUniMP() == null) {
            return false;
        }
        return this.getUniMP().showUniMP();
    }
    /**
     * 隐藏当前显示的小程序组件
     *
     * @return 隐藏后组件仍在后台运行,可以快速重新显示
     */
    public Boolean hideUniMP() {
        Log.d(TAG,"hideUniMP");
        if (this.getUniMP() == null) {
            return false;
        }
        return this.getUniMP().hideUniMP();
    }
    /**
     * 完全关闭并销毁小程序组件实例(与hide的区别,close会释放资源,而hide只是暂时隐藏)
     *
     * @return
     */
    public Boolean closeUniMP() {
        Log.d(TAG,"closeUniMP");
        if (this.getUniMP() == null) {
            return false;
        }
        return this.getUniMP().closeUniMP();
    }
@@ -387,9 +442,9 @@
        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);