@trtc/calls-uikit-react 4.2.1 → 4.2.3

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@trtc/calls-uikit-react",
3
- "version": "4.2.1",
3
+ "version": "4.2.3",
4
4
  "main": "./tuicall-uikit-react.umd.js",
5
5
  "module": "./tuicall-uikit-react.es.js",
6
6
  "types": "./types/index.d.ts",
@@ -14,8 +14,9 @@
14
14
  },
15
15
  "dependencies": {
16
16
  "@tencentcloud/tui-core-lite": "1.0.0",
17
- "@trtc/call-engine-lite-js": "~3.4.0",
18
- "@tencentcloud/lite-chat": "^1.5.0"
17
+ "@trtc/call-engine-lite-js": "~3.4.5",
18
+ "@tencentcloud/lite-chat": "^1.5.0",
19
+ "@trtc/call-engine-lite-wx": "~3.4.5"
19
20
  },
20
21
  "bugs": {
21
22
  "url": "https://github.com/tencentyun/TUICallKit/issues"
@@ -275,31 +275,17 @@ export default class ChatCombine {
275
275
  */
276
276
  private async _handleTUICoreOnClick(options, type: CallMediaType) {
277
277
  try {
278
- const isForceUseV2API = TUIStore.getData(StoreName.CALL, NAME.IS_FORCE_USE_V2_API);
279
278
  const { groupID, userIDList = [], version = '', ...rest } = options;
280
279
 
281
- if (isForceUseV2API) {
282
- await this._useV2API({ ...options, type });
283
- return;
284
- }
285
- if (version === 'v3') {
286
- await this._callService?.calls({ chatGroupID: groupID, userIDList, type, ...rest });
287
- return;
288
- }
289
- await this._useV2API({ ...options, type });
280
+ await this._callService?.calls({ chatGroupID: groupID, userIDList, type, ...rest });
290
281
  } catch (error: any) {
282
+ // call update to lite-chat only support calls interface
283
+ if (!options?.version) {
284
+ console.warn('Please upgrade to the latest Chat UIKit components.');
285
+ }
291
286
  console.debug(error);
292
287
  }
293
288
  }
294
- private async _useV2API(options) {
295
- const { groupID, userIDList = [], type, ...rest } = options || {};
296
-
297
- if (groupID) {
298
- await this._callService?.groupCall({ groupID, userIDList, type, ...rest });
299
- } else if (userIDList.length === 1) {
300
- await this._callService?.call({ userID: userIDList[0], type, ...rest });
301
- }
302
- }
303
289
  private async _handleGroupAttributesUpdated(event) {
304
290
  if (TUIStore.getData(StoreName.CALL, NAME.CALL_STATUS) !== CallStatus.IDLE) return;
305
291
 
@@ -26,7 +26,7 @@ const TUIGlobal: ITUIGlobal = TuiGlobal.getInstance();
26
26
  const TUIStore: ITUIStore = TuiStore.getInstance();
27
27
  const uiDesign = UIDesign.getInstance();
28
28
  uiDesign.setTUIStore(TUIStore);
29
- const version = '4.2.1';
29
+ const version = '4.2.3';
30
30
  const frameWork = 'react';
31
31
  export { TUIGlobal, TUIStore, uiDesign };
32
32
 
@@ -44,9 +44,17 @@ export default class TUICallService {
44
44
  private _permissionCheckTimer: any = null;
45
45
  private _chatCombine: any = null;
46
46
  private _engineEventHandler: any = null;
47
+ // wasm ready
48
+ private _wasmReadyPromise;
49
+ private _wasmReadyResolve;
50
+ private _isInitialized = false;
47
51
 
48
52
  constructor() {
49
53
  console.log(`${NAME.PREFIX}version: ${version}`);
54
+ this._wasmReadyPromise = new Promise(resolve => {
55
+ this._wasmReadyResolve = resolve;
56
+ });
57
+ this._loadWasm();
50
58
  this._watchTUIStore();
51
59
  this._engineEventHandler = EngineEventHandler.getInstance({ callService: this });
52
60
 
@@ -59,8 +67,23 @@ export default class TUICallService {
59
67
  }
60
68
  return TUICallService.instance;
61
69
  }
70
+ public _loadWasm() {
71
+ TUICallEngine.once('ready', () => this._wasmReadyResolve());
72
+ }
62
73
  @avoidRepeatedCall()
63
74
  public async init(params: IInitParams) {
75
+ if (this._isInitialized) {
76
+ console.warn('TUICallKit has already been initialized.');
77
+ return;
78
+ }
79
+ await this._wasmReadyPromise;
80
+
81
+ if (!this._isInitialized) {
82
+ this._doInit(params);
83
+ this._isInitialized = true;
84
+ }
85
+ }
86
+ public async _doInit(params: IInitParams) {
64
87
  try {
65
88
  if (this._tuiCallEngine) return;
66
89
  // @ts-ignore
@@ -109,6 +132,7 @@ export default class TUICallService {
109
132
  // component destroy
110
133
  public async destroyed() {
111
134
  try {
135
+ this._isInitialized = false;
112
136
  const currentCallStatus = TUIStore.getData(StoreName.CALL, NAME.CALL_STATUS);
113
137
  if (currentCallStatus !== CallStatus.IDLE) {
114
138
  throw new Error(`please destroyed when status is idle, current status: ${currentCallStatus}`);
package/src/index.ts CHANGED
@@ -35,7 +35,7 @@ const TUICallType = {
35
35
  AUDIO_CALL: 1,
36
36
  VIDEO_CALL: 2,
37
37
  };
38
- const Version = '4.2.1'; // basic-demo 原来上报使用
38
+ const Version = '4.2.3'; // basic-demo 原来上报使用
39
39
 
40
40
  // 输出产物
41
41
  export {