mix-public 1.1.9 → 1.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -26,7 +26,7 @@
26
26
  mixProjectType: mixProjectType, // 项目类型: 在服务端创建的项目标识
27
27
  mixVersion: mixVersion, // 项目版本号: 服务端的版本标识
28
28
  mixAppKey: mixAppKey, // appKey: 当前APPKey
29
- mixApptype: mixApptype, // app类型: web android ios
29
+ mixApptype: mixApptype, // app类型: web/app
30
30
  mixDeviceInfo: mixDeviceInfo // 项目版本号: 服务端的版本标识
31
31
  });
32
32
  import 'mix-public/mixRender.css'; // 引入web端app基础样式
@@ -36,7 +36,8 @@
36
36
  import mixRender from "mix-public"
37
37
  const PublicLib = mixRender({
38
38
  mixJustMethod: true,
39
- mixApptype: apptype, // app类型: web android ios
39
+ mixApptype: apptype, // app类型: web/app
40
+ mixVersion: mixVersion, // 项目版本号: 服务端的版本标识
40
41
  });
41
42
  ```
42
43
 
@@ -92,3 +93,4 @@
92
93
  - v1.1.7 添加文档模板/部分 web 实现添加
93
94
  - v1.1.8 添加核心方法TS配置,部分方法修复/部分方法吗规范统一
94
95
  - v1.1.9 添加视频下载/视频预览/音频录制方法
96
+ - v1.2.0 ios方法调用调整/安卓方法兼容性调整
@@ -61,9 +61,9 @@ export const asyncReturnMethod = (op: callMethodType & asyncReturnMethodType): P
61
61
  callMethod({
62
62
  environment,
63
63
  methodName,
64
- androidMethod: () => { androidMethod && androidMethod().then((data: any) => { window[callBackMethodName](data) }).catch((err: any) => { window[callBackMethodName](err) }) },
65
- iosMethod: () => { iosMethod && iosMethod().then((data: any) => { window[callBackMethodName](data) }).catch((err: any) => { window[callBackMethodName](err) }) },
66
- webMethod: () => { webMethod && webMethod().then((data: any) => { window[callBackMethodName](data) }).catch((err: any) => { window[callBackMethodName](err) }) },
64
+ androidMethod: androidMethod ? () => { androidMethod().then((data: any) => { window[callBackMethodName](data) }).catch((err: any) => { window[callBackMethodName](err) }) } : false,
65
+ iosMethod: iosMethod ? () => { iosMethod().then((data: any) => { window[callBackMethodName](data) }).catch((err: any) => { window[callBackMethodName](err) }) } : false,
66
+ webMethod: webMethod ? () => { webMethod().then((data: any) => { window[callBackMethodName](data) }).catch((err: any) => { window[callBackMethodName](err) }) } : false,
67
67
  params
68
68
  })
69
69
  return new Promise((resolve, reject) => {
@@ -90,7 +90,7 @@ export const callMethod = (op: callMethodType): void => {
90
90
  webMethod && webMethod();
91
91
  } else {
92
92
  if (isAndroid || isHarmony) {
93
- androidMethod ? androidMethod(mixJsonStringify(params)) : window.Func[methodName](mixJsonStringify(params));
93
+ androidMethod ? androidMethod(mixJsonStringify(params)) : Object.keys(params).length > 0 ? window.Func[methodName](mixJsonStringify(params)) : window.Func[methodName]();
94
94
  } else if (isIOS) {
95
95
  iosMethod ? iosMethod(mixJsonStringify(params)) : window.webkit.messageHandlers[methodName].postMessage(
96
96
  mixJsonStringify(params)
@@ -130,13 +130,13 @@ export const syncReturnMethod = (op: callMethodType & syncReturnMethod & asyncRe
130
130
  window["MIX_APP_" + methodName] = (data: any) => {
131
131
  resolve(data)
132
132
  }
133
- androidMethod ? resolve(androidMethod()) : window.Func[methodName](mixJsonStringify(params))
133
+ androidMethod ? resolve(androidMethod()) : Object.keys(params).length > 0 ? window.Func[methodName](mixJsonStringify(params)) : window.Func[methodName]()
134
134
  } catch (error) {
135
135
  reject(error)
136
136
  }
137
137
  })
138
138
  } else {
139
- result = androidMethod ? androidMethod() : window.Func[methodName](mixJsonStringify(params));
139
+ result = androidMethod ? androidMethod() : Object.keys(params).length > 0 ? window.Func[methodName](mixJsonStringify(params)) : window.Func[methodName]();
140
140
  }
141
141
  } else if (isIOS) {
142
142
  if (asyncReturn) {
@@ -2714,7 +2714,7 @@ export const mixPublicLib = (op: mixPublicLibParamsType): any => {
2714
2714
  const MethodName = "VideoDownload"
2715
2715
  callMethod({
2716
2716
  environment: this.environment,
2717
- methodName: "PlayVideo",
2717
+ methodName: "VideoDownload",
2718
2718
  webMethod: () => {
2719
2719
  let progress = 0
2720
2720
  const timer = setInterval(() => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mix-public",
3
- "version": "1.1.9",
3
+ "version": "1.2.0",
4
4
  "description": "use mix-app",
5
5
  "main": "mixRender.js",
6
6
  "scripts": {