wjc
2023-06-28 14de918a79943e4961b09fa01ed320c6cad41f2e
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 {
@@ -243,12 +244,13 @@
    /**
     * 打开小程序
     *
     * @param uniAppId 小程序ID
     * @param path     指定路径
     *                 例:pages/component/scroll-view/scroll-view?a=1&b=2&c=3
     * @param callBack 监听小程序OtherUniMPEvent事件
     * @param uniAppId   小程序ID
     * @param path       指定路径
     *                   例:pages/component/scroll-view/scroll-view?a=1&b=2&c=3
     * @param jsonObject 附加数据
     * @param callBack   监听小程序OtherUniMPEvent事件
     */
    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, "小程序ID 不能为空");
@@ -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);
@@ -317,9 +320,9 @@
        }
        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) {