@lazycatcloud/sdk 0.1.144 → 0.1.146

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.
Files changed (58) hide show
  1. package/dist/common/media_meta.js +2 -2
  2. package/dist/common/media_meta.js.map +1 -1
  3. package/dist/extentions/app_common.d.ts.map +1 -1
  4. package/dist/extentions/app_common.js +43 -18
  5. package/dist/extentions/app_common.js.map +1 -1
  6. package/dist/extentions/base.d.ts +2 -2
  7. package/dist/extentions/base.d.ts.map +1 -1
  8. package/dist/extentions/base.js +3 -3
  9. package/dist/extentions/base.js.map +1 -1
  10. package/dist/package.json +10 -2
  11. package/package.json +10 -2
  12. package/common/box.ts +0 -545
  13. package/common/browseronly.ts +0 -520
  14. package/common/end_device.ts +0 -635
  15. package/common/file_handler.ts +0 -485
  16. package/common/filetrans.ts +0 -1936
  17. package/common/gateway.ts +0 -663
  18. package/common/media_meta.ts +0 -319
  19. package/common/message.ts +0 -242
  20. package/common/peripheral_device.ts +0 -783
  21. package/common/security_context.ts +0 -729
  22. package/common/users.ts +0 -1044
  23. package/dlna/dlna.ts +0 -895
  24. package/docs/contribute.md +0 -40
  25. package/docs/extentions/AppCommon.md +0 -30
  26. package/extentions/app_common.ts +0 -63
  27. package/extentions/base.ts +0 -459
  28. package/extentions/index.ts +0 -27
  29. package/extentions/safe_app.ts +0 -60
  30. package/extentions/unsafe_app.ts +0 -107
  31. package/google/protobuf/descriptor.ts +0 -3778
  32. package/google/protobuf/empty.ts +0 -64
  33. package/google/protobuf/timestamp.ts +0 -214
  34. package/grpcweb.ts +0 -106
  35. package/index.ts +0 -204
  36. package/lanforward/lanforward.ts +0 -301
  37. package/localdevice/clipboard.ts +0 -499
  38. package/localdevice/config.ts +0 -268
  39. package/localdevice/device.ts +0 -218
  40. package/localdevice/dialog.ts +0 -707
  41. package/localdevice/local-launch.ts +0 -954
  42. package/localdevice/network.ts +0 -273
  43. package/localdevice/permission.ts +0 -733
  44. package/localdevice/photo.ts +0 -1497
  45. package/ssdp/ssdp.ts +0 -332
  46. package/sys/OS_daemon.ts +0 -325
  47. package/sys/OS_snapshot.ts +0 -1714
  48. package/sys/OS_upgrader.ts +0 -782
  49. package/sys/btrfs.ts +0 -530
  50. package/sys/devopt.ts +0 -250
  51. package/sys/event.ts +0 -787
  52. package/sys/hc-core/hc-core.ts +0 -1582
  53. package/sys/ingress.ts +0 -953
  54. package/sys/network_manager.ts +0 -874
  55. package/sys/package_manager.ts +0 -1931
  56. package/sys/portal-server/portal-server.ts +0 -2934
  57. package/sys/snapd.ts +0 -861
  58. package/tsconfig.json +0 -15
