| | |
| | | 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 { |
| | |
| | | /** |
| | | * 打开小程序 |
| | | * |
| | | * @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 不能为空"); |
| | |
| | | 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); |
| | |
| | | } |
| | | 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) { |