@ray-js/api 0.5.4 → 0.5.6-beta-1
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/@types/BaseKit.d.ts +1009 -65
- package/@types/{TYKit.d.ts → BizKit.d.ts} +69 -42
- package/@types/DeviceKit.d.ts +788 -1564
- package/@types/MiniKit.d.ts +381 -26
- package/@types/all-kits.d.ts +1 -1
- package/lib/{BaseKit-2.3.11.d.ts → BaseKit-2.5.1-anonymize.2.d.ts} +18 -1
- package/lib/{BaseKit-2.3.11.js → BaseKit-2.5.1-anonymize.2.js} +18 -1
- package/lib/BizKit-2.4.6-rc.101.d.ts +40 -0
- package/lib/{TYKit-2.2.6.js → BizKit-2.4.6-rc.101.js} +1 -1
- package/lib/{DeviceKit-2.3.3.d.ts → DeviceKit-2.5.2-anonymize.1.d.ts} +43 -56
- package/lib/{DeviceKit-2.3.3.wechat.js → DeviceKit-2.5.2-anonymize.1.js} +85 -124
- package/lib/{MiniKit-2.4.3.d.ts → MiniKit-4.4.0-anonymize.4.d.ts} +14 -0
- package/lib/{MiniKit-2.4.3.wechat.js → MiniKit-4.4.0-anonymize.4.js} +14 -0
- package/lib/all-kits.d.ts +5 -5
- package/lib/all-kits.js +5 -5
- package/lib/getApp/index.native.js +4 -0
- package/lib/getBoundingClientRect/index.js +26 -1
- package/lib/getCurrentPages/index.native.js +5 -0
- package/lib/getElementById/index.native.js +13 -0
- package/lib/getI18nInfo/index.native.js +9 -0
- package/lib/hideNotification/index.native.js +7 -0
- package/lib/hideTabBar/index.native.js +2 -0
- package/lib/navigateBack/index.native.js +2 -0
- package/lib/navigateTo/index.native.js +2 -0
- package/lib/reLaunch/index.native.js +2 -0
- package/lib/readFileSync/index.native.js +8 -0
- package/lib/redirectTo/index.native.js +2 -0
- package/lib/requestCloud/index.native.js +8 -0
- package/lib/setNavigationBarColor/index.native.js +2 -0
- package/lib/setNavigationBarTitle/index.native.js +2 -0
- package/lib/showTabBar/index.native.js +2 -0
- package/lib/switchTab/index.native.js +2 -0
- package/package.json +8 -8
- package/lib/BaseKit-2.3.11.android.js +0 -1
- package/lib/BaseKit-2.3.11.ios.js +0 -1
- package/lib/BaseKit-2.3.11.tuya.js +0 -66
- package/lib/BaseKit-2.3.11.web.js +0 -66
- package/lib/BaseKit-2.3.11.wechat.js +0 -66
- package/lib/DeviceKit-2.3.3.android.js +0 -1
- package/lib/DeviceKit-2.3.3.ios.js +0 -1
- package/lib/DeviceKit-2.3.3.js +0 -407
- package/lib/DeviceKit-2.3.3.tuya.js +0 -407
- package/lib/DeviceKit-2.3.3.web.js +0 -407
- package/lib/MiniKit-2.4.3.android.js +0 -1
- package/lib/MiniKit-2.4.3.ios.js +0 -1
- package/lib/MiniKit-2.4.3.js +0 -43
- package/lib/MiniKit-2.4.3.tuya.js +0 -43
- package/lib/MiniKit-2.4.3.web.js +0 -43
- package/lib/TYKit-2.2.6.android.js +0 -1
- package/lib/TYKit-2.2.6.d.ts +0 -40
- package/lib/TYKit-2.2.6.ios.js +0 -1
- package/lib/TYKit-2.2.6.tuya.js +0 -53
- package/lib/TYKit-2.2.6.web.js +0 -53
- package/lib/TYKit-2.2.6.wechat.js +0 -53
- package/lib/all-kits.android.js +0 -1
- package/lib/all-kits.ios.js +0 -1
- package/lib/all-kits.tuya.js +0 -6
- package/lib/all-kits.web.js +0 -6
- package/lib/all-kits.wechat.js +0 -6
- package/lib/core/index.android.js +0 -1
- package/lib/core/index.ios.js +0 -1
- package/lib/core/index.tuya.js +0 -1
- package/lib/core/index.web.js +0 -1
- package/lib/core/index.wechat.js +0 -1
- package/lib/core/promisify/index.android.js +0 -1
- package/lib/core/promisify/index.ios.js +0 -1
- package/lib/core/promisify/index.tuya.js +0 -27
- package/lib/core/promisify/index.web.js +0 -27
- package/lib/core/promisify/index.wechat.js +0 -27
- package/lib/getApp/index.android.js +0 -1
- package/lib/getApp/index.ios.js +0 -1
- package/lib/getApp/index.web.js +0 -4
- package/lib/getBoundingClientRect/index.android.js +0 -1
- package/lib/getBoundingClientRect/index.ios.js +0 -1
- package/lib/getBoundingClientRect/index.web.js +0 -26
- package/lib/getCurrentPages/index.android.js +0 -1
- package/lib/getCurrentPages/index.ios.js +0 -1
- package/lib/getCurrentPages/index.web.js +0 -4
- package/lib/getElementById/index.android.js +0 -1
- package/lib/getElementById/index.ios.js +0 -1
- package/lib/getElementById/index.web.js +0 -7
- package/lib/getI18nInfo/index.android.js +0 -1
- package/lib/getI18nInfo/index.ios.js +0 -1
- package/lib/getI18nInfo/index.web.js +0 -4
- package/lib/hideNotification/index.android.js +0 -1
- package/lib/hideNotification/index.ios.js +0 -1
- package/lib/hideNotification/index.tuya.js +0 -3
- package/lib/hideNotification/index.web.js +0 -3
- package/lib/hideNotification/index.wechat.js +0 -3
- package/lib/hideTabBar/index.android.js +0 -1
- package/lib/hideTabBar/index.ios.js +0 -1
- package/lib/hideTabBar/index.web.js +0 -4
- package/lib/index.android.js +0 -1
- package/lib/index.ios.js +0 -1
- package/lib/index.tuya.js +0 -20
- package/lib/index.web.js +0 -20
- package/lib/index.wechat.js +0 -20
- package/lib/navigateBack/index.android.js +0 -1
- package/lib/navigateBack/index.ios.js +0 -1
- package/lib/navigateBack/index.web.js +0 -14
- package/lib/navigateTo/index.android.js +0 -1
- package/lib/navigateTo/index.ios.js +0 -1
- package/lib/navigateTo/index.web.js +0 -11
- package/lib/reLaunch/index.android.js +0 -1
- package/lib/reLaunch/index.ios.js +0 -1
- package/lib/reLaunch/index.web.js +0 -11
- package/lib/readFileSync/index.android.js +0 -1
- package/lib/readFileSync/index.ios.js +0 -1
- package/lib/readFileSync/index.web.js +0 -6
- package/lib/redirectTo/index.android.js +0 -1
- package/lib/redirectTo/index.ios.js +0 -1
- package/lib/redirectTo/index.web.js +0 -13
- package/lib/requestCloud/index.android.js +0 -1
- package/lib/requestCloud/index.ios.js +0 -1
- package/lib/requestCloud/index.web.js +0 -7
- package/lib/setNavigationBarColor/index.android.js +0 -1
- package/lib/setNavigationBarColor/index.ios.js +0 -1
- package/lib/setNavigationBarColor/index.web.js +0 -11
- package/lib/setNavigationBarTitle/index.android.js +0 -1
- package/lib/setNavigationBarTitle/index.ios.js +0 -1
- package/lib/setNavigationBarTitle/index.web.js +0 -11
- package/lib/showNotification/index.android.js +0 -1
- package/lib/showNotification/index.ios.js +0 -1
- package/lib/showNotification/index.tuya.js +0 -3
- package/lib/showNotification/index.web.js +0 -3
- package/lib/showNotification/index.wechat.js +0 -3
- package/lib/showTabBar/index.android.js +0 -1
- package/lib/showTabBar/index.ios.js +0 -1
- package/lib/showTabBar/index.web.js +0 -4
- package/lib/switchTab/index.android.js +0 -1
- package/lib/switchTab/index.ios.js +0 -1
- package/lib/switchTab/index.web.js +0 -11
- package/lib/utils.android.js +0 -1
- package/lib/utils.ios.js +0 -1
- package/lib/utils.tuya.js +0 -21
- package/lib/utils.web.js +0 -21
- package/lib/utils.wechat.js +0 -20
package/@types/BaseKit.d.ts
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
/**
|
2
2
|
* BaseKit
|
3
3
|
*
|
4
|
-
* @version 2.
|
4
|
+
* @version 2.5.1-anonymize.2
|
5
5
|
*/
|
6
6
|
declare namespace ty {
|
7
7
|
/**
|
@@ -38,6 +38,27 @@ declare namespace ty {
|
|
38
38
|
}) => void
|
39
39
|
}): void
|
40
40
|
|
41
|
+
/**
|
42
|
+
* 获取音频文件时长信息
|
43
|
+
*/
|
44
|
+
export function getAudioFileDuration(params: {
|
45
|
+
/** 音频文件路径 */
|
46
|
+
path: string
|
47
|
+
complete?: () => void
|
48
|
+
success?: (params: {
|
49
|
+
/** 音频时长 */
|
50
|
+
duration: number
|
51
|
+
}) => void
|
52
|
+
fail?: (params: {
|
53
|
+
errorMsg: string
|
54
|
+
errorCode: string | number
|
55
|
+
innerError: {
|
56
|
+
errorCode: string | number
|
57
|
+
errorMsg: string
|
58
|
+
}
|
59
|
+
}) => void
|
60
|
+
}): void
|
61
|
+
|
41
62
|
/**
|
42
63
|
* 权限请求方法
|
43
64
|
*/
|
@@ -102,6 +123,8 @@ declare namespace ty {
|
|
102
123
|
appId?: string
|
103
124
|
/** 打开的页面路径,如果为空则打开首页,path 中 ? 后面的部分会成为 query,在小程序的 `App.onLaunch`、`App.onShow` 和 `Page.onLoad` 的回调函数 */
|
104
125
|
path?: string
|
126
|
+
/** 打开小程序的转场方式,分为right|bottom,指代水平和竖直方向 */
|
127
|
+
position?: string
|
105
128
|
/** 传递给目标小程序的数据,目标小程序可在 `App.onLaunch`,`App.onShow` 中获取到这份数据 */
|
106
129
|
extraData?: Record<string, any>
|
107
130
|
/** 要打开的小程序版本。仅在当前小程序为开发版或体验版时此参数有效。如果当前小程序是正式版,则打开的小程序必定是正式版 */
|
@@ -186,33 +209,6 @@ declare namespace ty {
|
|
186
209
|
}) => void
|
187
210
|
}): void
|
188
211
|
|
189
|
-
/**
|
190
|
-
* 读取本地文件内容
|
191
|
-
*/
|
192
|
-
export function readFile(params: {
|
193
|
-
/** 要写入的文件路径 (本地路径) */
|
194
|
-
filePath: string
|
195
|
-
/** 指定读取文件的字符编码,如果不传 encoding,则以 ArrayBuffer 格式读取文件的二进制内容 */
|
196
|
-
encoding: string
|
197
|
-
/** 从文件指定位置开始读,如果不指定,则从文件头开始读。读取的范围应该是左闭右开区间 [position, position+length)。有效范围:[0, fileLength - 1]。单位:byte */
|
198
|
-
position: number
|
199
|
-
/** 指定文件的长度,如果不指定,则读到文件末尾。有效范围:[1, fileLength]。单位:byte */
|
200
|
-
length: number
|
201
|
-
complete?: () => void
|
202
|
-
success?: (params: {
|
203
|
-
/** 文件内容 */
|
204
|
-
data: string
|
205
|
-
}) => void
|
206
|
-
fail?: (params: {
|
207
|
-
errorMsg: string
|
208
|
-
errorCode: string | number
|
209
|
-
innerError: {
|
210
|
-
errorCode: string | number
|
211
|
-
errorMsg: string
|
212
|
-
}
|
213
|
-
}) => void
|
214
|
-
}): void
|
215
|
-
|
216
212
|
/**
|
217
213
|
* 获取通用缓存路径
|
218
214
|
*/
|
@@ -267,7 +263,10 @@ declare namespace ty {
|
|
267
263
|
}): void
|
268
264
|
|
269
265
|
/**
|
270
|
-
*
|
266
|
+
* 从本地相册选择图片或使用相机拍照, 可用chooseMedia替代此方法
|
267
|
+
*
|
268
|
+
*权限:[scope.camera, scope.writePhotosAlbum]
|
269
|
+
*关联API:[chooseMedia]
|
271
270
|
*/
|
272
271
|
export function chooseImage(params?: {
|
273
272
|
/** 最多可以选择的图片张数 */
|
@@ -293,6 +292,52 @@ declare namespace ty {
|
|
293
292
|
}) => void
|
294
293
|
}): void
|
295
294
|
|
295
|
+
/**
|
296
|
+
* 拍摄或从手机相册中选择图片或视频
|
297
|
+
*
|
298
|
+
*权限:[scope.camera, scope.writePhotosAlbum]
|
299
|
+
*/
|
300
|
+
export function chooseMedia(params?: {
|
301
|
+
/** 最多可以选择的文件数 */
|
302
|
+
count?: number
|
303
|
+
/**
|
304
|
+
* 选择类型, 默认图片
|
305
|
+
* 'image' 只能拍摄图片或从相册选择图片
|
306
|
+
* 'video' 只能拍摄视频或从相册选择视频
|
307
|
+
*/
|
308
|
+
mediaType?: string
|
309
|
+
/**
|
310
|
+
* 图片和视频选择的来源, 默认['album', 'camera']
|
311
|
+
* 'album' 从相册选择
|
312
|
+
* 'camera' 使用相机拍摄
|
313
|
+
*/
|
314
|
+
sourceType?: string[]
|
315
|
+
/**
|
316
|
+
* 拍摄视频最长拍摄时间,单位秒。默认10s
|
317
|
+
* 时间范围为 3s 至 60s 之间。不限制相册。
|
318
|
+
*/
|
319
|
+
maxDuration?: number
|
320
|
+
complete?: () => void
|
321
|
+
success?: (params: {
|
322
|
+
/**
|
323
|
+
* 文件类型
|
324
|
+
* 'image' 图片
|
325
|
+
* 'video' 视频
|
326
|
+
*/
|
327
|
+
type: string
|
328
|
+
/** 本地临时文件列表 */
|
329
|
+
tempFiles?: TempMediaFileCB[]
|
330
|
+
}) => void
|
331
|
+
fail?: (params: {
|
332
|
+
errorMsg: string
|
333
|
+
errorCode: string | number
|
334
|
+
innerError: {
|
335
|
+
errorCode: string | number
|
336
|
+
errorMsg: string
|
337
|
+
}
|
338
|
+
}) => void
|
339
|
+
}): void
|
340
|
+
|
296
341
|
/**
|
297
342
|
* 从本地相册选择图片或使用相机拍照(可裁剪)
|
298
343
|
*/
|
@@ -334,6 +379,116 @@ declare namespace ty {
|
|
334
379
|
}) => void
|
335
380
|
}): void
|
336
381
|
|
382
|
+
/**
|
383
|
+
* 获取图片信息
|
384
|
+
*/
|
385
|
+
export function getImageInfo(params: {
|
386
|
+
/** 图片的路径,支持网络路径、本地路径 */
|
387
|
+
src: string
|
388
|
+
complete?: () => void
|
389
|
+
success?: (params: {
|
390
|
+
/** 图片原始宽度,单位px。不考虑旋转。 */
|
391
|
+
width: number
|
392
|
+
/** 图片原始高度,单位px。不考虑旋转。 */
|
393
|
+
height: number
|
394
|
+
/**
|
395
|
+
* 拍照时设备方向
|
396
|
+
* 合法值 说明
|
397
|
+
* up 默认方向(手机横持拍照),对应 Exif 中的 1。或无 orientation 信息。
|
398
|
+
* up-mirrored 同 up,但镜像翻转,对应 Exif 中的 2
|
399
|
+
* down 旋转180度,对应 Exif 中的 3
|
400
|
+
* down-mirrored 同 down,但镜像翻转,对应 Exif 中的 4
|
401
|
+
* left-mirrored 同 left,但镜像翻转,对应 Exif 中的 5
|
402
|
+
* right 顺时针旋转90度,对应 Exif 中的 6
|
403
|
+
* right-mirrored 同 right,但镜像翻转,对应 Exif 中的 7
|
404
|
+
* left 逆时针旋转90度,对应 Exif 中的 8
|
405
|
+
*/
|
406
|
+
orientation: string
|
407
|
+
/**
|
408
|
+
* 图片格式。
|
409
|
+
* 合法值 说明
|
410
|
+
* unknown 未知格式
|
411
|
+
* jpeg jpeg压缩格式
|
412
|
+
* png png压缩格式
|
413
|
+
* gif gif压缩格式
|
414
|
+
* tiff tiff压缩格式
|
415
|
+
*/
|
416
|
+
type: string
|
417
|
+
}) => void
|
418
|
+
fail?: (params: {
|
419
|
+
errorMsg: string
|
420
|
+
errorCode: string | number
|
421
|
+
innerError: {
|
422
|
+
errorCode: string | number
|
423
|
+
errorMsg: string
|
424
|
+
}
|
425
|
+
}) => void
|
426
|
+
}): void
|
427
|
+
|
428
|
+
/**
|
429
|
+
* 获取视频信息
|
430
|
+
*/
|
431
|
+
export function getVideoInfo(params: {
|
432
|
+
/** 视频文件路径,可以是临时文件路径也可以是永久文件路径 */
|
433
|
+
src: string
|
434
|
+
complete?: () => void
|
435
|
+
success?: (params: {
|
436
|
+
/** 图片原始宽度,单位px。不考虑旋转。 */
|
437
|
+
width: number
|
438
|
+
/** 图片原始高度,单位px。不考虑旋转。 */
|
439
|
+
height: number
|
440
|
+
/**
|
441
|
+
* 画面方向
|
442
|
+
* 合法值 说明
|
443
|
+
* up 默认方向(手机横持拍照),对应 Exif 中的 1。或无 orientation 信息。
|
444
|
+
* up-mirrored 同 up,但镜像翻转,对应 Exif 中的 2
|
445
|
+
* down 旋转180度,对应 Exif 中的 3
|
446
|
+
* down-mirrored 同 down,但镜像翻转,对应 Exif 中的 4
|
447
|
+
* left-mirrored 同 left,但镜像翻转,对应 Exif 中的 5
|
448
|
+
* right 顺时针旋转90度,对应 Exif 中的 6
|
449
|
+
* right-mirrored 同 right,但镜像翻转,对应 Exif 中的 7
|
450
|
+
* left 逆时针旋转90度,对应 Exif 中的 8
|
451
|
+
*/
|
452
|
+
orientation: string
|
453
|
+
/** 视频格式 */
|
454
|
+
type: string
|
455
|
+
/** 视频时长 */
|
456
|
+
duration: number
|
457
|
+
/** 视频大小,单位 kB */
|
458
|
+
size: number
|
459
|
+
/** 视频帧率 */
|
460
|
+
fps: number
|
461
|
+
/** 视频码率,单位 kbps */
|
462
|
+
bitrate: number
|
463
|
+
}) => void
|
464
|
+
fail?: (params: {
|
465
|
+
errorMsg: string
|
466
|
+
errorCode: string | number
|
467
|
+
innerError: {
|
468
|
+
errorCode: string | number
|
469
|
+
errorMsg: string
|
470
|
+
}
|
471
|
+
}) => void
|
472
|
+
}): void
|
473
|
+
|
474
|
+
/**
|
475
|
+
* 保存视频到系统相册,支持mp4视频格式
|
476
|
+
*/
|
477
|
+
export function saveVideoToPhotosAlbum(params: {
|
478
|
+
/** 视频文件路径,可以是临时文件路径也可以是永久文件路径 (本地路径) */
|
479
|
+
filePath: string
|
480
|
+
complete?: () => void
|
481
|
+
success?: (params: null) => void
|
482
|
+
fail?: (params: {
|
483
|
+
errorMsg: string
|
484
|
+
errorCode: string | number
|
485
|
+
innerError: {
|
486
|
+
errorCode: string | number
|
487
|
+
errorMsg: string
|
488
|
+
}
|
489
|
+
}) => void
|
490
|
+
}): void
|
491
|
+
|
337
492
|
/**
|
338
493
|
* 显示消息提示框
|
339
494
|
*/
|
@@ -380,8 +535,6 @@ declare namespace ty {
|
|
380
535
|
confirmColor?: string
|
381
536
|
complete?: () => void
|
382
537
|
success?: (params: {
|
383
|
-
/** editable 为 true 时,用户输入的文本 */
|
384
|
-
content?: string
|
385
538
|
/** 为 true 时,表示用户点击了确定按钮 */
|
386
539
|
confirm: boolean
|
387
540
|
/** 为 true 时,表示用户点击了取消(用于 Android 系统区分点击蒙层关闭还是点击取消按钮关闭) */
|
@@ -398,7 +551,7 @@ declare namespace ty {
|
|
398
551
|
}): void
|
399
552
|
|
400
553
|
/**
|
401
|
-
* 显示 loading 提示框。需主动调用
|
554
|
+
* 显示 loading 提示框。需主动调用 thing.hideLoading 才能关闭提示框
|
402
555
|
*/
|
403
556
|
export function showLoading(params: {
|
404
557
|
/** 提示的内容 */
|
@@ -482,7 +635,14 @@ declare namespace ty {
|
|
482
635
|
phoneNumber: string
|
483
636
|
complete?: () => void
|
484
637
|
success?: (params: null) => void
|
485
|
-
fail?: (params: {
|
638
|
+
fail?: (params: {
|
639
|
+
errorMsg: string
|
640
|
+
errorCode: string | number
|
641
|
+
innerError: {
|
642
|
+
errorCode: string | number
|
643
|
+
errorMsg: string
|
644
|
+
}
|
645
|
+
}) => void
|
486
646
|
}): void
|
487
647
|
|
488
648
|
/**
|
@@ -493,7 +653,14 @@ declare namespace ty {
|
|
493
653
|
data: string
|
494
654
|
complete?: () => void
|
495
655
|
success?: (params: null) => void
|
496
|
-
fail?: (params: {
|
656
|
+
fail?: (params: {
|
657
|
+
errorMsg: string
|
658
|
+
errorCode: string | number
|
659
|
+
innerError: {
|
660
|
+
errorCode: string | number
|
661
|
+
errorMsg: string
|
662
|
+
}
|
663
|
+
}) => void
|
497
664
|
}): void
|
498
665
|
|
499
666
|
/**
|
@@ -505,7 +672,145 @@ declare namespace ty {
|
|
505
672
|
/** 剪贴板的内容 */
|
506
673
|
data: string
|
507
674
|
}) => void
|
508
|
-
fail?: (params: {
|
675
|
+
fail?: (params: {
|
676
|
+
errorMsg: string
|
677
|
+
errorCode: string | number
|
678
|
+
innerError: {
|
679
|
+
errorCode: string | number
|
680
|
+
errorMsg: string
|
681
|
+
}
|
682
|
+
}) => void
|
683
|
+
}): void
|
684
|
+
|
685
|
+
/**
|
686
|
+
* 设置系统音量
|
687
|
+
*
|
688
|
+
*错误码标注
|
689
|
+
*入参值范围超出 errorCode = 6, The volume value is invalid, it should be [0 - 1]
|
690
|
+
*/
|
691
|
+
export function updateVolume(params: {
|
692
|
+
/** 音量,阈值【0 - 1】 */
|
693
|
+
value: number
|
694
|
+
complete?: () => void
|
695
|
+
success?: (params: null) => void
|
696
|
+
fail?: (params: {
|
697
|
+
errorMsg: string
|
698
|
+
errorCode: string | number
|
699
|
+
innerError: {
|
700
|
+
errorCode: string | number
|
701
|
+
errorMsg: string
|
702
|
+
}
|
703
|
+
}) => void
|
704
|
+
}): void
|
705
|
+
|
706
|
+
/**
|
707
|
+
* 获取当前系统音量
|
708
|
+
*/
|
709
|
+
export function getCurrentVolume(params?: {
|
710
|
+
complete?: () => void
|
711
|
+
success?: (params: {
|
712
|
+
/** 音量,阈值【0 - 1】 */
|
713
|
+
value: number
|
714
|
+
}) => void
|
715
|
+
fail?: (params: {
|
716
|
+
errorMsg: string
|
717
|
+
errorCode: string | number
|
718
|
+
innerError: {
|
719
|
+
errorCode: string | number
|
720
|
+
errorMsg: string
|
721
|
+
}
|
722
|
+
}) => void
|
723
|
+
}): void
|
724
|
+
|
725
|
+
/**
|
726
|
+
* 注册系统音量监听
|
727
|
+
*
|
728
|
+
*关联API:[onSystemVolumeChangeEvent, unRegisterSystemVolumeChange]
|
729
|
+
*/
|
730
|
+
export function registerSystemVolumeChange(params?: {
|
731
|
+
complete?: () => void
|
732
|
+
success?: (params: null) => void
|
733
|
+
fail?: (params: {
|
734
|
+
errorMsg: string
|
735
|
+
errorCode: string | number
|
736
|
+
innerError: {
|
737
|
+
errorCode: string | number
|
738
|
+
errorMsg: string
|
739
|
+
}
|
740
|
+
}) => void
|
741
|
+
}): void
|
742
|
+
|
743
|
+
/**
|
744
|
+
* 取消注册系统音量监听
|
745
|
+
*
|
746
|
+
*关联API:[onSystemVolumeChangeEvent, registerSystemVolumeChange]
|
747
|
+
*/
|
748
|
+
export function unRegisterSystemVolumeChange(params?: {
|
749
|
+
complete?: () => void
|
750
|
+
success?: (params: null) => void
|
751
|
+
fail?: (params: {
|
752
|
+
errorMsg: string
|
753
|
+
errorCode: string | number
|
754
|
+
innerError: {
|
755
|
+
errorCode: string | number
|
756
|
+
errorMsg: string
|
757
|
+
}
|
758
|
+
}) => void
|
759
|
+
}): void
|
760
|
+
|
761
|
+
/**
|
762
|
+
* 获取设备设置
|
763
|
+
*/
|
764
|
+
export function getSystemSetting(params?: {
|
765
|
+
complete?: () => void
|
766
|
+
success?: (params: {
|
767
|
+
/** 蓝牙的系统开关,默认false */
|
768
|
+
bluetoothEnabled?: boolean
|
769
|
+
/** 地理位置的系统开关,默认false */
|
770
|
+
locationEnabled?: boolean
|
771
|
+
/** Wi-Fi 的系统开关,默认false */
|
772
|
+
wifiEnabled?: boolean
|
773
|
+
/**
|
774
|
+
* 设备方向, 默认竖屏
|
775
|
+
* 竖屏 = "portrait", 横屏 = "landscape"
|
776
|
+
*/
|
777
|
+
deviceOrientation?: string
|
778
|
+
}) => void
|
779
|
+
fail?: (params: {
|
780
|
+
errorMsg: string
|
781
|
+
errorCode: string | number
|
782
|
+
innerError: {
|
783
|
+
errorCode: string | number
|
784
|
+
errorMsg: string
|
785
|
+
}
|
786
|
+
}) => void
|
787
|
+
}): void
|
788
|
+
|
789
|
+
/**
|
790
|
+
* 获取设备基础信息
|
791
|
+
*/
|
792
|
+
export function getDeviceInfo(params?: {
|
793
|
+
complete?: () => void
|
794
|
+
success?: (params: {
|
795
|
+
/** 应用二进制接口类型(仅 Android 支持) */
|
796
|
+
abi: string
|
797
|
+
/** 设备品牌 */
|
798
|
+
brand: string
|
799
|
+
/** 设备型号。新机型刚推出一段时间会显示unknown。 */
|
800
|
+
model: string
|
801
|
+
/** 操作系统及版本 */
|
802
|
+
system: string
|
803
|
+
/** 客户端平台 */
|
804
|
+
platform: string
|
805
|
+
}) => void
|
806
|
+
fail?: (params: {
|
807
|
+
errorMsg: string
|
808
|
+
errorCode: string | number
|
809
|
+
innerError: {
|
810
|
+
errorCode: string | number
|
811
|
+
errorMsg: string
|
812
|
+
}
|
813
|
+
}) => void
|
509
814
|
}): void
|
510
815
|
|
511
816
|
/**
|
@@ -585,6 +890,76 @@ declare namespace ty {
|
|
585
890
|
deviceOrientation?: Orientation
|
586
891
|
}
|
587
892
|
|
893
|
+
/**
|
894
|
+
* 获取手机附近的Wi-Fi列表;列表数据通过onGetWifiList事件发送
|
895
|
+
*/
|
896
|
+
export function getWifiList(params?: {
|
897
|
+
complete?: () => void
|
898
|
+
success?: (params: null) => void
|
899
|
+
fail?: (params: {
|
900
|
+
errorMsg: string
|
901
|
+
errorCode: string | number
|
902
|
+
innerError: {
|
903
|
+
errorCode: string | number
|
904
|
+
errorMsg: string
|
905
|
+
}
|
906
|
+
}) => void
|
907
|
+
}): void
|
908
|
+
|
909
|
+
/**
|
910
|
+
* 获取当前连接的wifi信息
|
911
|
+
*iOS: 返回SSID和BSSID
|
912
|
+
*/
|
913
|
+
export function getConnectedWifi(params?: {
|
914
|
+
/**
|
915
|
+
* 是否需要返回部分 Wi-Fi 信息
|
916
|
+
* 安卓 thing.getConnectedWifi 若设置了 partialInfo:true ,将会返回只包含 SSID 属性的 WifiInfo 对象。
|
917
|
+
* iOS thing.getConnectedWifi 若设置了 partialInfo:true ,将会返回只包含 SSID、BSSID 属性的 WifiInfo 对象,且需要用户开启微信定位权限才能正确返回结果。
|
918
|
+
* 默认值:false
|
919
|
+
*/
|
920
|
+
partialInfo?: boolean
|
921
|
+
complete?: () => void
|
922
|
+
success?: (params: {
|
923
|
+
/** wifi的SSID */
|
924
|
+
SSID: string
|
925
|
+
/** wifi的BSSID */
|
926
|
+
BSSID: string
|
927
|
+
/** Wi-Fi 信号强度, 安卓取值 0 ~ 100 ,iOS 取值 0 ~ 1 ,值越大强度越大 */
|
928
|
+
signalStrength: number
|
929
|
+
/**
|
930
|
+
* Wi-Fi是否安全
|
931
|
+
* Android:Android系统12开始支持。
|
932
|
+
*/
|
933
|
+
secure: boolean
|
934
|
+
/** Wi-Fi 频段单位 MHz */
|
935
|
+
frequency: number
|
936
|
+
}) => void
|
937
|
+
fail?: (params: {
|
938
|
+
errorMsg: string
|
939
|
+
errorCode: string | number
|
940
|
+
innerError: {
|
941
|
+
errorCode: string | number
|
942
|
+
errorMsg: string
|
943
|
+
}
|
944
|
+
}) => void
|
945
|
+
}): void
|
946
|
+
|
947
|
+
/**
|
948
|
+
* 跳转系统蓝牙设置页 (仅Android)
|
949
|
+
*/
|
950
|
+
export function openSystemBluetoothSetting(params?: {
|
951
|
+
complete?: () => void
|
952
|
+
success?: (params: null) => void
|
953
|
+
fail?: (params: {
|
954
|
+
errorMsg: string
|
955
|
+
errorCode: string | number
|
956
|
+
innerError: {
|
957
|
+
errorCode: string | number
|
958
|
+
errorMsg: string
|
959
|
+
}
|
960
|
+
}) => void
|
961
|
+
}): void
|
962
|
+
|
588
963
|
/**
|
589
964
|
* 获取网络类型
|
590
965
|
*/
|
@@ -596,7 +971,14 @@ declare namespace ty {
|
|
596
971
|
/** 信号强弱,单位 dbm */
|
597
972
|
signalStrength: number
|
598
973
|
}) => void
|
599
|
-
fail?: (params: {
|
974
|
+
fail?: (params: {
|
975
|
+
errorMsg: string
|
976
|
+
errorCode: string | number
|
977
|
+
innerError: {
|
978
|
+
errorCode: string | number
|
979
|
+
errorMsg: string
|
980
|
+
}
|
981
|
+
}) => void
|
600
982
|
}): void
|
601
983
|
|
602
984
|
/**
|
@@ -817,13 +1199,39 @@ declare namespace ty {
|
|
817
1199
|
*/
|
818
1200
|
export function clearStorageSync(): null
|
819
1201
|
|
1202
|
+
/**
|
1203
|
+
* 系统音量监听通知事件
|
1204
|
+
*
|
1205
|
+
*关联API:[registerSystemVolumeChange, unRegisterSystemVolumeChange]
|
1206
|
+
*/
|
1207
|
+
export function onSystemVolumeChangeEvent(listener: (params: CurrentVolumeResponse) => void): void
|
1208
|
+
|
1209
|
+
/**
|
1210
|
+
* 取消监听:系统音量监听通知事件
|
1211
|
+
*
|
1212
|
+
*关联API:[registerSystemVolumeChange, unRegisterSystemVolumeChange]
|
1213
|
+
*/
|
1214
|
+
export function offSystemVolumeChangeEvent(
|
1215
|
+
listener: (params: CurrentVolumeResponse) => void
|
1216
|
+
): void
|
1217
|
+
|
1218
|
+
/**
|
1219
|
+
* 监听获取到 Wi-Fi 列表数据事件
|
1220
|
+
*/
|
1221
|
+
export function onGetWifiList(listener: (params: WifiListResponse) => void): void
|
1222
|
+
|
1223
|
+
/**
|
1224
|
+
* 取消监听:监听获取到 Wi-Fi 列表数据事件
|
1225
|
+
*/
|
1226
|
+
export function offGetWifiList(listener: (params: WifiListResponse) => void): void
|
1227
|
+
|
820
1228
|
/**
|
821
1229
|
* 持续录音事件
|
822
1230
|
*/
|
823
1231
|
export function onRecordingEvent(listener: (params: AudioRecordBufferBean) => void): void
|
824
1232
|
|
825
1233
|
/**
|
826
|
-
*
|
1234
|
+
* 取消监听:持续录音事件
|
827
1235
|
*/
|
828
1236
|
export function offRecordingEvent(listener: (params: AudioRecordBufferBean) => void): void
|
829
1237
|
|
@@ -1067,6 +1475,93 @@ declare namespace ty {
|
|
1067
1475
|
receivedBytedCount: number
|
1068
1476
|
}
|
1069
1477
|
|
1478
|
+
export type FileReadFileReqBean = {
|
1479
|
+
/** 要写入的文件路径 (本地路径) */
|
1480
|
+
filePath: string
|
1481
|
+
/**
|
1482
|
+
* 指定读取文件的字符编码。
|
1483
|
+
* 支持 utf8/ascii/base64。如果不传 encoding,默认utf8
|
1484
|
+
*/
|
1485
|
+
encoding?: string
|
1486
|
+
/** 从文件指定位置开始读,如果不指定,则从文件头开始读。读取的范围应该是左闭右开区间 [position, position+length)。有效范围:[0, fileLength - 1]。单位:byte */
|
1487
|
+
position?: number
|
1488
|
+
/** 指定文件的长度,如果不指定,则读到文件末尾。有效范围:[1, fileLength]。单位:byte */
|
1489
|
+
length?: number
|
1490
|
+
}
|
1491
|
+
|
1492
|
+
export type SaveFileSyncParams = {
|
1493
|
+
/** taskId */
|
1494
|
+
fileId: string
|
1495
|
+
/** 临时存储文件路径 */
|
1496
|
+
tempFilePath: string
|
1497
|
+
/** 要存储的文件路径 */
|
1498
|
+
filePath: string
|
1499
|
+
}
|
1500
|
+
|
1501
|
+
export type FileStats = {
|
1502
|
+
/** 文件的类型和存取的权限 */
|
1503
|
+
mode: string
|
1504
|
+
/** 文件大小,单位:B */
|
1505
|
+
size: number
|
1506
|
+
/** 文件最近一次被存取或被执行的时间,UNIX 时间戳 */
|
1507
|
+
lastAccessedTime: number
|
1508
|
+
/** 文件最后一次被修改的时间,UNIX 时间戳 */
|
1509
|
+
lastModifiedTime: number
|
1510
|
+
/** 当前文件是否一个目录 */
|
1511
|
+
isDirectory: boolean
|
1512
|
+
/** 当前文件是否一个普通文件 */
|
1513
|
+
isFile: boolean
|
1514
|
+
}
|
1515
|
+
|
1516
|
+
export type FileStatsParams = {
|
1517
|
+
/** taskId */
|
1518
|
+
fileId: string
|
1519
|
+
/** 文件/目录路径 (本地路径) */
|
1520
|
+
path: string
|
1521
|
+
/**
|
1522
|
+
* 是否递归获取目录下的每个文件的 Stats 信息
|
1523
|
+
* 默认值:false
|
1524
|
+
*/
|
1525
|
+
recursive?: boolean
|
1526
|
+
}
|
1527
|
+
|
1528
|
+
export type MakeDirParams = {
|
1529
|
+
/** taskId */
|
1530
|
+
fileId: string
|
1531
|
+
/** 创建的目录路径 (本地路径) */
|
1532
|
+
dirPath: string
|
1533
|
+
/**
|
1534
|
+
* 是否在递归创建该目录的上级目录后再创建该目录。如果对应的上级目录已经存在,则不创建该上级目录。
|
1535
|
+
* 如 dirPath 为 a/b/c/d 且 recursive 为 true,将创建 a 目录,再在 a 目录下创建 b 目录,
|
1536
|
+
* 以此类推直至创建 a/b/c 目录下的 d 目录。
|
1537
|
+
* 默认值:false
|
1538
|
+
*/
|
1539
|
+
recursive?: boolean
|
1540
|
+
}
|
1541
|
+
|
1542
|
+
export type RemoveDirParams = {
|
1543
|
+
/** taskId */
|
1544
|
+
fileId: string
|
1545
|
+
/** 要删除的目录路径 (本地路径) */
|
1546
|
+
dirPath: string
|
1547
|
+
/**
|
1548
|
+
* 是否递归删除目录。如果为 true,则删除该目录和该目录下的所有子目录以及文件。
|
1549
|
+
* 默认值:false
|
1550
|
+
*/
|
1551
|
+
recursive?: boolean
|
1552
|
+
}
|
1553
|
+
|
1554
|
+
export type WriteFileParams = {
|
1555
|
+
/** taskId */
|
1556
|
+
fileId: string
|
1557
|
+
/** 要写入的文件路径 (本地路径) */
|
1558
|
+
filePath: string
|
1559
|
+
/** 要写入的文本数据, 根据encoding编码 */
|
1560
|
+
data: string
|
1561
|
+
/** 指定写入文件的字符编码,目前支持【utf8、ascii、base64】, 默认utf8 */
|
1562
|
+
encoding?: string
|
1563
|
+
}
|
1564
|
+
|
1070
1565
|
export enum HTTPMethod {
|
1071
1566
|
/** HTTP 请求 OPTIONS */
|
1072
1567
|
OPTIONS = 'OPTIONS',
|
@@ -1133,6 +1628,27 @@ declare namespace ty {
|
|
1133
1628
|
size?: number
|
1134
1629
|
}
|
1135
1630
|
|
1631
|
+
export type TempMediaFileCB = {
|
1632
|
+
/** 本地临时文件路径 (本地路径) */
|
1633
|
+
tempFilePath: string
|
1634
|
+
/** 本地临时文件大小,单位 B */
|
1635
|
+
size: number
|
1636
|
+
/** 视频的时间长度 */
|
1637
|
+
duration: number
|
1638
|
+
/** 视频的高度 */
|
1639
|
+
height: number
|
1640
|
+
/** 视频的宽度 */
|
1641
|
+
width: number
|
1642
|
+
/** 视频缩略图临时文件路径 */
|
1643
|
+
thumbTempFilePath: string
|
1644
|
+
/**
|
1645
|
+
* 文件类型
|
1646
|
+
* 'image' 图片
|
1647
|
+
* 'video' 视频
|
1648
|
+
*/
|
1649
|
+
fileType: string
|
1650
|
+
}
|
1651
|
+
|
1136
1652
|
export type SafeArea = {
|
1137
1653
|
left: number
|
1138
1654
|
right: number
|
@@ -1166,11 +1682,36 @@ declare namespace ty {
|
|
1166
1682
|
key: string
|
1167
1683
|
}
|
1168
1684
|
|
1685
|
+
export type CurrentVolumeResponse = {
|
1686
|
+
/** 音量,阈值【0 - 1】 */
|
1687
|
+
value: number
|
1688
|
+
}
|
1689
|
+
|
1690
|
+
export type WifiListResponse = {
|
1691
|
+
/** Wi-Fi列表 */
|
1692
|
+
wifiList: WifiInfo[]
|
1693
|
+
}
|
1694
|
+
|
1169
1695
|
export type AudioRecordBufferBean = {
|
1170
1696
|
/** 数据流 */
|
1171
1697
|
buffer: number[]
|
1172
1698
|
}
|
1173
1699
|
|
1700
|
+
export type InnerAudioContext = {
|
1701
|
+
/** InnerAudioContext 对象 ContextId */
|
1702
|
+
contextId: string
|
1703
|
+
}
|
1704
|
+
|
1705
|
+
export type AudioFileParams = {
|
1706
|
+
/** 音频文件路径 */
|
1707
|
+
path: string
|
1708
|
+
}
|
1709
|
+
|
1710
|
+
export type AudioFileResponse = {
|
1711
|
+
/** 音频时长 */
|
1712
|
+
duration: number
|
1713
|
+
}
|
1714
|
+
|
1174
1715
|
export type InnerAudioBean = {
|
1175
1716
|
/**
|
1176
1717
|
* InnerAudioContext 对象 contextId
|
@@ -1195,12 +1736,7 @@ declare namespace ty {
|
|
1195
1736
|
/** InnerAudioContext 对象 ContextId */
|
1196
1737
|
contextId: string
|
1197
1738
|
/** 跳转的时间,单位 s。精确到小数点后 3 位,即支持 ms 级别精确度 */
|
1198
|
-
position?: number
|
1199
|
-
}
|
1200
|
-
|
1201
|
-
export type InnerAudioContext = {
|
1202
|
-
/** InnerAudioContext 对象 ContextId */
|
1203
|
-
contextId: string
|
1739
|
+
position?: number
|
1204
1740
|
}
|
1205
1741
|
|
1206
1742
|
export type AuthorizeBean = {
|
@@ -1223,6 +1759,8 @@ declare namespace ty {
|
|
1223
1759
|
appId?: string
|
1224
1760
|
/** 打开的页面路径,如果为空则打开首页,path 中 ? 后面的部分会成为 query,在小程序的 `App.onLaunch`、`App.onShow` 和 `Page.onLoad` 的回调函数 */
|
1225
1761
|
path?: string
|
1762
|
+
/** 打开小程序的转场方式,分为right|bottom,指代水平和竖直方向 */
|
1763
|
+
position?: string
|
1226
1764
|
/** 传递给目标小程序的数据,目标小程序可在 `App.onLaunch`,`App.onShow` 中获取到这份数据 */
|
1227
1765
|
extraData?: Record<string, any>
|
1228
1766
|
/** 要打开的小程序版本。仅在当前小程序为开发版或体验版时此参数有效。如果当前小程序是正式版,则打开的小程序必定是正式版 */
|
@@ -1265,15 +1803,9 @@ declare namespace ty {
|
|
1265
1803
|
requestId: string
|
1266
1804
|
}
|
1267
1805
|
|
1268
|
-
export type
|
1269
|
-
/**
|
1270
|
-
|
1271
|
-
/** 指定读取文件的字符编码,如果不传 encoding,则以 ArrayBuffer 格式读取文件的二进制内容 */
|
1272
|
-
encoding: string
|
1273
|
-
/** 从文件指定位置开始读,如果不指定,则从文件头开始读。读取的范围应该是左闭右开区间 [position, position+length)。有效范围:[0, fileLength - 1]。单位:byte */
|
1274
|
-
position: number
|
1275
|
-
/** 指定文件的长度,如果不指定,则读到文件末尾。有效范围:[1, fileLength]。单位:byte */
|
1276
|
-
length: number
|
1806
|
+
export type AccessFileParams = {
|
1807
|
+
/** 要判断是否存在的文件/目录路径 (本地路径) */
|
1808
|
+
path: string
|
1277
1809
|
}
|
1278
1810
|
|
1279
1811
|
export type ReadFileBean = {
|
@@ -1281,15 +1813,6 @@ declare namespace ty {
|
|
1281
1813
|
data: string
|
1282
1814
|
}
|
1283
1815
|
|
1284
|
-
export type SaveFileSyncParams = {
|
1285
|
-
/** taskId */
|
1286
|
-
fileId: string
|
1287
|
-
/** 临时存储文件路径 */
|
1288
|
-
tempFilePath: string
|
1289
|
-
/** 要存储的文件路径 */
|
1290
|
-
filePath: string
|
1291
|
-
}
|
1292
|
-
|
1293
1816
|
export type SaveFileSyncCallback = {
|
1294
1817
|
/** 【待废弃, 不建议使用】存储后的文件路径 */
|
1295
1818
|
savedFilePath: string
|
@@ -1300,6 +1823,18 @@ declare namespace ty {
|
|
1300
1823
|
tempDirectory: string
|
1301
1824
|
}
|
1302
1825
|
|
1826
|
+
export type FileStatsResponse = {
|
1827
|
+
/** 文件列表 */
|
1828
|
+
fileStatsList: FileStats[]
|
1829
|
+
}
|
1830
|
+
|
1831
|
+
export type RemoveFileParams = {
|
1832
|
+
/** taskId */
|
1833
|
+
fileId: string
|
1834
|
+
/** 需要删除的文件路径 (本地路径) */
|
1835
|
+
filePath: string
|
1836
|
+
}
|
1837
|
+
|
1303
1838
|
export type GyroscopeBean = {
|
1304
1839
|
/** 监听陀螺仪数据回调函数的执行频率 */
|
1305
1840
|
interval?: GyroscopeInterval
|
@@ -1321,6 +1856,39 @@ declare namespace ty {
|
|
1321
1856
|
tempFiles?: TempFileCB[]
|
1322
1857
|
}
|
1323
1858
|
|
1859
|
+
export type ChooseMediaBean = {
|
1860
|
+
/** 最多可以选择的文件数 */
|
1861
|
+
count?: number
|
1862
|
+
/**
|
1863
|
+
* 选择类型, 默认图片
|
1864
|
+
* 'image' 只能拍摄图片或从相册选择图片
|
1865
|
+
* 'video' 只能拍摄视频或从相册选择视频
|
1866
|
+
*/
|
1867
|
+
mediaType?: string
|
1868
|
+
/**
|
1869
|
+
* 图片和视频选择的来源, 默认['album', 'camera']
|
1870
|
+
* 'album' 从相册选择
|
1871
|
+
* 'camera' 使用相机拍摄
|
1872
|
+
*/
|
1873
|
+
sourceType?: string[]
|
1874
|
+
/**
|
1875
|
+
* 拍摄视频最长拍摄时间,单位秒。默认10s
|
1876
|
+
* 时间范围为 3s 至 60s 之间。不限制相册。
|
1877
|
+
*/
|
1878
|
+
maxDuration?: number
|
1879
|
+
}
|
1880
|
+
|
1881
|
+
export type ChooseMediaCB = {
|
1882
|
+
/**
|
1883
|
+
* 文件类型
|
1884
|
+
* 'image' 图片
|
1885
|
+
* 'video' 视频
|
1886
|
+
*/
|
1887
|
+
type: string
|
1888
|
+
/** 本地临时文件列表 */
|
1889
|
+
tempFiles?: TempMediaFileCB[]
|
1890
|
+
}
|
1891
|
+
|
1324
1892
|
export type ChooseCropImageBean = {
|
1325
1893
|
/** 选择图片的来源 ['album', 'camera'],默认都支持 */
|
1326
1894
|
sourceType?: string[]
|
@@ -1338,6 +1906,81 @@ declare namespace ty {
|
|
1338
1906
|
current: number
|
1339
1907
|
}
|
1340
1908
|
|
1909
|
+
export type GetImageInfoParams = {
|
1910
|
+
/** 图片的路径,支持网络路径、本地路径 */
|
1911
|
+
src: string
|
1912
|
+
}
|
1913
|
+
|
1914
|
+
export type ImageInfoCB = {
|
1915
|
+
/** 图片原始宽度,单位px。不考虑旋转。 */
|
1916
|
+
width: number
|
1917
|
+
/** 图片原始高度,单位px。不考虑旋转。 */
|
1918
|
+
height: number
|
1919
|
+
/**
|
1920
|
+
* 拍照时设备方向
|
1921
|
+
* 合法值 说明
|
1922
|
+
* up 默认方向(手机横持拍照),对应 Exif 中的 1。或无 orientation 信息。
|
1923
|
+
* up-mirrored 同 up,但镜像翻转,对应 Exif 中的 2
|
1924
|
+
* down 旋转180度,对应 Exif 中的 3
|
1925
|
+
* down-mirrored 同 down,但镜像翻转,对应 Exif 中的 4
|
1926
|
+
* left-mirrored 同 left,但镜像翻转,对应 Exif 中的 5
|
1927
|
+
* right 顺时针旋转90度,对应 Exif 中的 6
|
1928
|
+
* right-mirrored 同 right,但镜像翻转,对应 Exif 中的 7
|
1929
|
+
* left 逆时针旋转90度,对应 Exif 中的 8
|
1930
|
+
*/
|
1931
|
+
orientation: string
|
1932
|
+
/**
|
1933
|
+
* 图片格式。
|
1934
|
+
* 合法值 说明
|
1935
|
+
* unknown 未知格式
|
1936
|
+
* jpeg jpeg压缩格式
|
1937
|
+
* png png压缩格式
|
1938
|
+
* gif gif压缩格式
|
1939
|
+
* tiff tiff压缩格式
|
1940
|
+
*/
|
1941
|
+
type: string
|
1942
|
+
}
|
1943
|
+
|
1944
|
+
export type GetVideoInfoParams = {
|
1945
|
+
/** 视频文件路径,可以是临时文件路径也可以是永久文件路径 */
|
1946
|
+
src: string
|
1947
|
+
}
|
1948
|
+
|
1949
|
+
export type VideoInfoCB = {
|
1950
|
+
/** 图片原始宽度,单位px。不考虑旋转。 */
|
1951
|
+
width: number
|
1952
|
+
/** 图片原始高度,单位px。不考虑旋转。 */
|
1953
|
+
height: number
|
1954
|
+
/**
|
1955
|
+
* 画面方向
|
1956
|
+
* 合法值 说明
|
1957
|
+
* up 默认方向(手机横持拍照),对应 Exif 中的 1。或无 orientation 信息。
|
1958
|
+
* up-mirrored 同 up,但镜像翻转,对应 Exif 中的 2
|
1959
|
+
* down 旋转180度,对应 Exif 中的 3
|
1960
|
+
* down-mirrored 同 down,但镜像翻转,对应 Exif 中的 4
|
1961
|
+
* left-mirrored 同 left,但镜像翻转,对应 Exif 中的 5
|
1962
|
+
* right 顺时针旋转90度,对应 Exif 中的 6
|
1963
|
+
* right-mirrored 同 right,但镜像翻转,对应 Exif 中的 7
|
1964
|
+
* left 逆时针旋转90度,对应 Exif 中的 8
|
1965
|
+
*/
|
1966
|
+
orientation: string
|
1967
|
+
/** 视频格式 */
|
1968
|
+
type: string
|
1969
|
+
/** 视频时长 */
|
1970
|
+
duration: number
|
1971
|
+
/** 视频大小,单位 kB */
|
1972
|
+
size: number
|
1973
|
+
/** 视频帧率 */
|
1974
|
+
fps: number
|
1975
|
+
/** 视频码率,单位 kbps */
|
1976
|
+
bitrate: number
|
1977
|
+
}
|
1978
|
+
|
1979
|
+
export type SaveVideoParams = {
|
1980
|
+
/** 视频文件路径,可以是临时文件路径也可以是永久文件路径 (本地路径) */
|
1981
|
+
filePath: string
|
1982
|
+
}
|
1983
|
+
|
1341
1984
|
export type ToastBean = {
|
1342
1985
|
/** 提示的内容 */
|
1343
1986
|
title: string
|
@@ -1369,8 +2012,6 @@ declare namespace ty {
|
|
1369
2012
|
}
|
1370
2013
|
|
1371
2014
|
export type ModalCallback = {
|
1372
|
-
/** editable 为 true 时,用户输入的文本 */
|
1373
|
-
content?: string
|
1374
2015
|
/** 为 true 时,表示用户点击了确定按钮 */
|
1375
2016
|
confirm: boolean
|
1376
2017
|
/** 为 true 时,表示用户点击了取消(用于 Android 系统区分点击蒙层关闭还是点击取消按钮关闭) */
|
@@ -1453,6 +2094,54 @@ declare namespace ty {
|
|
1453
2094
|
data: string
|
1454
2095
|
}
|
1455
2096
|
|
2097
|
+
export type WifiInfo = {
|
2098
|
+
/** wifi的SSID */
|
2099
|
+
SSID: string
|
2100
|
+
/** wifi的BSSID */
|
2101
|
+
BSSID: string
|
2102
|
+
/** Wi-Fi 信号强度, 安卓取值 0 ~ 100 ,iOS 取值 0 ~ 1 ,值越大强度越大 */
|
2103
|
+
signalStrength: number
|
2104
|
+
/**
|
2105
|
+
* Wi-Fi是否安全
|
2106
|
+
* Android:Android系统12开始支持。
|
2107
|
+
*/
|
2108
|
+
secure: boolean
|
2109
|
+
/** Wi-Fi 频段单位 MHz */
|
2110
|
+
frequency: number
|
2111
|
+
}
|
2112
|
+
|
2113
|
+
export type UpdateVolumeParams = {
|
2114
|
+
/** 音量,阈值【0 - 1】 */
|
2115
|
+
value: number
|
2116
|
+
}
|
2117
|
+
|
2118
|
+
export type SystemSetting = {
|
2119
|
+
/** 蓝牙的系统开关,默认false */
|
2120
|
+
bluetoothEnabled?: boolean
|
2121
|
+
/** 地理位置的系统开关,默认false */
|
2122
|
+
locationEnabled?: boolean
|
2123
|
+
/** Wi-Fi 的系统开关,默认false */
|
2124
|
+
wifiEnabled?: boolean
|
2125
|
+
/**
|
2126
|
+
* 设备方向, 默认竖屏
|
2127
|
+
* 竖屏 = "portrait", 横屏 = "landscape"
|
2128
|
+
*/
|
2129
|
+
deviceOrientation?: string
|
2130
|
+
}
|
2131
|
+
|
2132
|
+
export type DeviceInfoResponse = {
|
2133
|
+
/** 应用二进制接口类型(仅 Android 支持) */
|
2134
|
+
abi: string
|
2135
|
+
/** 设备品牌 */
|
2136
|
+
brand: string
|
2137
|
+
/** 设备型号。新机型刚推出一段时间会显示unknown。 */
|
2138
|
+
model: string
|
2139
|
+
/** 操作系统及版本 */
|
2140
|
+
system: string
|
2141
|
+
/** 客户端平台 */
|
2142
|
+
platform: string
|
2143
|
+
}
|
2144
|
+
|
1456
2145
|
export type SystemInfo = {
|
1457
2146
|
is24Hour: boolean
|
1458
2147
|
system: string
|
@@ -1483,6 +2172,16 @@ declare namespace ty {
|
|
1483
2172
|
deviceOrientation?: Orientation
|
1484
2173
|
}
|
1485
2174
|
|
2175
|
+
export type GetConnectedWifiParams = {
|
2176
|
+
/**
|
2177
|
+
* 是否需要返回部分 Wi-Fi 信息
|
2178
|
+
* 安卓 thing.getConnectedWifi 若设置了 partialInfo:true ,将会返回只包含 SSID 属性的 WifiInfo 对象。
|
2179
|
+
* iOS thing.getConnectedWifi 若设置了 partialInfo:true ,将会返回只包含 SSID、BSSID 属性的 WifiInfo 对象,且需要用户开启微信定位权限才能正确返回结果。
|
2180
|
+
* 默认值:false
|
2181
|
+
*/
|
2182
|
+
partialInfo?: boolean
|
2183
|
+
}
|
2184
|
+
|
1486
2185
|
export type NetworkTypeCB = {
|
1487
2186
|
/** 网络类型 */
|
1488
2187
|
networkType: string
|
@@ -1500,7 +2199,7 @@ declare namespace ty {
|
|
1500
2199
|
keepScreenOn: boolean
|
1501
2200
|
}
|
1502
2201
|
|
1503
|
-
export type
|
2202
|
+
export type TUNIVibrateBean = {
|
1504
2203
|
/** 震动强度类型,有效值为:heavy、medium、light */
|
1505
2204
|
type: string
|
1506
2205
|
}
|
@@ -1594,6 +2293,38 @@ declare namespace ty {
|
|
1594
2293
|
* 创建内部audio上下文InnerAudioContext对象
|
1595
2294
|
*/
|
1596
2295
|
interface CreateInnerAudioContextTask {
|
2296
|
+
/**
|
2297
|
+
* 暂停
|
2298
|
+
*/
|
2299
|
+
pause(params: {
|
2300
|
+
complete?: () => void
|
2301
|
+
success?: (params: null) => void
|
2302
|
+
fail?: (params: {
|
2303
|
+
errorMsg: string
|
2304
|
+
errorCode: string | number
|
2305
|
+
innerError: {
|
2306
|
+
errorCode: string | number
|
2307
|
+
errorMsg: string
|
2308
|
+
}
|
2309
|
+
}) => void
|
2310
|
+
}): void
|
2311
|
+
|
2312
|
+
/**
|
2313
|
+
* 恢复
|
2314
|
+
*/
|
2315
|
+
resume(params: {
|
2316
|
+
complete?: () => void
|
2317
|
+
success?: (params: null) => void
|
2318
|
+
fail?: (params: {
|
2319
|
+
errorMsg: string
|
2320
|
+
errorCode: string | number
|
2321
|
+
innerError: {
|
2322
|
+
errorCode: string | number
|
2323
|
+
errorMsg: string
|
2324
|
+
}
|
2325
|
+
}) => void
|
2326
|
+
}): void
|
2327
|
+
|
1597
2328
|
/**
|
1598
2329
|
* 播放
|
1599
2330
|
*/
|
@@ -1671,6 +2402,18 @@ declare namespace ty {
|
|
1671
2402
|
}
|
1672
2403
|
}) => void
|
1673
2404
|
}): void
|
2405
|
+
|
2406
|
+
/**
|
2407
|
+
* 监听音频播放进度更新事件
|
2408
|
+
*/
|
2409
|
+
onTimeUpdate(
|
2410
|
+
listener: (params: {
|
2411
|
+
/** InnerAudioContext 对象 ContextId */
|
2412
|
+
contextId: string
|
2413
|
+
/** 播放进度 【0 - 1】 */
|
2414
|
+
time: number
|
2415
|
+
}) => void
|
2416
|
+
): void
|
1674
2417
|
}
|
1675
2418
|
export function createInnerAudioContext(params?: {
|
1676
2419
|
complete?: () => void
|
@@ -1795,10 +2538,66 @@ declare namespace ty {
|
|
1795
2538
|
* 文件管理器
|
1796
2539
|
*/
|
1797
2540
|
interface GetFileSystemManagerTask {
|
2541
|
+
/**
|
2542
|
+
* 判断文件/目录是否存在
|
2543
|
+
*/
|
2544
|
+
access(params: {
|
2545
|
+
/** 要判断是否存在的文件/目录路径 (本地路径) */
|
2546
|
+
path: string
|
2547
|
+
complete?: () => void
|
2548
|
+
success?: (params: null) => void
|
2549
|
+
fail?: (params: {
|
2550
|
+
errorMsg: string
|
2551
|
+
errorCode: string | number
|
2552
|
+
innerError: {
|
2553
|
+
errorCode: string | number
|
2554
|
+
errorMsg: string
|
2555
|
+
}
|
2556
|
+
}) => void
|
2557
|
+
}): void
|
2558
|
+
|
2559
|
+
/**
|
2560
|
+
* 读取本地文件内容
|
2561
|
+
*/
|
2562
|
+
readFile(params: {
|
2563
|
+
/** 要写入的文件路径 (本地路径) */
|
2564
|
+
filePath: string
|
2565
|
+
/**
|
2566
|
+
* 指定读取文件的字符编码。
|
2567
|
+
* 支持 utf8/ascii/base64。如果不传 encoding,默认utf8
|
2568
|
+
*/
|
2569
|
+
encoding?: string
|
2570
|
+
/** 从文件指定位置开始读,如果不指定,则从文件头开始读。读取的范围应该是左闭右开区间 [position, position+length)。有效范围:[0, fileLength - 1]。单位:byte */
|
2571
|
+
position?: number
|
2572
|
+
/** 指定文件的长度,如果不指定,则读到文件末尾。有效范围:[1, fileLength]。单位:byte */
|
2573
|
+
length?: number
|
2574
|
+
complete?: () => void
|
2575
|
+
success?: (params: {
|
2576
|
+
/** 文件内容 */
|
2577
|
+
data: string
|
2578
|
+
}) => void
|
2579
|
+
fail?: (params: {
|
2580
|
+
errorMsg: string
|
2581
|
+
errorCode: string | number
|
2582
|
+
innerError: {
|
2583
|
+
errorCode: string | number
|
2584
|
+
errorMsg: string
|
2585
|
+
}
|
2586
|
+
}) => void
|
2587
|
+
}): void
|
2588
|
+
|
2589
|
+
/**
|
2590
|
+
* 读取本地文件内容
|
2591
|
+
*/
|
2592
|
+
readFileSync(req?: FileReadFileReqBean): {
|
2593
|
+
/** 文件内容 */
|
2594
|
+
data: string
|
2595
|
+
}
|
2596
|
+
|
1798
2597
|
/**
|
1799
2598
|
* 文件保存的同步方法, 在完成文件保存后调用回调, 需要与getTempDirectory配合使用, 目标路径会校验是否包含getTempDirectory前缀
|
1800
2599
|
*/
|
1801
|
-
|
2600
|
+
saveFile(params: {
|
1802
2601
|
/** 临时存储文件路径 */
|
1803
2602
|
tempFilePath: string
|
1804
2603
|
/** 要存储的文件路径 */
|
@@ -1817,6 +2616,151 @@ declare namespace ty {
|
|
1817
2616
|
}
|
1818
2617
|
}) => void
|
1819
2618
|
}): void
|
2619
|
+
|
2620
|
+
/**
|
2621
|
+
* 文件保存的同步方法, 在完成文件保存后调用回调, 需要与getTempDirectory配合使用, 目标路径会校验是否包含getTempDirectory前缀
|
2622
|
+
*/
|
2623
|
+
saveFileSync(params?: SaveFileSyncParams): {
|
2624
|
+
/** 【待废弃, 不建议使用】存储后的文件路径 */
|
2625
|
+
savedFilePath: string
|
2626
|
+
}
|
2627
|
+
|
2628
|
+
/**
|
2629
|
+
* 获取文件Stats对象,需要文件读写权限
|
2630
|
+
*/
|
2631
|
+
stat(params: {
|
2632
|
+
/** 文件/目录路径 (本地路径) */
|
2633
|
+
path: string
|
2634
|
+
/**
|
2635
|
+
* 是否递归获取目录下的每个文件的 Stats 信息
|
2636
|
+
* 默认值:false
|
2637
|
+
*/
|
2638
|
+
recursive?: boolean
|
2639
|
+
complete?: () => void
|
2640
|
+
success?: (params: {
|
2641
|
+
/** 文件列表 */
|
2642
|
+
fileStatsList: FileStats[]
|
2643
|
+
}) => void
|
2644
|
+
fail?: (params: {
|
2645
|
+
errorMsg: string
|
2646
|
+
errorCode: string | number
|
2647
|
+
innerError: {
|
2648
|
+
errorCode: string | number
|
2649
|
+
errorMsg: string
|
2650
|
+
}
|
2651
|
+
}) => void
|
2652
|
+
}): void
|
2653
|
+
|
2654
|
+
/**
|
2655
|
+
* 获取文件Stats对象,需要文件读写权限
|
2656
|
+
*/
|
2657
|
+
statSync(params?: FileStatsParams): {
|
2658
|
+
/** 文件列表 */
|
2659
|
+
fileStatsList: FileStats[]
|
2660
|
+
}
|
2661
|
+
|
2662
|
+
/**
|
2663
|
+
* 创建目录,需要文件读写权限
|
2664
|
+
*/
|
2665
|
+
mkdir(params: {
|
2666
|
+
/** 创建的目录路径 (本地路径) */
|
2667
|
+
dirPath: string
|
2668
|
+
/**
|
2669
|
+
* 是否在递归创建该目录的上级目录后再创建该目录。如果对应的上级目录已经存在,则不创建该上级目录。
|
2670
|
+
* 如 dirPath 为 a/b/c/d 且 recursive 为 true,将创建 a 目录,再在 a 目录下创建 b 目录,
|
2671
|
+
* 以此类推直至创建 a/b/c 目录下的 d 目录。
|
2672
|
+
* 默认值:false
|
2673
|
+
*/
|
2674
|
+
recursive?: boolean
|
2675
|
+
complete?: () => void
|
2676
|
+
success?: (params: null) => void
|
2677
|
+
fail?: (params: {
|
2678
|
+
errorMsg: string
|
2679
|
+
errorCode: string | number
|
2680
|
+
innerError: {
|
2681
|
+
errorCode: string | number
|
2682
|
+
errorMsg: string
|
2683
|
+
}
|
2684
|
+
}) => void
|
2685
|
+
}): void
|
2686
|
+
|
2687
|
+
/**
|
2688
|
+
* 创建目录,需要文件读写权限
|
2689
|
+
*/
|
2690
|
+
mkdirSync(params?: MakeDirParams): null
|
2691
|
+
|
2692
|
+
/**
|
2693
|
+
* 删除目录,需要文件读写权限
|
2694
|
+
*/
|
2695
|
+
rmdir(params: {
|
2696
|
+
/** 要删除的目录路径 (本地路径) */
|
2697
|
+
dirPath: string
|
2698
|
+
/**
|
2699
|
+
* 是否递归删除目录。如果为 true,则删除该目录和该目录下的所有子目录以及文件。
|
2700
|
+
* 默认值:false
|
2701
|
+
*/
|
2702
|
+
recursive?: boolean
|
2703
|
+
complete?: () => void
|
2704
|
+
success?: (params: null) => void
|
2705
|
+
fail?: (params: {
|
2706
|
+
errorMsg: string
|
2707
|
+
errorCode: string | number
|
2708
|
+
innerError: {
|
2709
|
+
errorCode: string | number
|
2710
|
+
errorMsg: string
|
2711
|
+
}
|
2712
|
+
}) => void
|
2713
|
+
}): void
|
2714
|
+
|
2715
|
+
/**
|
2716
|
+
* 删除目录,需要文件读写权限
|
2717
|
+
*/
|
2718
|
+
rmdirSync(params?: RemoveDirParams): null
|
2719
|
+
|
2720
|
+
/**
|
2721
|
+
* 写文件,需要文件读写权限
|
2722
|
+
*/
|
2723
|
+
writeFile(params: {
|
2724
|
+
/** 要写入的文件路径 (本地路径) */
|
2725
|
+
filePath: string
|
2726
|
+
/** 要写入的文本数据, 根据encoding编码 */
|
2727
|
+
data: string
|
2728
|
+
/** 指定写入文件的字符编码,目前支持【utf8、ascii、base64】, 默认utf8 */
|
2729
|
+
encoding?: string
|
2730
|
+
complete?: () => void
|
2731
|
+
success?: (params: null) => void
|
2732
|
+
fail?: (params: {
|
2733
|
+
errorMsg: string
|
2734
|
+
errorCode: string | number
|
2735
|
+
innerError: {
|
2736
|
+
errorCode: string | number
|
2737
|
+
errorMsg: string
|
2738
|
+
}
|
2739
|
+
}) => void
|
2740
|
+
}): void
|
2741
|
+
|
2742
|
+
/**
|
2743
|
+
* 写文件,需要文件读写权限
|
2744
|
+
*/
|
2745
|
+
writeFileSync(params?: WriteFileParams): null
|
2746
|
+
|
2747
|
+
/**
|
2748
|
+
* 删除已保存的本地缓存文件,需要文件读写权限
|
2749
|
+
*/
|
2750
|
+
removeSavedFile(params: {
|
2751
|
+
/** 需要删除的文件路径 (本地路径) */
|
2752
|
+
filePath: string
|
2753
|
+
complete?: () => void
|
2754
|
+
success?: (params: null) => void
|
2755
|
+
fail?: (params: {
|
2756
|
+
errorMsg: string
|
2757
|
+
errorCode: string | number
|
2758
|
+
innerError: {
|
2759
|
+
errorCode: string | number
|
2760
|
+
errorMsg: string
|
2761
|
+
}
|
2762
|
+
}) => void
|
2763
|
+
}): void
|
1820
2764
|
}
|
1821
2765
|
export function getFileSystemManager(params?: {
|
1822
2766
|
complete?: () => void
|