@lambo-design-mobile/lambo-js-bridge 1.0.0-beta.16 → 1.0.0-beta.17
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/CHANGELOG.md +8 -0
- package/demo/index.vue +1 -1
- package/package.json +1 -1
- package/src/sdk/LamboJsBridge.js +7 -1
- package/src/sdk/YunTuAdapter.js +2 -30
package/CHANGELOG.md
CHANGED
|
@@ -1,4 +1,12 @@
|
|
|
1
1
|
# Changelog
|
|
2
|
+
## [1.0.0-beta.17](http://git.inspur.com/ecbh/lambo-design/lambo-design/-/compare/@lambo-design-mobile/lambo-js-bridge@1.0.0-beta.16...@lambo-design-mobile/lambo-js-bridge@1.0.0-beta.17) (2024-11-25)
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
### ✨ Features | 新功能
|
|
6
|
+
|
|
7
|
+
* **@lambo-design-mobile/js-bridge:** 修改插件初始化方法 ([dc998de](http://git.inspur.com/ecbh/lambo-design/lambo-design/-/commit/dc998de7a6c6ec6e5e5ba82b2620ac66d1855b90))
|
|
8
|
+
* **@lambo-design-mobile/js-bridge:** 修改插件初始化方法 ([802474e](http://git.inspur.com/ecbh/lambo-design/lambo-design/-/commit/802474e1486410af622fd198097e065afc0c7b11))
|
|
9
|
+
|
|
2
10
|
## [1.0.0-beta.16](http://git.inspur.com/ecbh/lambo-design/lambo-design/-/compare/@lambo-design-mobile/lambo-js-bridge@1.0.0-beta.15...@lambo-design-mobile/lambo-js-bridge@1.0.0-beta.16) (2024-11-12)
|
|
3
11
|
|
|
4
12
|
|
package/demo/index.vue
CHANGED
|
@@ -89,7 +89,7 @@ export default {
|
|
|
89
89
|
};
|
|
90
90
|
this.$lamboJsBridge = new LamboJsBridge(options);
|
|
91
91
|
await this.getPlatform();
|
|
92
|
-
await this.$lamboJsBridge.initializePlugin(options.pluginConfig);
|
|
92
|
+
// await this.$lamboJsBridge.initializePlugin(options.pluginConfig);
|
|
93
93
|
},
|
|
94
94
|
methods: {
|
|
95
95
|
async getPlatform() {
|
package/package.json
CHANGED
package/src/sdk/LamboJsBridge.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
/* eslint-disable prefer-destructuring */
|
|
1
2
|
import WechatAdapter from './WechatAdapter';
|
|
2
3
|
import DingTalkAdapter from './DingTalkAdapter';
|
|
3
4
|
import CordovaAdapter from './CordovaAdapter';
|
|
@@ -12,7 +13,12 @@ class LamboJsBridge {
|
|
|
12
13
|
}
|
|
13
14
|
|
|
14
15
|
_detectPlatform(param) {
|
|
15
|
-
|
|
16
|
+
let userAgent;
|
|
17
|
+
if (param.userAgent) {
|
|
18
|
+
userAgent = param.userAgent;
|
|
19
|
+
} else {
|
|
20
|
+
userAgent = navigator.userAgent.toLowerCase();
|
|
21
|
+
}
|
|
16
22
|
if (/wxwork/.test(userAgent)) {
|
|
17
23
|
this.platform = new WeComAdapter(param);
|
|
18
24
|
} else if (/micromessenger/.test(userAgent)) {
|
package/src/sdk/YunTuAdapter.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import './yuntu';
|
|
2
2
|
|
|
3
3
|
class YunTuAdapter {
|
|
4
|
-
constructor() {
|
|
4
|
+
constructor(options) {
|
|
5
5
|
// 标志插件是否已初始化
|
|
6
6
|
this.isInitialized = false;
|
|
7
|
-
|
|
7
|
+
this.initializePlugin(options.pluginConfig);
|
|
8
8
|
}
|
|
9
9
|
|
|
10
10
|
async initializePlugin(pluginConfig) {
|
|
@@ -32,10 +32,6 @@ class YunTuAdapter {
|
|
|
32
32
|
}
|
|
33
33
|
|
|
34
34
|
async getLocation(options) {
|
|
35
|
-
if (!this.isInitialized) {
|
|
36
|
-
await this.initializePlugin(); // 确保插件初始化
|
|
37
|
-
}
|
|
38
|
-
|
|
39
35
|
return new Promise((resolve, reject) => {
|
|
40
36
|
|
|
41
37
|
if (window.top.geolocation && typeof window.top.geolocation.getCurrentPosition === 'function') {
|
|
@@ -59,10 +55,6 @@ class YunTuAdapter {
|
|
|
59
55
|
}
|
|
60
56
|
|
|
61
57
|
async openLocation(options) {
|
|
62
|
-
if (!this.isInitialized) {
|
|
63
|
-
await this.initializePlugin(); // 确保插件初始化
|
|
64
|
-
}
|
|
65
|
-
|
|
66
58
|
return new Promise((resolve, reject) => {
|
|
67
59
|
if (window.top.geolocation && typeof window.top.geolocation.openLocation === 'function') {
|
|
68
60
|
console.log("1")
|
|
@@ -90,10 +82,6 @@ class YunTuAdapter {
|
|
|
90
82
|
}
|
|
91
83
|
|
|
92
84
|
async scanCode(options) {
|
|
93
|
-
if (!this.isInitialized) {
|
|
94
|
-
await this.initializePlugin(); // 确保插件初始化
|
|
95
|
-
}
|
|
96
|
-
|
|
97
85
|
return new Promise((resolve, reject) => {
|
|
98
86
|
if (window.top.scanCode && typeof window.top.scanCode.startScan === 'function') {
|
|
99
87
|
window.top.scanCode.startScan(
|
|
@@ -116,10 +104,6 @@ class YunTuAdapter {
|
|
|
116
104
|
}
|
|
117
105
|
|
|
118
106
|
async localAuthPlugin(options) {
|
|
119
|
-
if (!this.isInitialized) {
|
|
120
|
-
await this.initializePlugin(); // 确保插件初始化
|
|
121
|
-
}
|
|
122
|
-
|
|
123
107
|
return new Promise((resolve, reject) => {
|
|
124
108
|
if (window.top.localAuthPlugin && typeof window.top.localAuthPlugin.auth === 'function') {
|
|
125
109
|
window.top.localAuthPlugin.auth(
|
|
@@ -142,10 +126,6 @@ class YunTuAdapter {
|
|
|
142
126
|
}
|
|
143
127
|
|
|
144
128
|
async getAvailableBiometrics(options) {
|
|
145
|
-
if (!this.isInitialized) {
|
|
146
|
-
await this.initializePlugin(); // 确保插件初始化
|
|
147
|
-
}
|
|
148
|
-
|
|
149
129
|
return new Promise((resolve, reject) => {
|
|
150
130
|
if (window.top.localAuthPlugin && typeof window.top.localAuthPlugin.getAvailableBiometrics === 'function') {
|
|
151
131
|
window.top.localAuthPlugin.getAvailableBiometrics(
|
|
@@ -171,10 +151,6 @@ class YunTuAdapter {
|
|
|
171
151
|
async takePhoto(options) {
|
|
172
152
|
console.log('YunTu: Taking photo with options', options);
|
|
173
153
|
|
|
174
|
-
if (!this.isInitialized) {
|
|
175
|
-
await this.initializePlugin(); // 确保插件初始化
|
|
176
|
-
}
|
|
177
|
-
|
|
178
154
|
return new Promise((resolve, reject) => {
|
|
179
155
|
if (window.top.imagePicker) {
|
|
180
156
|
const sourceType = options && options.sourceType === 'gallery' ? 'gallery' : 'camera';
|
|
@@ -208,10 +184,6 @@ class YunTuAdapter {
|
|
|
208
184
|
async filePreview(options) {
|
|
209
185
|
console.log('YunTu: File preview with options', options);
|
|
210
186
|
|
|
211
|
-
if (!this.isInitialized) {
|
|
212
|
-
await this.initializePlugin(); // Ensure the plugin is initialized
|
|
213
|
-
}
|
|
214
|
-
|
|
215
187
|
return new Promise((resolve, reject) => {
|
|
216
188
|
if (window.top.filePreview && typeof window.top.filePreview.openFile === 'function') {
|
|
217
189
|
window.top.filePreview.openFile(
|