@@ -1,40 +0,0 @@
1
- <!--
2
- * @Author: Bin
3
- * @Date: 2023-03-06
4
- * @FilePath: /lzc-sdk/lang/js/docs/contribute.md
5
- -->
6
- # 懒猫云客户端 SDK 部分贡献指南
7
-
8
- > 该部分文档主要针对 SDK 开发者(内部)对接沟通使用。
9
-
10
- ## 准备开发
11
-
12
- 1. `lzc sdk` 开发目录 `./extentions`,目前 SDK 主要对象为 `LzcAppSdk`,该对象为一个单例。调用 `LzcAppSdk.getInstance()` 函数即可获得对象实例。
13
-
14
- 2. `LzcAppSdk` 内置工具函数如下 [更多函数参考 base.ts 代码](../extentions/base.ts):
15
- - isWebShell() 判断是否属于 webshell 环境
16
- - isAndroidWebShell() 是否是android webshell 环境
17
- - isPCWebShell() 是否是pc webshell 环境
18
- - isIosWebShell() 是否是ios webshell 环境
19
- - isControlView() 是否属于 Control webshell 环境
20
- - isContentView() 是否属于 Content webshell 环境
21
- - isInApplication() 是否在客户端内
22
-
23
- 3. 通过 `LzcAppSdk` 获取原生(Android、iOS、PC)JSBridge 对象引用,由于部分平台(对,没错就是 iOS)特性获取 JSBridge 方式提供了异步和同步获取两种方式。(注: IOS 在调用 `useNative()` 获取到的 JSBridge 引用对象是缓存对象,如果未初始化完就调用可能会出现调用失败情况,所以类似 `GetValue()` 这种需要返回值的实现请一定一定尽量使用 `useNativeAsync()` 来获取 JSBridge 引用对象。)
24
- - useNativeAsync(namespaces?: any)
25
- - useNative(namespaces?: any)
26
-
27
- 4. `@native` 装饰器,为了避免跨平台调用函数导致页面异常问题,请实现函数时尽量使用该装饰器声明其支持的平台,对于不支持的平台该装饰器会自动处理替换为空函数实现。平台类型参数如下
28
- - LzcAppPlatformType.Android
29
- - LzcAppPlatformType.IOS
30
- - LzcAppPlatformType.PC
31
- - LzcAppPlatformType.Browser
32
-
33
- 5. 关于如何实现一个支持全平台的 SDK API 最佳实践请参考 [app_common.ts](../extentions/app_common.ts)
34
-
35
- 6. `LzcAppSdk` 提供回调函数处理实现请参考 [关于如何实现回调函数](#关于如何实现回调函数)
36
-
37
-
38
- ## 关于如何实现回调函数
39
-
40
- 文档整理中(🕊️)…
@@ -1,30 +0,0 @@
1
- <!--
2
- * @Author: Bin
3
- * @Date: 2023-03-06
4
- * @FilePath: /lzc-sdk/lang/js/docs/extentions/AppCommon.md
5
- -->
6
- # 懒猫云应用通用能力开发文档
7
-
8
-
9
- ## 打开应用能力接口文档
10
-
11
- 在部分场景下,用户在使用懒猫云应用的时候需要启动其他应用来完成任务。为此我们提供为懒猫云应用了打开应用能力以满足应用打开其他应用处理数据或完成任务的需求。打开应用能力面向开发者提供懒猫云应用唤起功能,通过打开应用能力开发者可安全便捷地使用懒猫云客户端或系统的能力,为懒猫云用户或设备使用者提供良好的用户体验。
12
-
13
- ### 使用步骤
14
-
15
- 1. 引入 SDK, 支持使用 CMD 标准模块加载方法加载
16
- ```
17
- import { AppCommon } from '@lazycatcloud/sdk/dist/extentions';
18
- ```
19
-
20
- 2. 调用 `AppCommon.LaunchApp` 函数
21
- ```
22
- AppCommon.LaunchApp("http://settings.pbkbin.heiyu.space/?path=/users/bin/download/", "pbkbin.heiyu.space");
23
- ```
24
-
25
- ### 调用参数
26
-
27
- | 名称 | 必填 | 默认值 | 备注 |
28
- | --- | --- | --- | --- |
29
- | url | 是 | | 懒猫云应用 URL,可通过 URL Parameter 方式携带参数
30
- | appid | 是 | | 懒猫云应用 appid
@@ -1,63 +0,0 @@
1
- import LzcAppSdk, { LzcAppPlatformType, LzcAppSdkManage, native } from './base';
2
-
3
- class AppCommon extends LzcAppSdkManage {
4
-
5
- @native(LzcAppPlatformType.IOS)
6
- public static async ScriptHandlers(): Promise<string[]> {
7
- // const callback = await LzcAppSdk.useNative.ScriptHandlers()
8
- // console.log("LzcAppSdk.useNative", LzcAppSdk.useNative);
9
- const jsBridge = await LzcAppSdk.useNativeAsync()
10
- const call = await jsBridge.ScriptHandlers()
11
- // jsBridge.Test()
12
- return call
13
- }
14
-
15
- /**
16
- * @description: 打开应用
17
- * @param {string} url
18
- * @param {string} appid
19
- * @return {Promise<void>}
20
- */
21
- @native(LzcAppPlatformType.IOS,
22
- LzcAppPlatformType.Android,
23
- LzcAppPlatformType.PC,
24
- LzcAppPlatformType.Browser
25
- )
26
- public static async LaunchApp(url: string, appid: string): Promise<void> {
27
- if (!LzcAppSdk.isInApplication()) {
28
- // 判断是否在浏览器中,在浏览器中时或者用户设置为在浏览器打开时,将直接使用 window.open 打开页面
29
- window.open(url, '_blank')
30
- } else {
31
- if(LzcAppSdk.isAndroidWebShell()){
32
- const jsBridge = await LzcAppSdk.useNativeAsync(android_launch_service)
33
- const openApprequest = {
34
- "appid": appid,
35
- "url": url,
36
- }
37
- var openAppRequestJsonStr = JSON.stringify(openApprequest);
38
- jsBridge.LaunchApp(openAppRequestJsonStr)
39
- }else{
40
- const jsBridge = await LzcAppSdk.useNativeAsync()
41
- jsBridge.LaunchApp(url, appid)
42
- }
43
- }
44
- }
45
-
46
- public static async LaunchNativeApp(filepath: string,appid: string) {
47
- // TODO: 待实现
48
- if(LzcAppSdk.isAndroidWebShell()){
49
- const jsBridge = await LzcAppSdk.useNativeAsync(android_launch_service)
50
- const openApprequest = {
51
- "appid": appid,
52
- "filepath": filepath,
53
- }
54
- var requestStr = JSON.stringify(openApprequest);
55
- jsBridge.LaunchNativeApp(requestStr)
56
- }else{
57
- console.error("LaunchNativeApp 方法暂未实现。")
58
- }
59
- }
60
-
61
- }
62
-
63
- export { AppCommon }
@@ -1,459 +0,0 @@
1
- /*
2
- * @Author: Bin
3
- * @Date: 2023-03-03
4
- * @FilePath: /lzc-sdk/lang/js/extentions/base.ts
5
- */
6
-
7
- enum PlatformType {
8
- Android,
9
- IOS,
10
- PC,
11
- Browser
12
- }
13
-
14
- // 不支持的平台 notSupportPlatform
15
- function disabled(...platforms: PlatformType[]) {
16
- // console.log("PlatformType", list);
17
- return function (target: any, propertyKey: string, descriptor: PropertyDescriptor) {
18
- if (!(target.constructor === LzcAppSdk)) {
19
- console.error("LzcAppSdk:", `notSupportPlatform error ${target.constructor}`)
20
- return
21
- }
22
-
23
- let notSupport = false;
24
- platforms.forEach((item: PlatformType) => {
25
- switch (item) {
26
- case PlatformType.Android:
27
- notSupport = target.isAndroidWebShell();
28
- return
29
- case PlatformType.IOS:
30
- notSupport = target.isIosWebShell();
31
- return
32
- case PlatformType.PC:
33
- notSupport = target.isPCWebShell();
34
- return
35
- case PlatformType.Browser:
36
- notSupport = !(target.isWebShell());
37
- return
38
- }
39
- });
40
-
41
- if (notSupport) {
42
- descriptor.value = ((...args: any) => {
43
- console.error("LzcAppSdk:", `The current platform does not support the ${propertyKey} method`)
44
- })
45
- }
46
-
47
- // console.log("target", target);
48
- // console.log("propertyKey", propertyKey);
49
- // console.log("descriptor", descriptor);
50
-
51
- return descriptor;
52
- };
53
- }
54
-
55
- /**
56
- * @description: 指定函数支持平台函数装饰器
57
- * @param {array} platforms
58
- * @return {Function}
59
- */
60
- function native(...platforms: PlatformType[]): Function {
61
- return function (target: Object, propertyKey: string, descriptor: PropertyDescriptor) {
62
- const lzcSdk = LzcAppSdk.getInstance()
63
- if (!lzcSdk) {
64
- console.error("LzcAppSdk:", `instance is null`)
65
- return
66
- }
67
-
68
- let support = false;
69
- platforms.forEach((item: PlatformType) => {
70
- if (support) {
71
- return
72
- }
73
- switch (item) {
74
- case PlatformType.Android:
75
- support = lzcSdk.isAndroidWebShell();
76
- return
77
- case PlatformType.IOS:
78
- support = lzcSdk.isIosWebShell();
79
- return
80
- case PlatformType.PC:
81
- support = lzcSdk.isPCWebShell();
82
- return
83
- case PlatformType.Browser:
84
- support = !(lzcSdk.isInApplication());
85
- return
86
- }
87
- });
88
-
89
- const method = descriptor.value;
90
- // console.log("!!method ", method);
91
- descriptor.value = new Proxy(descriptor.value, {
92
- apply(target, thisArg, argArray) {
93
- // console.log("!!method apply", Object.prototype.toString.call(target));
94
- if (support) {
95
- // 当前函数支持该平台,调用函数实现
96
- return target.apply(thisArg, argArray)
97
- }
98
-
99
- // 当前函数不支持该平台,替换执行空函数体
100
- console.warn("LzcAppSdk:", `The current platform does not support the ${propertyKey} method`)
101
- if (Object.prototype.toString.call(target) === "[object AsyncFunction]") {
102
- // AsyncFunction
103
- return (async function () { })()
104
- } else {
105
- // Function
106
- return (() => { })()
107
- }
108
- },
109
- })
110
-
111
- // if (!support) {
112
- // console.error("LzcAppSdk:", `The current platform does not support the ${propertyKey} method`)
113
- // let fun = method
114
-
115
- // if (!!method && typeof method.then === 'function') {
116
- // descriptor.value = (...args: any) => { }
117
- // fun = method.then
118
- // } else {
119
- // descriptor.value = async (...args: any) => { }
120
- // }
121
-
122
- // return descriptor
123
- // }
124
-
125
- // TODO: 处理 Native 函数注入拉平
126
- // let useNative = {}
127
- // useNative = new Proxy(useNative, {
128
- // get(target, prop, receiver) {
129
-
130
- // let item = target[prop]
131
- // let nativeClient = LzcAppSdk.getInstance().client
132
- // // let nativeClient = {
133
- // // open: async () => {
134
- // // console.log("useNative open.....");
135
- // // },
136
- // // getValue: async (name: String) => {
137
- // // console.log("useNative open.....");
138
- // // return name + ", emmmm"
139
- // // }
140
- // // }
141
-
142
- // // console.log("target", target);
143
- // // console.log("prop", prop);
144
- // // console.log("receiver", receiver);
145
-
146
- // if (nativeClient) {
147
- // // 原生注入对象存在
148
- // let nativeAttribute = nativeClient[prop]
149
- // if (!item && nativeAttribute) {
150
- // // 原生注入对象包含该属性/方法
151
- // item = nativeAttribute
152
- // if (typeof nativeAttribute == "function") {
153
- // // 原生注入的是函数,准备拦截
154
- // item = new Proxy<any>(item, {
155
- // apply(target, thisArg, argArray) {
156
- // return target(...argArray);
157
- // },
158
- // })
159
- // }
160
- // }
161
- // }
162
-
163
- // // 拦截不存在的原生函数调用并提示警告
164
- // if (!item && (!nativeClient || !nativeClient[prop])) {
165
- // item = function (...params: any[]) { }
166
- // console.warn("LzcAppSdk:", `The ${String(prop)} method is not implemented on the current platform`)
167
- // }
168
-
169
- // return item
170
- // },
171
- // })
172
-
173
- // lzcSdk.useNative = useNative
174
-
175
- // descriptor.value = Promise.resolve(function (...args: any) {
176
- // // console.log("应用", target);
177
- // const context = Object.assign(target, this instanceof LzcAppSdk ? {} : { LzcApp: lzcSdk })
178
- // method.apply(context, ...args);
179
- // // method(...args)
180
- // })
181
-
182
- // console.log("target", target);
183
- // console.log("propertyKey", propertyKey);
184
- // console.log("descriptor", descriptor);
185
- return descriptor
186
- };
187
- }
188
-
189
- class LzcAppSdk {
190
- private static instance: LzcAppSdk;
191
- private static cacheJSBridgeIOS: any; // 缓存 IOS JSBridge
192
-
193
- protected constructor() {
194
- // 初始化 JSBridge 回调事件队列
195
- this.initCallbackQueue();
196
- (async () => {
197
- if (this.isIosWebShell()) {
198
- // 由于 IOS JSBridge 需要异步获取,构造对象时触发缓存 JSBridgeIOS 对象
199
- LzcAppSdk.cacheJSBridgeIOS = await LzcAppSdk.initJSBridgeIOS()
200
- }
201
- })();
202
-
203
- // 缓存 LzcAppSdk 对象应用到 window 对象
204
- if (!window.lzcAppSdk_client || window.lzcAppSdk_client !== this) {
205
- window.lzcAppSdk_client = this;
206
- }
207
-
208
- }
209
-
210
- /**
211
- * @description: 获取 LzcAppSdk 对象实例
212
- * @return {LzcAppSdk}
213
- */
214
- public static getInstance(): LzcAppSdk {
215
- if (!LzcAppSdk.instance) {
216
- LzcAppSdk.instance = new LzcAppSdk()
217
- }
218
- return LzcAppSdk.instance
219
- }
220
-
221
- /**
222
- * @description: 初始化 JSBridge 全局回调队列
223
- * @return {void}
224
- */
225
- private initCallbackQueue(): void {
226
- if (!window.lzcAppSdk_responseCallBackFuncDict || !window.lzcAppSdk_responseCallBackFuncUniqueID) {
227
- // 初始化回调方法存储器和索引ID
228
- window.lzcAppSdk_responseCallBackFuncDict = {}
229
- window.lzcAppSdk_responseCallBackFuncUniqueID = 1;
230
- }
231
-
232
- if (
233
- !window.lzcAppSdk_sendCallBackFunc ||
234
- window.lzcAppSdk_sendCallBackFunc != LzcAppSdk.sendCallBackFunc
235
- ) {
236
- window.lzcAppSdk_sendCallBackFunc = LzcAppSdk.sendCallBackFunc
237
- }
238
- }
239
-
240
- /**
241
- * @description: JS 调用原生函数时,添加回调方法到回调方法存储器,并返回索引ID
242
- * @param {Function} responseCallBackFunc
243
- * @return {string}
244
- */
245
- public static addToCallBackFuncDictWith(responseCallBackFunc: Function): string {
246
- if (!responseCallBackFunc) return 'unValid_funcUniqueID'
247
- var funcUniqueID = `lzc_${window.lzcAppSdk_responseCallBackFuncUniqueID++}_${new Date().getTime()}`
248
- window.lzcAppSdk_responseCallBackFuncDict[funcUniqueID] =
249
- responseCallBackFunc
250
- return funcUniqueID
251
- }
252
-
253
-
254
- /**
255
- * @description: 原生接受 JS 调用并处理相关操作后,发送回调给js, js 根据索引ID寻找回调方法来处理数据,然后移除js的回调方法
256
- * @param {string} funcUniqueID
257
- * @param {any} responseData
258
- * @return {void}
259
- */
260
- public static sendCallBackFunc(
261
- funcUniqueID: string,
262
- responseData: any
263
- ): void {
264
- if (!funcUniqueID) return
265
- const responseCallBackFunc =
266
- window.lzcAppSdk_responseCallBackFuncDict[funcUniqueID]
267
- if (!responseCallBackFunc) return
268
- responseCallBackFunc(responseData)
269
- delete window.lzcAppSdk_responseCallBackFuncDict[funcUniqueID]
270
- }
271
-
272
- /**
273
- * @description: 注册一个 JS 函数
274
- * @param {string} name
275
- * @return {Promise<any> | undefined}
276
- */
277
- private static async _registerCallBackFunc(name: string): Promise<any> | undefined {
278
- if (!name) return null
279
- return async function (...args: any[]) {
280
- let returnData = undefined
281
- const funcUniqueID = LzcAppSdk.addToCallBackFuncDictWith(function (
282
- data: any
283
- ) {
284
- returnData = data
285
- })
286
-
287
- const func = window.webkit.messageHandlers[name]
288
- if (!func) {
289
- console.error(
290
- 'LzcAppSdk:',
291
- `ios webshell ${name} injection failed.`
292
- )
293
- return returnData
294
- }
295
- const value = await func.postMessage({
296
- funcUniqueID,
297
- params: [...args],
298
- })
299
- return value || returnData
300
- }
301
- }
302
-
303
- /**
304
- * @description: 获取 IOS 原生 JSBridge 对象
305
- * @return {Promise<any>}
306
- */
307
- // @native(PlatformType.IOS)
308
- private static async initJSBridgeIOS(): Promise<any> {
309
- let view: any = {}
310
- if (LzcAppSdk.cacheJSBridgeIOS) {
311
- view = LzcAppSdk.cacheJSBridgeIOS
312
- }
313
- view['ScriptHandlers'] = await LzcAppSdk._registerCallBackFunc('ScriptHandlers')
314
- const handlers = await view.ScriptHandlers()
315
- try {
316
- const data = typeof handlers == 'string' ? JSON.parse(handlers) : handlers
317
- if (!data || data.length < 1) {
318
- throw new Error('ios webshell ScriptHandlers handlers error.')
319
- }
320
- } catch (error) {
321
- console.error('LzcAppSdk: ', error)
322
- return
323
- }
324
-
325
- // 注册全部可用函数
326
- for (const key in handlers) {
327
- if (!handlers[key]) continue
328
- view[handlers[key]] = await LzcAppSdk._registerCallBackFunc(handlers[key])
329
- }
330
-
331
- // 缓存 IOS JSBridge 对象
332
- if (!LzcAppSdk.cacheJSBridgeIOS || (
333
- view &&
334
- Object.keys(view).length > 0 &&
335
- LzcAppSdk.cacheJSBridgeIOS !== view
336
- )) {
337
- LzcAppSdk.cacheJSBridgeIOS = view
338
- }
339
-
340
- return view
341
- }
342
-
343
- /**
344
- * @description: 根据原生注入命名空间 异步获取 JSBridge
345
- * @param {any} namespaces
346
- * @return {Promise<any>}
347
- */
348
- public async useNativeAsync(namespaces?: any): Promise<any> {
349
- namespaces = this.useNative(namespaces)
350
- if (this.isIosWebShell()) {
351
- // ios JSBridge 是异步注入的,强制使用最新的
352
- namespaces = await LzcAppSdk.initJSBridgeIOS();
353
- }
354
- return namespaces
355
- }
356
-
357
- /**
358
- * @description: 根据原生注入命名空间 同步获取 JSBridge (如调用原生方法不需要回调值的可以使用该函数获取原生对象否则最好使用 useNativeAsync 函数)
359
- * @param {any} namespaces
360
- * @return {any}
361
- */
362
- public useNative(namespaces?: any): any {
363
- if (!namespaces) {
364
- let defaultNamespaces = {}
365
- if (this.isIosWebShell() && LzcAppSdk.cacheJSBridgeIOS) {
366
- LzcAppSdk.initJSBridgeIOS(); // 触发刷新缓存 ios JSBridge
367
- defaultNamespaces = LzcAppSdk.cacheJSBridgeIOS
368
- }
369
- if (this.isAndroidWebShell()) {
370
- defaultNamespaces = android
371
- }
372
- if (this.isPCWebShell()) {
373
- defaultNamespaces = window.electronAPI
374
- }
375
- namespaces = defaultNamespaces
376
- }
377
-
378
- // TODO: 应该代理 JSBridge 对象函数调用,避免出现异常
379
- if (!namespaces) {
380
- console.warn("LzcAppSdk", "Does not exist JSBridge namespaces.")
381
- namespaces = {}
382
- }
383
-
384
- return namespaces
385
- }
386
-
387
- /**
388
- * @description: 判断是否属于 webshell 环境
389
- * @return {boolean}
390
- */
391
- public isWebShell(): boolean {
392
- return navigator.userAgent.indexOf("Lazycat") != -1 && !this.isControlView() && !this.isContentView();
393
- }
394
-
395
- /**
396
- * @description: 是否是android webshell 环境
397
- * @return {boolean}
398
- */
399
- public isAndroidWebShell(): boolean {
400
- return navigator.userAgent.indexOf("Lazycat_101") != -1;
401
- }
402
-
403
- /**
404
- * @description: 是否是pc webshell 环境
405
- * @return {boolean}
406
- */
407
- public isPCWebShell(): boolean {
408
- return navigator.userAgent.indexOf("Lazycat_102") != -1;
409
- }
410
-
411
- /**
412
- * @description: 是否是ios webshell 环境
413
- * @return {boolean}
414
- */
415
- public isIosWebShell(): boolean {
416
- return navigator.userAgent.indexOf("Lazycat_103") != -1;
417
- }
418
-
419
- /**
420
- * @description: 是否属于 Control webshell 环境
421
- * @return {boolean}
422
- */
423
- public isControlView(): boolean {
424
- return navigator.userAgent.indexOf("Lazycat_ControlView") != -1;
425
- }
426
-
427
- /**
428
- * @description: 是否属于 Content webshell 环境
429
- * @return {boolean}
430
- */
431
- public isContentView(): boolean {
432
- return navigator.userAgent.indexOf("Lazycat_ContentView") != -1;
433
- }
434
-
435
- /**
436
- * @description: 是否在客户端内
437
- * @return {boolean}
438
- */
439
- public isInApplication(): boolean {
440
- return navigator.userAgent.indexOf('Lazycat_Client') != -1
441
- }
442
- }
443
-
444
- class LzcAppSdkManage {
445
- protected static LzcApp: LzcAppSdk
446
- protected LzcApp: LzcAppSdk
447
- }
448
-
449
- const LzcApp = LzcAppSdk.getInstance()
450
-
451
- /**
452
- * @description: 兼容旧的 android 注入的 js 调用(待迁移后删除改引用)
453
- * @deprecated: 该 JS 注入引用即将弃用,请尽快适配最新的 LzcAppSdk.useNative() 调用方式
454
- * @return {any}
455
- */
456
- const LzcClient: any = LzcApp.useNative()
457
-
458
- export default LzcApp
459
- export { PlatformType as LzcAppPlatformType, LzcAppSdkManage, LzcClient, native }
@@ -1,27 +0,0 @@
1
- import { lzcAPIGateway } from './../index';
2
- /*
3
- * @Author: Bin
4
- * @Date: 2023-03-03
5
- * @FilePath: /lzc-sdk/lang/js/extentions/index.ts
6
- */
7
-
8
- import LzcApp from './base';
9
-
10
- declare global {
11
- interface Window {
12
- electronAPI?: any
13
- webkit?: any
14
- lzcAppSdk_responseCallBackFuncDict?: any
15
- lzcAppSdk_responseCallBackFuncUniqueID?: any
16
- lzcAppSdk_sendCallBackFunc?: any
17
- lzcAppSdk_client?: any
18
- }
19
- const android: any
20
- const android_launch_service: any
21
- }
22
- export default LzcApp
23
- export { LzcAppPlatformType, LzcClient } from './base'
24
- export { AppCommon } from './app_common'
25
-
26
- export { LzcApp }
27
-
@@ -1,60 +0,0 @@
1
- import App, { LzcClient } from './base';
2
-
3
- // 横屏
4
- const SCREEN_ORIENTATION_SENSOR_PORTRAIT = 1
5
- // 横向屏幕
6
- const SCREEN_ORIENTATION_SENSOR_LANDSCAPE = 2
7
-
8
- export const SAFE = {
9
- // h5调用webview 打开App
10
- OpenApp: function (url, isFullScreen) {
11
- if (App.isWebShell()) {
12
- return
13
- }
14
- LzcClient.OpenApp(url, isFullScreen)
15
- },
16
- // 目前只支持android
17
- // 设置指定key 对应的value
18
- SetValue: function (key, value) {
19
- LzcClient.SetValue(key, value)
20
- },
21
- // 获取指定key的value
22
- // 目前只支持android
23
- GetValue: function (key) {
24
- return LzcClient.GetValue(key)
25
- },
26
- // 目前只支持android
27
- // 方向请使用常量
28
- SetScreenOrientation: function (ori) {
29
- LzcClient.SetScreenOrientation(ori)
30
- },
31
- // 最大255的亮度
32
- SetScreentBrightness(number) {
33
- LzcClient.SetScreentBrightness(number);
34
- },
35
- // 获取当前屏幕亮度百分比(0~1)
36
- GetScreenBrightNess() {
37
- return LzcClient.GetScreenBrightNess()
38
- },
39
- // 获取当前音量
40
- GetCurrentVolume() {
41
- return LzcClient.GetCurrentVolume();
42
- },
43
- // 设置指定音量
44
- SetVoice(num) {
45
- LzcClient.SetVoice(num);
46
- },
47
- // 增加音量
48
- AddVoice() {
49
- LzcClient.AddVoice()
50
- },
51
- SubVoice() {
52
- LzcClient.SubVoice();
53
- },
54
- CloseWindow() {
55
- LzcClient.CloseWindow
56
- },
57
- Minimize() {
58
- LzcClient.Minimize();
59
- }
60
- }