@tencentcloud/trtc-cloud-wx 0.0.28 → 0.0.30

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 (57) hide show
  1. package/package.json +3 -44
  2. package/{dist/trtc-cloud-wx.js → trtc-cloud-wx.js} +1 -146
  3. package/.babelrc +0 -6
  4. package/.eslintrc.json +0 -129
  5. package/build/chokidar.js +0 -19
  6. package/build/clear.js +0 -24
  7. package/build/copy.js +0 -24
  8. package/build/copy_to_roomkit.js +0 -19
  9. package/dist/package.json +0 -15
  10. package/docs/API/TRTCCloud.html +0 -4353
  11. package/docs/API/index.html +0 -98
  12. package/docs/API/scripts/add-toc.js +0 -57
  13. package/docs/API/scripts/collapse.js +0 -20
  14. package/docs/API/scripts/highlight/highlight.min.js +0 -1282
  15. package/docs/API/scripts/highlight/highlightjs-line-numbers.min.js +0 -1
  16. package/docs/API/scripts/linenumber.js +0 -25
  17. package/docs/API/scripts/nav.js +0 -12
  18. package/docs/API/scripts/polyfill.js +0 -4
  19. package/docs/API/scripts/prettify/Apache-License-2.0.txt +0 -202
  20. package/docs/API/scripts/prettify/lang-css.js +0 -2
  21. package/docs/API/scripts/prettify/prettify.js +0 -28
  22. package/docs/API/scripts/search.js +0 -83
  23. package/docs/API/styles/font.css +0 -81
  24. package/docs/API/styles/fonts/JTURjIg1_i6t8kCHKm45_dJE3g3D_vx3rCubqg.woff2 +0 -0
  25. package/docs/API/styles/fonts/JTURjIg1_i6t8kCHKm45_dJE3gTD_vx3rCubqg.woff2 +0 -0
  26. package/docs/API/styles/fonts/JTURjIg1_i6t8kCHKm45_dJE3gbD_vx3rCubqg.woff2 +0 -0
  27. package/docs/API/styles/fonts/JTURjIg1_i6t8kCHKm45_dJE3gfD_vx3rCubqg.woff2 +0 -0
  28. package/docs/API/styles/fonts/JTURjIg1_i6t8kCHKm45_dJE3gnD_vx3rCs.woff2 +0 -0
  29. package/docs/API/styles/fonts/JTUSjIg1_i6t8kCHKm459W1hyyTh89ZNpQ.woff2 +0 -0
  30. package/docs/API/styles/fonts/JTUSjIg1_i6t8kCHKm459WRhyyTh89ZNpQ.woff2 +0 -0
  31. package/docs/API/styles/fonts/JTUSjIg1_i6t8kCHKm459WZhyyTh89ZNpQ.woff2 +0 -0
  32. package/docs/API/styles/fonts/JTUSjIg1_i6t8kCHKm459WdhyyTh89ZNpQ.woff2 +0 -0
  33. package/docs/API/styles/fonts/JTUSjIg1_i6t8kCHKm459WlhyyTh89Y.woff2 +0 -0
  34. package/docs/API/styles/highlight/highlight.min.css +0 -26
  35. package/docs/API/styles/highlight/rainbow.min.css +0 -1
  36. package/docs/API/styles/jsdoc.css +0 -684
  37. package/docs/API/styles/prettify.css +0 -79
  38. package/docs/API/styles/toc.css +0 -44
  39. package/docs/API/tutorial-00-guideline.html +0 -81
  40. package/docs/doc-src/home.md +0 -7
  41. package/docs/doc-src/tutorials/00-guideline.md +0 -1
  42. package/docs/doc-src/tutorials/tutorials.json +0 -5
  43. package/jsdoc.json +0 -43
  44. package/rollup.config.js +0 -19
  45. package/sdk_publish.bash +0 -5
  46. package/src/TaskMachine.ts +0 -368
  47. package/src/deviceAuthorize.ts +0 -75
  48. package/src/index.ts +0 -1091
  49. package/src/interface/index.ts +0 -44
  50. package/src/interface/types.ts +0 -88
  51. package/src/log/logger.ts +0 -103
  52. package/src/types.d.ts +0 -1
  53. package/src/utils/common.ts +0 -67
  54. package/src/utils/index.ts +0 -2
  55. package/src/utils/translate.ts +0 -125
  56. package/tsconfig.json +0 -15
  57. package/typedoc.json +0 -21
@@ -1,75 +0,0 @@
1
- import {debounce} from './utils'
2
-
3
- export enum DeviceScope {
4
- RECORD = 'scope.record',
5
- CAMERA = 'scope.camera'
6
- }
7
- export enum DeviceType {
8
- MIC = 'mic',
9
- CAMERA = 'camera'
10
- }
11
- /**
12
- * 获取设备权限,查看当前是否有麦克风以及摄像头权限
13
- * @param {Object} params - 参数对象
14
- * @param {Boolean} params.microphone 麦克风权限
15
- * @param {Boolean} params.camera 摄像头权限
16
- */
17
- async function deviceCheck(types: Array<DeviceType>): Promise<boolean> {
18
- if (!types) return false
19
- const microphone = types.includes(DeviceType.MIC)
20
- const camera = types.includes(DeviceType.CAMERA)
21
- try {
22
- const res = await wx.getSetting()
23
- const isMicrophone = res.authSetting[DeviceScope.RECORD]
24
- const isCamera = res.authSetting[DeviceScope.CAMERA]
25
- // 同时检查麦克风和摄像头权限
26
- if (microphone && camera) {
27
- return isMicrophone && isCamera
28
- }
29
- // 只检查麦克风权限
30
- if (microphone) {
31
- return isMicrophone
32
- }
33
- // 只检查摄像头权限
34
- if (camera) {
35
- return isCamera
36
- }
37
- return false
38
- } catch (error) {
39
- return false
40
- }
41
- }
42
-
43
-
44
- function permissionPopup(): void {
45
- wx.showModal({
46
- title: '设备授权',
47
- content: '使用音视频功能请对相应设备进行授权',
48
- confirmText: '去设置',
49
- success: (res) => {
50
- if (res.confirm) {
51
- wx.openSetting()
52
- }
53
- },
54
- })
55
- }
56
- const debouncePermissionPopup = debounce(permissionPopup, 300)
57
- export function deviceAuthorize(deviceType: DeviceType, scope: DeviceScope) {
58
- return function (target: any, key: string, descriptor: PropertyDescriptor): PropertyDescriptor {
59
- const originalMethod = descriptor.value
60
- descriptor.value = async function (...args: any[]): Promise<any> {
61
- if (!await deviceCheck([deviceType])) {
62
- try {
63
- await wx.authorize({scope})
64
- } catch (error) {
65
- debouncePermissionPopup()
66
- throw new Error(error)
67
- }
68
- return
69
- }
70
- // eslint-disable-next-line consistent-return
71
- return originalMethod.apply(this, args)
72
- }
73
- return descriptor
74
- }
75
- }