fcr-core 3.8.2 → 3.9.0-alpha
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/lib/chat-connector/type.d.ts +40 -0
- package/lib/{chat-connection → chat-connector}/type.js +1 -1
- package/lib/engine/index.d.ts +10 -11
- package/lib/engine/index.js +63 -72
- package/lib/engine/type.d.ts +96 -0
- package/lib/engine/type.js +5 -0
- package/lib/imports.d.ts +7 -4
- package/lib/imports.js +30 -4
- package/lib/index.d.ts +3 -2
- package/lib/index.js +21 -2
- package/lib/media-control/desktop.js +12 -12
- package/lib/media-control/mobile.js +4 -0
- package/lib/media-control/type.d.ts +32 -33
- package/lib/monitor-control/index.js +3 -3
- package/lib/peer-session/index.js +14 -14
- package/lib/peer-session/type.d.ts +1 -1
- package/lib/plugins/chat/chatroom.js +417 -0
- package/lib/{chat-connection → plugins/chat}/config.d.ts +1 -0
- package/lib/{chat-connection → plugins/chat}/config.js +2 -1
- package/lib/plugins/chat/connector.d.ts +38 -0
- package/lib/{chat-connection/index.js → plugins/chat/connector.js} +181 -61
- package/lib/room-control/ability-control/index.js +5 -4
- package/lib/room-control/ability-control/type.d.ts +5 -1
- package/lib/room-control/ability-control/type.js +4 -0
- package/lib/room-control/chatroom-control/type.d.ts +44 -35
- package/lib/room-control/group-control/index.js +9 -9
- package/lib/room-control/index.js +37 -22
- package/lib/room-control/interpreter-control/index.js +7 -4
- package/lib/room-control/interpreter-control/room.js +3 -3
- package/lib/room-control/interpreter-control/types.d.ts +2 -2
- package/lib/room-control/join-before-host-waitingroom-control/index.js +3 -3
- package/lib/room-control/mainroom-control/index.js +15 -13
- package/lib/room-control/privilege-control/index.js +39 -24
- package/lib/room-control/privilege-control/type.d.ts +15 -15
- package/lib/room-control/room-connector-control/index.js +7 -5
- package/lib/room-control/room-connector-control/type.d.ts +1 -1
- package/lib/room-control/room-control-factory.d.ts +3 -3
- package/lib/room-control/room-control-factory.js +7 -7
- package/lib/room-control/room-session/index.js +17 -15
- package/lib/room-control/room-session/type.d.ts +3 -3
- package/lib/room-control/sharing-control/index.js +13 -7
- package/lib/room-control/stream-control/index.js +18 -16
- package/lib/room-control/stream-control/type.d.ts +5 -5
- package/lib/room-control/stt-control/index.js +38 -31
- package/lib/room-control/type.d.ts +19 -19
- package/lib/room-control/user-control/index.js +20 -22
- package/lib/room-control/user-control/type.d.ts +1 -1
- package/lib/room-control/waitingroom-control/index.js +11 -11
- package/lib/room-control/whiteboard-control-v1/board-window.d.ts +21 -20
- package/lib/room-control/whiteboard-control-v1/board-window.js +27 -8
- package/lib/room-control/whiteboard-control-v1/factory.js +1 -1
- package/lib/room-control/whiteboard-control-v1/index.js +26 -18
- package/lib/room-control/whiteboard-control-v1/type.d.ts +26 -25
- package/lib/room-control/whiteboard-control-v1/type.js +1 -0
- package/lib/room-control/whiteboard-control-v2/annotation-control/control.d.ts +15 -6
- package/lib/room-control/whiteboard-control-v2/annotation-control/control.js +39 -5
- package/lib/room-control/whiteboard-control-v2/annotation-control/factory.d.ts +4 -5
- package/lib/room-control/whiteboard-control-v2/annotation-control/factory.js +6 -5
- package/lib/room-control/whiteboard-control-v2/annotation-control/type.d.ts +7 -1
- package/lib/room-control/whiteboard-control-v2/base/index.d.ts +9 -8
- package/lib/room-control/whiteboard-control-v2/base/index.js +84 -42
- package/lib/room-control/whiteboard-control-v2/base/main-window.d.ts +16 -15
- package/lib/room-control/whiteboard-control-v2/base/main-window.js +23 -4
- package/lib/room-control/whiteboard-control-v2/type.d.ts +17 -17
- package/lib/room-control/whiteboard-control-v2/whiteboard-control/control.d.ts +12 -6
- package/lib/room-control/whiteboard-control-v2/whiteboard-control/control.js +64 -18
- package/lib/room-control/whiteboard-control-v2/whiteboard-control/factory.d.ts +2 -2
- package/lib/room-control/whiteboard-control-v2/whiteboard-control/factory.js +10 -10
- package/lib/room-control/whiteboard-control-v2/whiteboard-control/type.d.ts +1 -1
- package/lib/room-router/index.js +10 -7
- package/lib/room-router/type.d.ts +1 -1
- package/lib/schema.d.ts +24 -46
- package/lib/schema.js +1 -2
- package/lib/service/api.d.ts +5 -3
- package/lib/service/api.js +17 -12
- package/lib/type.d.ts +64 -45
- package/lib/type.js +76 -11
- package/lib/utilities/abortable-retry.d.ts +38 -0
- package/lib/utilities/abortable-retry.js +61 -0
- package/lib/utilities/dual-video-stream-config.d.ts +6 -0
- package/lib/utilities/dual-video-stream-config.js +25 -0
- package/lib/utilities/error-helpers.d.ts +10 -9
- package/lib/utilities/error-helpers.js +12 -11
- package/lib/utilities/error.d.ts +4 -40
- package/lib/utilities/error.js +20 -77
- package/lib/utilities/join-helper.js +2 -2
- package/lib/utilities/logger.d.ts +2 -2
- package/lib/utilities/logger.js +6 -25
- package/lib/utilities/package-info.d.ts +1 -2
- package/lib/utilities/package-info.js +4 -8
- package/lib/utilities/parameters.js +88 -15
- package/lib/utilities/validate-params.js +1 -1
- package/lib/utilities/video-encoder-config.d.ts +9 -0
- package/lib/utilities/video-encoder-config.js +109 -0
- package/lib-es/{chat-connection → chat-connector}/type.js +1 -1
- package/lib-es/engine/index.js +46 -56
- package/lib-es/engine/type.js +1 -0
- package/lib-es/imports.js +5 -3
- package/lib-es/index.js +2 -1
- package/lib-es/media-control/desktop.js +12 -12
- package/lib-es/media-control/mobile.js +4 -0
- package/lib-es/monitor-control/index.js +3 -3
- package/lib-es/peer-session/index.js +16 -15
- package/lib-es/plugins/chat/chatroom.js +409 -0
- package/lib-es/{chat-connection → plugins/chat}/config.js +2 -1
- package/lib-es/{chat-connection/index.js → plugins/chat/connector.js} +178 -58
- package/lib-es/room-control/ability-control/index.js +5 -4
- package/lib-es/room-control/ability-control/type.js +4 -0
- package/lib-es/room-control/group-control/index.js +11 -10
- package/lib-es/room-control/index.js +40 -26
- package/lib-es/room-control/interpreter-control/index.js +10 -5
- package/lib-es/room-control/interpreter-control/room.js +3 -3
- package/lib-es/room-control/join-before-host-waitingroom-control/index.js +4 -3
- package/lib-es/room-control/mainroom-control/index.js +16 -17
- package/lib-es/room-control/privilege-control/index.js +43 -29
- package/lib-es/room-control/room-connector-control/index.js +9 -6
- package/lib-es/room-control/room-control-factory.js +6 -6
- package/lib-es/room-control/room-session/index.js +21 -22
- package/lib-es/room-control/sharing-control/index.js +13 -7
- package/lib-es/room-control/stream-control/index.js +21 -18
- package/lib-es/room-control/stt-control/index.js +23 -15
- package/lib-es/room-control/user-control/index.js +23 -23
- package/lib-es/room-control/waitingroom-control/index.js +10 -9
- package/lib-es/room-control/whiteboard-control-v1/board-window.js +27 -8
- package/lib-es/room-control/whiteboard-control-v1/factory.js +1 -1
- package/lib-es/room-control/whiteboard-control-v1/index.js +26 -17
- package/lib-es/room-control/whiteboard-control-v1/type.js +1 -0
- package/lib-es/room-control/whiteboard-control-v2/annotation-control/control.js +39 -5
- package/lib-es/room-control/whiteboard-control-v2/annotation-control/factory.js +7 -6
- package/lib-es/room-control/whiteboard-control-v2/base/index.js +86 -42
- package/lib-es/room-control/whiteboard-control-v2/base/main-window.js +23 -4
- package/lib-es/room-control/whiteboard-control-v2/whiteboard-control/control.js +60 -13
- package/lib-es/room-control/whiteboard-control-v2/whiteboard-control/factory.js +10 -10
- package/lib-es/room-router/index.js +10 -6
- package/lib-es/schema.js +1 -2
- package/lib-es/service/api.js +17 -12
- package/lib-es/type.js +70 -18
- package/lib-es/utilities/abortable-retry.js +54 -0
- package/lib-es/utilities/dual-video-stream-config.js +19 -0
- package/lib-es/utilities/error-helpers.js +13 -12
- package/lib-es/utilities/error.js +9 -75
- package/lib-es/utilities/join-helper.js +4 -3
- package/lib-es/utilities/logger.js +7 -23
- package/lib-es/utilities/package-info.js +4 -6
- package/lib-es/utilities/parameters.js +88 -15
- package/lib-es/utilities/validate-params.js +3 -2
- package/lib-es/utilities/video-encoder-config.js +103 -0
- package/package.json +7 -7
- package/lib/chat-connection/index.d.ts +0 -24
- package/lib/chat-connection/type.d.ts +0 -17
- package/lib/plugins/chatroom.js +0 -454
- package/lib/room-control/chatroom-control/config.d.ts +0 -51
- package/lib/room-control/chatroom-control/config.js +0 -105
- package/lib/utilities/storage.d.ts +0 -8
- package/lib/utilities/storage.js +0 -33
- package/lib-es/plugins/chatroom.js +0 -446
- package/lib-es/room-control/chatroom-control/config.js +0 -100
- package/lib-es/utilities/storage.js +0 -27
- /package/lib/plugins/{chatroom.d.ts → chat/chatroom.d.ts} +0 -0
|
@@ -20,124 +20,196 @@ require("core-js/modules/esnext.symbol.metadata.js");
|
|
|
20
20
|
Object.defineProperty(exports, "__esModule", {
|
|
21
21
|
value: true
|
|
22
22
|
});
|
|
23
|
-
exports.
|
|
23
|
+
exports.FcrChatConnectorImpl = void 0;
|
|
24
24
|
require("core-js/modules/es.json.stringify.js");
|
|
25
|
-
var _imports = require("
|
|
26
|
-
var _type = require("
|
|
25
|
+
var _imports = require("../../imports");
|
|
26
|
+
var _type = require("../../type");
|
|
27
|
+
var _abortableRetry = require("../../utilities/abortable-retry");
|
|
28
|
+
var _logger = require("../../utilities/logger");
|
|
29
|
+
var _packageInfo = require("../../utilities/package-info");
|
|
27
30
|
var _config = require("./config");
|
|
28
|
-
var
|
|
29
|
-
var _packageInfo = require("../utilities/package-info");
|
|
31
|
+
var _type2 = require("../../chat-connector/type");
|
|
30
32
|
let _initProto;
|
|
31
33
|
function _applyDecs(e, t, r, n, o, a) { function i(e, t, r) { return function (n, o) { return r && r(n), e[t].call(n, o); }; } function c(e, t) { for (var r = 0; r < e.length; r++) e[r].call(t); return t; } function s(e, t, r, n) { if ("function" != typeof e && (n || void 0 !== e)) throw new TypeError(t + " must " + (r || "be") + " a function" + (n ? "" : " or undefined")); return e; } function applyDec(e, t, r, n, o, a, c, u, l, f, p, d, h) { function m(e) { if (!h(e)) throw new TypeError("Attempted to access private element on non-instance"); } var y, v = t[0], g = t[3], b = !u; if (!b) { r || Array.isArray(v) || (v = [v]); var w = {}, S = [], A = 3 === o ? "get" : 4 === o || d ? "set" : "value"; f ? (p || d ? w = { get: _setFunctionName(function () { return g(this); }, n, "get"), set: function (e) { t[4](this, e); } } : w[A] = g, p || _setFunctionName(w[A], n, 2 === o ? "" : A)) : p || (w = Object.getOwnPropertyDescriptor(e, n)); } for (var P = e, j = v.length - 1; j >= 0; j -= r ? 2 : 1) { var D = v[j], E = r ? v[j - 1] : void 0, I = {}, O = { kind: ["field", "accessor", "method", "getter", "setter", "class"][o], name: n, metadata: a, addInitializer: function (e, t) { if (e.v) throw Error("attempted to call addInitializer after decoration was finished"); s(t, "An initializer", "be", !0), c.push(t); }.bind(null, I) }; try { if (b) (y = s(D.call(E, P, O), "class decorators", "return")) && (P = y);else { var k, F; O.static = l, O.private = f, f ? 2 === o ? k = function (e) { return m(e), w.value; } : (o < 4 && (k = i(w, "get", m)), 3 !== o && (F = i(w, "set", m))) : (k = function (e) { return e[n]; }, (o < 2 || 4 === o) && (F = function (e, t) { e[n] = t; })); var N = O.access = { has: f ? h.bind() : function (e) { return n in e; } }; if (k && (N.get = k), F && (N.set = F), P = D.call(E, d ? { get: w.get, set: w.set } : w[A], O), d) { if ("object" == typeof P && P) (y = s(P.get, "accessor.get")) && (w.get = y), (y = s(P.set, "accessor.set")) && (w.set = y), (y = s(P.init, "accessor.init")) && S.push(y);else if (void 0 !== P) throw new TypeError("accessor decorators must return an object with get, set, or init properties or void 0"); } else s(P, (p ? "field" : "method") + " decorators", "return") && (p ? S.push(P) : w[A] = P); } } finally { I.v = !0; } } return (p || d) && u.push(function (e, t) { for (var r = S.length - 1; r >= 0; r--) t = S[r].call(e, t); return t; }), p || b || (f ? d ? u.push(i(w, "get"), i(w, "set")) : u.push(2 === o ? w[A] : i.call.bind(w[A])) : Object.defineProperty(e, n, w)), P; } function u(e, t) { return Object.defineProperty(e, Symbol.metadata || Symbol.for("Symbol.metadata"), { configurable: !0, enumerable: !0, value: t }); } if (arguments.length >= 6) var l = a[Symbol.metadata || Symbol.for("Symbol.metadata")]; var f = Object.create(null == l ? null : l), p = function (e, t, r, n) { var o, a, i = [], s = function (t) { return _checkInRHS(t) === e; }, u = new Map(); function l(e) { e && i.push(c.bind(null, e)); } for (var f = 0; f < t.length; f++) { var p = t[f]; if (Array.isArray(p)) { var d = p[1], h = p[2], m = p.length > 3, y = 16 & d, v = !!(8 & d), g = 0 == (d &= 7), b = h + "/" + v; if (!g && !m) { var w = u.get(b); if (!0 === w || 3 === w && 4 !== d || 4 === w && 3 !== d) throw Error("Attempted to decorate a public method/accessor that has the same name as a previously decorated public method/accessor. This is not currently supported by the decorators plugin. Property name was: " + h); u.set(b, !(d > 2) || d); } applyDec(v ? e : e.prototype, p, y, m ? "#" + h : _toPropertyKey(h), d, n, v ? a = a || [] : o = o || [], i, v, m, g, 1 === d, v && m ? s : r); } } return l(o), l(a), i; }(e, t, o, f); return r.length || u(e, f), { e: p, get c() { var t = []; return r.length && [u(applyDec(e, [r], n, e.name, 5, f, t), f), c.bind(null, t, e)]; } }; }
|
|
32
34
|
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
|
|
33
35
|
function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
34
36
|
function _setFunctionName(e, t, n) { "symbol" == typeof t && (t = (t = t.description) ? "[" + t + "]" : ""); try { Object.defineProperty(e, "name", { configurable: !0, value: n ? n + " " + t : t }); } catch (e) {} return e; }
|
|
35
37
|
function _checkInRHS(e) { if (Object(e) !== e) throw TypeError("right-hand side of 'in' should be an object, got " + (null !== e ? typeof e : "null")); return e; }
|
|
36
|
-
class
|
|
38
|
+
class FcrChatConnectorImpl {
|
|
37
39
|
static {
|
|
38
40
|
[_initProto] = _applyDecs(this, [[_imports.trace, 2, "login"], [_imports.trace, 2, "logout"]], []).e;
|
|
39
41
|
}
|
|
40
42
|
logger = (_initProto(this), (0, _logger.createLogger)({
|
|
41
|
-
prefix: '
|
|
43
|
+
prefix: 'FcrChatConnectorImpl'
|
|
42
44
|
}));
|
|
43
45
|
_observable = new _imports.AgoraObservable();
|
|
44
|
-
|
|
46
|
+
_loginPromise = null;
|
|
47
|
+
_logoutPromise = null;
|
|
48
|
+
_isLogoutRequested = false;
|
|
49
|
+
_abortLogin = null;
|
|
50
|
+
_conn = null;
|
|
51
|
+
_connectionState = _type2.FcrChatConnectionState.DISCONNECTED;
|
|
52
|
+
_reconnectionTimer = null;
|
|
53
|
+
_reconnectPromise = null;
|
|
45
54
|
constructor(_userId, _api, _chatIpList, _restIpList) {
|
|
46
55
|
this._userId = _userId;
|
|
47
56
|
this._api = _api;
|
|
48
57
|
this._chatIpList = _chatIpList;
|
|
49
58
|
this._restIpList = _restIpList;
|
|
50
59
|
this.logger.info(`Chat Version: easemob-websdk@${(0, _packageInfo.getDependenciesInfo)('easemob-websdk')}`);
|
|
60
|
+
this._addLogObserver();
|
|
51
61
|
}
|
|
52
62
|
async login() {
|
|
63
|
+
if (this._logoutPromise) {
|
|
64
|
+
await this._logoutPromise;
|
|
65
|
+
}
|
|
66
|
+
if (this._connectionState === _type2.FcrChatConnectionState.CONNECTED) {
|
|
67
|
+
return;
|
|
68
|
+
}
|
|
69
|
+
if (this._loginPromise) {
|
|
70
|
+
return this._loginPromise;
|
|
71
|
+
}
|
|
72
|
+
this._isLogoutRequested = false;
|
|
73
|
+
this._setConnectionState(_type2.FcrChatConnectionState.CONNECTING);
|
|
74
|
+
this._loginPromise = this._performLogin();
|
|
75
|
+
try {
|
|
76
|
+
await this._loginPromise;
|
|
77
|
+
} finally {
|
|
78
|
+
this._loginPromise = null;
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
logout() {
|
|
82
|
+
if (this._logoutPromise) {
|
|
83
|
+
return _type.FcrReturnCode.SUCCESS;
|
|
84
|
+
}
|
|
85
|
+
this._isLogoutRequested = true;
|
|
86
|
+
this._logoutPromise = this._performLogout();
|
|
87
|
+
return _type.FcrReturnCode.SUCCESS;
|
|
88
|
+
}
|
|
89
|
+
getConnectionState() {
|
|
90
|
+
return this._connectionState;
|
|
91
|
+
}
|
|
92
|
+
getConnectionInstance() {
|
|
93
|
+
return this._conn;
|
|
94
|
+
}
|
|
95
|
+
addObserver(observer) {
|
|
96
|
+
this._observable.addObserver(observer);
|
|
97
|
+
}
|
|
98
|
+
removeObserver(observer) {
|
|
99
|
+
this._observable.removeObserver(observer);
|
|
100
|
+
}
|
|
101
|
+
async _performLogin() {
|
|
53
102
|
const privateConfig = this._getPrivateConfig();
|
|
54
103
|
if (privateConfig) {
|
|
55
104
|
this.logger.info('use private config:', JSON.stringify(privateConfig));
|
|
56
105
|
}
|
|
57
|
-
|
|
106
|
+
const [abort, promise] = (0, _abortableRetry.abortableRetry)(async signal => {
|
|
58
107
|
const tokenResult = await this._api.getUserToken(this._userId);
|
|
108
|
+
signal.throwIfAborted();
|
|
59
109
|
this._initConfig = tokenResult;
|
|
110
|
+
const appKey = tokenResult.appKey;
|
|
60
111
|
const connParams = {
|
|
61
112
|
..._config.agoraChatConfig,
|
|
62
113
|
...privateConfig,
|
|
63
|
-
appKey
|
|
64
|
-
autoReconnectNumMax: 99999,
|
|
65
|
-
isFixedDeviceId: false
|
|
114
|
+
appKey
|
|
66
115
|
};
|
|
67
116
|
_imports.EasemobChatSDK.logger.setConsoleLogVisibility(false);
|
|
68
117
|
this._conn = new _imports.EasemobChatSDK.connection(connParams);
|
|
69
|
-
this._addEventListeners();
|
|
118
|
+
this._addEventListeners(this._conn);
|
|
70
119
|
await this._conn.open({
|
|
71
120
|
accessToken: this._initConfig.token,
|
|
72
121
|
user: this._userId
|
|
73
122
|
});
|
|
74
|
-
this.logger.info(`
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
if (error
|
|
84
|
-
|
|
123
|
+
this.logger.info(`login success, token: ${this._initConfig.token}, userId: ${this._userId}`);
|
|
124
|
+
}, {
|
|
125
|
+
retriesMax: Infinity
|
|
126
|
+
});
|
|
127
|
+
this._abortLogin = abort;
|
|
128
|
+
const [error] = await promise;
|
|
129
|
+
this._abortLogin = null;
|
|
130
|
+
if (error) {
|
|
131
|
+
await this._closeConnection();
|
|
132
|
+
if (error.name === 'AbortError' && this._isLogoutRequested) {
|
|
133
|
+
return;
|
|
85
134
|
}
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
135
|
+
throw error;
|
|
136
|
+
}
|
|
137
|
+
if (this._isLogoutRequested) {
|
|
138
|
+
await this._closeConnection();
|
|
139
|
+
}
|
|
90
140
|
}
|
|
91
|
-
_addEventListeners() {
|
|
92
|
-
|
|
141
|
+
_addEventListeners(conn) {
|
|
142
|
+
conn.addEventHandler('connectionListener', {
|
|
93
143
|
onError: e => {
|
|
94
144
|
this.logger.error('onError', e.message);
|
|
95
145
|
},
|
|
96
146
|
onConnected: () => {
|
|
97
147
|
this.logger.info('onConnected');
|
|
98
|
-
|
|
99
|
-
this._setConnectionState(_type.FcrChatConnectionState.CONNECTED);
|
|
100
|
-
}
|
|
101
|
-
},
|
|
102
|
-
onDisconnected: () => {
|
|
103
|
-
if (this._connectionState !== _type.FcrChatConnectionState.DISCONNECTED) {
|
|
104
|
-
this.logger.info('onDisconnected');
|
|
105
|
-
this._setConnectionState(_type.FcrChatConnectionState.DISCONNECTED);
|
|
106
|
-
}
|
|
148
|
+
this._handleConnected();
|
|
107
149
|
},
|
|
108
150
|
onOnline: () => {
|
|
109
151
|
this.logger.info('onOnline');
|
|
110
|
-
|
|
111
|
-
this._setConnectionState(_type.FcrChatConnectionState.CONNECTED);
|
|
112
|
-
}
|
|
152
|
+
this._handleConnected();
|
|
113
153
|
},
|
|
114
154
|
onOffline: () => {
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
155
|
+
this.logger.info('onOffline');
|
|
156
|
+
this._handleDisconnected();
|
|
157
|
+
},
|
|
158
|
+
onDisconnected: () => {
|
|
159
|
+
this.logger.info('onDisconnected');
|
|
160
|
+
this._handleDisconnected();
|
|
119
161
|
}
|
|
120
162
|
});
|
|
121
163
|
}
|
|
122
|
-
|
|
123
|
-
|
|
164
|
+
async _performLogout() {
|
|
165
|
+
try {
|
|
166
|
+
if (this._reconnectionTimer) {
|
|
167
|
+
clearTimeout(this._reconnectionTimer);
|
|
168
|
+
this._reconnectionTimer = null;
|
|
169
|
+
}
|
|
170
|
+
if (this._abortLogin) {
|
|
171
|
+
this._abortLogin();
|
|
172
|
+
this._abortLogin = null;
|
|
173
|
+
}
|
|
174
|
+
await this._waitForLoginComplete();
|
|
175
|
+
await this._closeConnection();
|
|
176
|
+
} catch (error) {
|
|
177
|
+
this.logger.error('logout error', error.message);
|
|
178
|
+
} finally {
|
|
179
|
+
this._logoutPromise = null;
|
|
180
|
+
this._isLogoutRequested = false;
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
async _waitForLoginComplete() {
|
|
184
|
+
if (!this._loginPromise) {
|
|
185
|
+
return;
|
|
186
|
+
}
|
|
187
|
+
try {
|
|
188
|
+
await this._loginPromise;
|
|
189
|
+
} catch (error) {
|
|
190
|
+
this.logger.error('login error during logout', error.message);
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
async _closeConnection() {
|
|
194
|
+
const conn = this._conn;
|
|
195
|
+
this._conn = null;
|
|
196
|
+
if (conn) {
|
|
197
|
+
try {
|
|
198
|
+
conn.removeEventHandler('connectionListener');
|
|
199
|
+
await Promise.resolve(conn.close?.());
|
|
200
|
+
} catch (error) {
|
|
201
|
+
this.logger.error('close connection error', error.message);
|
|
202
|
+
}
|
|
203
|
+
}
|
|
204
|
+
this._setConnectionState(_type2.FcrChatConnectionState.DISCONNECTED);
|
|
124
205
|
}
|
|
125
206
|
_setConnectionState(state) {
|
|
207
|
+
if (this._connectionState === state) {
|
|
208
|
+
return;
|
|
209
|
+
}
|
|
126
210
|
this._connectionState = state;
|
|
127
211
|
this._observable.notifyObservers('onConnectionStateUpdated', state);
|
|
128
212
|
}
|
|
129
|
-
getConnectionState() {
|
|
130
|
-
return this._connectionState;
|
|
131
|
-
}
|
|
132
|
-
getConnectionInstance() {
|
|
133
|
-
return this._conn;
|
|
134
|
-
}
|
|
135
|
-
addObserver(observer) {
|
|
136
|
-
this._observable.addObserver(observer);
|
|
137
|
-
}
|
|
138
|
-
removeObserver(observer) {
|
|
139
|
-
this._observable.removeObserver(observer);
|
|
140
|
-
}
|
|
141
213
|
_getPrivateConfig() {
|
|
142
214
|
if (this._chatIpList?.length || this._restIpList?.length) {
|
|
143
215
|
const privateConfig = {
|
|
@@ -152,5 +224,53 @@ class FcrChatConnectionImpl {
|
|
|
152
224
|
return privateConfig;
|
|
153
225
|
}
|
|
154
226
|
}
|
|
227
|
+
_handleConnected() {
|
|
228
|
+
if (this._isLogoutRequested) {
|
|
229
|
+
return;
|
|
230
|
+
}
|
|
231
|
+
if (this._connectionState !== _type2.FcrChatConnectionState.CONNECTED) {
|
|
232
|
+
this._setConnectionState(_type2.FcrChatConnectionState.CONNECTED);
|
|
233
|
+
} else {
|
|
234
|
+
// notify again in case of reconnection
|
|
235
|
+
this._observable.notifyObservers('onConnectionStateUpdated', _type2.FcrChatConnectionState.CONNECTED);
|
|
236
|
+
}
|
|
237
|
+
}
|
|
238
|
+
_handleDisconnected() {
|
|
239
|
+
if (this._connectionState !== _type2.FcrChatConnectionState.DISCONNECTED) {
|
|
240
|
+
this._setConnectionState(_type2.FcrChatConnectionState.DISCONNECTED);
|
|
241
|
+
}
|
|
242
|
+
if (this._isLogoutRequested) {
|
|
243
|
+
return;
|
|
244
|
+
}
|
|
245
|
+
this._reconnect();
|
|
246
|
+
}
|
|
247
|
+
async _reconnect() {
|
|
248
|
+
if (this._loginPromise || this._reconnectPromise) {
|
|
249
|
+
return;
|
|
250
|
+
}
|
|
251
|
+
const doReconnect = async () => {
|
|
252
|
+
await this._closeConnection();
|
|
253
|
+
|
|
254
|
+
// add a short delay to avoid tight reconnect loops
|
|
255
|
+
await new Promise(resolve => {
|
|
256
|
+
this._reconnectionTimer = setTimeout(resolve, _imports.AgoraScheduler.Duration.second(1));
|
|
257
|
+
});
|
|
258
|
+
this._reconnectionTimer = null;
|
|
259
|
+
if (this._isLogoutRequested) {
|
|
260
|
+
return;
|
|
261
|
+
}
|
|
262
|
+
try {
|
|
263
|
+
await this.login();
|
|
264
|
+
} catch (error) {
|
|
265
|
+
this.logger.error('reconnect error', error.message);
|
|
266
|
+
}
|
|
267
|
+
};
|
|
268
|
+
this._reconnectPromise = doReconnect().finally(() => {
|
|
269
|
+
this._reconnectPromise = null;
|
|
270
|
+
});
|
|
271
|
+
}
|
|
272
|
+
_addLogObserver() {
|
|
273
|
+
this.addObserver((0, _logger.generateLogObserver)(this.logger, [['onConnectionStateUpdated', ['state']]]));
|
|
274
|
+
}
|
|
155
275
|
}
|
|
156
|
-
exports.
|
|
276
|
+
exports.FcrChatConnectorImpl = FcrChatConnectorImpl;
|
|
@@ -22,8 +22,9 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
22
22
|
});
|
|
23
23
|
exports.FcrAbilityControlImpl = void 0;
|
|
24
24
|
var _imports = require("../../imports");
|
|
25
|
+
var _type = require("../../type");
|
|
25
26
|
var _logger = require("../../utilities/logger");
|
|
26
|
-
let _initProto;
|
|
27
|
+
let _initProto, _isPlatformAbilitySupportedDecs;
|
|
27
28
|
function _applyDecs(e, t, r, n, o, a) { function i(e, t, r) { return function (n, o) { return r && r(n), e[t].call(n, o); }; } function c(e, t) { for (var r = 0; r < e.length; r++) e[r].call(t); return t; } function s(e, t, r, n) { if ("function" != typeof e && (n || void 0 !== e)) throw new TypeError(t + " must " + (r || "be") + " a function" + (n ? "" : " or undefined")); return e; } function applyDec(e, t, r, n, o, a, c, u, l, f, p, d, h) { function m(e) { if (!h(e)) throw new TypeError("Attempted to access private element on non-instance"); } var y, v = t[0], g = t[3], b = !u; if (!b) { r || Array.isArray(v) || (v = [v]); var w = {}, S = [], A = 3 === o ? "get" : 4 === o || d ? "set" : "value"; f ? (p || d ? w = { get: _setFunctionName(function () { return g(this); }, n, "get"), set: function (e) { t[4](this, e); } } : w[A] = g, p || _setFunctionName(w[A], n, 2 === o ? "" : A)) : p || (w = Object.getOwnPropertyDescriptor(e, n)); } for (var P = e, j = v.length - 1; j >= 0; j -= r ? 2 : 1) { var D = v[j], E = r ? v[j - 1] : void 0, I = {}, O = { kind: ["field", "accessor", "method", "getter", "setter", "class"][o], name: n, metadata: a, addInitializer: function (e, t) { if (e.v) throw Error("attempted to call addInitializer after decoration was finished"); s(t, "An initializer", "be", !0), c.push(t); }.bind(null, I) }; try { if (b) (y = s(D.call(E, P, O), "class decorators", "return")) && (P = y);else { var k, F; O.static = l, O.private = f, f ? 2 === o ? k = function (e) { return m(e), w.value; } : (o < 4 && (k = i(w, "get", m)), 3 !== o && (F = i(w, "set", m))) : (k = function (e) { return e[n]; }, (o < 2 || 4 === o) && (F = function (e, t) { e[n] = t; })); var N = O.access = { has: f ? h.bind() : function (e) { return n in e; } }; if (k && (N.get = k), F && (N.set = F), P = D.call(E, d ? { get: w.get, set: w.set } : w[A], O), d) { if ("object" == typeof P && P) (y = s(P.get, "accessor.get")) && (w.get = y), (y = s(P.set, "accessor.set")) && (w.set = y), (y = s(P.init, "accessor.init")) && S.push(y);else if (void 0 !== P) throw new TypeError("accessor decorators must return an object with get, set, or init properties or void 0"); } else s(P, (p ? "field" : "method") + " decorators", "return") && (p ? S.push(P) : w[A] = P); } } finally { I.v = !0; } } return (p || d) && u.push(function (e, t) { for (var r = S.length - 1; r >= 0; r--) t = S[r].call(e, t); return t; }), p || b || (f ? d ? u.push(i(w, "get"), i(w, "set")) : u.push(2 === o ? w[A] : i.call.bind(w[A])) : Object.defineProperty(e, n, w)), P; } function u(e, t) { return Object.defineProperty(e, Symbol.metadata || Symbol.for("Symbol.metadata"), { configurable: !0, enumerable: !0, value: t }); } if (arguments.length >= 6) var l = a[Symbol.metadata || Symbol.for("Symbol.metadata")]; var f = Object.create(null == l ? null : l), p = function (e, t, r, n) { var o, a, i = [], s = function (t) { return _checkInRHS(t) === e; }, u = new Map(); function l(e) { e && i.push(c.bind(null, e)); } for (var f = 0; f < t.length; f++) { var p = t[f]; if (Array.isArray(p)) { var d = p[1], h = p[2], m = p.length > 3, y = 16 & d, v = !!(8 & d), g = 0 == (d &= 7), b = h + "/" + v; if (!g && !m) { var w = u.get(b); if (!0 === w || 3 === w && 4 !== d || 4 === w && 3 !== d) throw Error("Attempted to decorate a public method/accessor that has the same name as a previously decorated public method/accessor. This is not currently supported by the decorators plugin. Property name was: " + h); u.set(b, !(d > 2) || d); } applyDec(v ? e : e.prototype, p, y, m ? "#" + h : _toPropertyKey(h), d, n, v ? a = a || [] : o = o || [], i, v, m, g, 1 === d, v && m ? s : r); } } return l(o), l(a), i; }(e, t, o, f); return r.length || u(e, f), { e: p, get c() { var t = []; return r.length && [u(applyDec(e, [r], n, e.name, 5, f, t), f), c.bind(null, t, e)]; } }; }
|
|
28
29
|
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
|
|
29
30
|
function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
@@ -35,10 +36,10 @@ function _checkInRHS(e) { if (Object(e) !== e) throw TypeError("right-hand side
|
|
|
35
36
|
*/
|
|
36
37
|
class FcrAbilityControlImpl {
|
|
37
38
|
static {
|
|
38
|
-
[_initProto] = _applyDecs(this, [[
|
|
39
|
+
[_initProto] = _applyDecs(this, [[_isPlatformAbilitySupportedDecs, 2, "isPlatformAbilitySupported"]], []).e;
|
|
39
40
|
}
|
|
40
41
|
//@internal
|
|
41
|
-
logger = (_initProto(this), (0, _logger.createLogger)({
|
|
42
|
+
[(_isPlatformAbilitySupportedDecs = (0, _imports.trace)(['platform', 'ability']), "logger")] = (_initProto(this), (0, _logger.createLogger)({
|
|
42
43
|
prefix: 'FcrAbilityControlImpl'
|
|
43
44
|
}));
|
|
44
45
|
constructor(_scene) {
|
|
@@ -47,7 +48,7 @@ class FcrAbilityControlImpl {
|
|
|
47
48
|
getPlatformAbility(ability) {
|
|
48
49
|
const platforms = this._scene.getScenePropertiesByKeyPath(`setting.ability.${ability}`);
|
|
49
50
|
if (!Array.isArray(platforms)) {
|
|
50
|
-
return [];
|
|
51
|
+
return [_type.FcrPlatform.WEB_DESKTOP, _type.FcrPlatform.MACOS, _type.FcrPlatform.WINDOWS, _type.FcrPlatform.IOS, _type.FcrPlatform.ANDROID, _type.FcrPlatform.WEB_MOBILE, _type.FcrPlatform.HARMONY, _type.FcrPlatform.CONNECTOR_PSTN, _type.FcrPlatform.CONNECTOR_SIP, _type.FcrPlatform.CONNECTOR_H323];
|
|
51
52
|
}
|
|
52
53
|
return platforms;
|
|
53
54
|
}
|
|
@@ -7,7 +7,11 @@ export declare enum FcrAbility {
|
|
|
7
7
|
Annotation = "annotation",
|
|
8
8
|
Caption = "caption",
|
|
9
9
|
Transcribe = "transcribe",
|
|
10
|
-
Recording = "recording"
|
|
10
|
+
Recording = "recording",
|
|
11
|
+
Board = "board",
|
|
12
|
+
SettingVirtualBackground = "setting:virtualBackground",
|
|
13
|
+
SettingBeautyMode = "setting:beautyMode",
|
|
14
|
+
PstnCallOut = "pstn:callOut"
|
|
11
15
|
}
|
|
12
16
|
export interface FcrAbilityControl {
|
|
13
17
|
isAbilitySupported(ability: FcrAbility): boolean;
|
|
@@ -13,5 +13,9 @@ let FcrAbility = exports.FcrAbility = /*#__PURE__*/function (FcrAbility) {
|
|
|
13
13
|
FcrAbility["Caption"] = "caption";
|
|
14
14
|
FcrAbility["Transcribe"] = "transcribe";
|
|
15
15
|
FcrAbility["Recording"] = "recording";
|
|
16
|
+
FcrAbility["Board"] = "board";
|
|
17
|
+
FcrAbility["SettingVirtualBackground"] = "setting:virtualBackground";
|
|
18
|
+
FcrAbility["SettingBeautyMode"] = "setting:beautyMode";
|
|
19
|
+
FcrAbility["PstnCallOut"] = "pstn:callOut";
|
|
16
20
|
return FcrAbility;
|
|
17
21
|
}({});
|
|
@@ -1,35 +1,6 @@
|
|
|
1
1
|
import { FcrChatRoomFileSchema, FcrChatRoomSendBaseMessageSchema, FcrChatRoomSendImageMessageSchema, FcrChatRoomSendTextMessageSchema } from '../../schema';
|
|
2
2
|
import { FcrUserInfo } from '../../type';
|
|
3
3
|
import { FcrError } from '../../utilities/error';
|
|
4
|
-
export interface FcrChatRoomControl {
|
|
5
|
-
join(): Promise<void>;
|
|
6
|
-
/**
|
|
7
|
-
* Gets the connection state of the chat room.
|
|
8
|
-
*/
|
|
9
|
-
getConnectionState(): FcrChatRoomConnectionState;
|
|
10
|
-
/**
|
|
11
|
-
* Sends a message to the chat room.
|
|
12
|
-
* @param message
|
|
13
|
-
* @param onProgress
|
|
14
|
-
*/
|
|
15
|
-
sendMessage(message: FcrChatRoomSendBaseMessage, progress?: (progress: number) => void): Promise<FcrChatRoomReceivedBaseMessage>;
|
|
16
|
-
/**
|
|
17
|
-
* Adds an observer to the chat room.
|
|
18
|
-
* @param observer
|
|
19
|
-
*/
|
|
20
|
-
addObserver(observer: FcrChatRoomObserver): void;
|
|
21
|
-
/**
|
|
22
|
-
* Removes the observer from the chat room.
|
|
23
|
-
* @param observer
|
|
24
|
-
*/
|
|
25
|
-
removeObserver(observer: FcrChatRoomObserver): void;
|
|
26
|
-
/**
|
|
27
|
-
* Gets the history message list of the chat room.
|
|
28
|
-
* @param pageSize
|
|
29
|
-
* @param startedMessageId
|
|
30
|
-
*/
|
|
31
|
-
getHistoryMessageList(pageSize: number, startedMessageId?: string): Promise<FcrChatRoomReceivedBaseMessage[]>;
|
|
32
|
-
}
|
|
33
4
|
export declare enum FcrChatRoomConnectionState {
|
|
34
5
|
Disconnected = 0,
|
|
35
6
|
Connecting = 1,
|
|
@@ -59,6 +30,50 @@ export type FcrChatRoomReceivedImageMessage = FcrChatRoomReceivedBaseMessage & {
|
|
|
59
30
|
};
|
|
60
31
|
export type FcrChatRoomSendImageMessage = FcrChatRoomSendImageMessageSchema;
|
|
61
32
|
export type FcrChatRoomReceiveCustomMessage = FcrChatRoomReceivedBaseMessage & {};
|
|
33
|
+
export type FcrChatRoomControlInitConfig = {
|
|
34
|
+
appkey: string;
|
|
35
|
+
token: string;
|
|
36
|
+
roomId: string;
|
|
37
|
+
userInfo: FcrUserInfo;
|
|
38
|
+
};
|
|
39
|
+
export interface FcrChatRoomControl {
|
|
40
|
+
/**
|
|
41
|
+
* Gets the connection state of the chat room.
|
|
42
|
+
*/
|
|
43
|
+
getConnectionState(): FcrChatRoomConnectionState;
|
|
44
|
+
/**
|
|
45
|
+
* Sends a message to the chat room.
|
|
46
|
+
* @param message
|
|
47
|
+
* @param onProgress
|
|
48
|
+
*/
|
|
49
|
+
sendMessage(message: FcrChatRoomSendBaseMessage, progress?: (progress: number) => void): Promise<FcrChatRoomReceivedBaseMessage>;
|
|
50
|
+
/**
|
|
51
|
+
* Adds an observer to the chat room.
|
|
52
|
+
* @param observer
|
|
53
|
+
*/
|
|
54
|
+
addObserver(observer: FcrChatRoomObserver): number;
|
|
55
|
+
/**
|
|
56
|
+
* Removes the observer from the chat room.
|
|
57
|
+
* @param observer
|
|
58
|
+
*/
|
|
59
|
+
removeObserver(observer: FcrChatRoomObserver): number;
|
|
60
|
+
/**
|
|
61
|
+
* Gets the history message list of the chat room.
|
|
62
|
+
* @param pageSize
|
|
63
|
+
* @param startedMessageId
|
|
64
|
+
*/
|
|
65
|
+
getHistoryMessageList(pageSize: number, startedMessageId?: string): Promise<FcrChatRoomReceivedBaseMessage[]>;
|
|
66
|
+
}
|
|
67
|
+
export interface FcrChatRoomControlInternal extends FcrChatRoomControl {
|
|
68
|
+
/**
|
|
69
|
+
* Joins the chat room.
|
|
70
|
+
*/
|
|
71
|
+
join(): Promise<number>;
|
|
72
|
+
/**
|
|
73
|
+
* Leaves the chat room.
|
|
74
|
+
*/
|
|
75
|
+
leave(): void;
|
|
76
|
+
}
|
|
62
77
|
export type FcrChatRoomObserver = {
|
|
63
78
|
/**
|
|
64
79
|
* Callback to receive the connection state change of the chat room.
|
|
@@ -89,9 +104,3 @@ export type FcrChatRoomObserver = {
|
|
|
89
104
|
*/
|
|
90
105
|
onImageMessageReceived?: (roomId: string, message: FcrChatRoomReceivedImageMessage) => void;
|
|
91
106
|
};
|
|
92
|
-
export type FcrChatRoomControlInitConfig = {
|
|
93
|
-
appkey: string;
|
|
94
|
-
token: string;
|
|
95
|
-
roomId: string;
|
|
96
|
-
userInfo: FcrUserInfo;
|
|
97
|
-
};
|
|
@@ -42,7 +42,7 @@ class FcrGroupControl {
|
|
|
42
42
|
[_initProto] = _applyDecs(this, [[_imports.trace, 2, "getGroupList"], [_getGroupUserListDecs, 2, "getGroupUserList"], [_addGroupsDecs, 2, "addGroups"], [_updateGroupsDecs, 2, "updateGroups"], [_deleteGroupsDecs, 2, "deleteGroups"], [_imports.trace, 2, "deleteAllGroups"], [_addUsersDecs, 2, "addUsers"], [_removeUsersDecs, 2, "removeUsers"], [_moveUsersDecs, 2, "moveUsers"]], []).e;
|
|
43
43
|
}
|
|
44
44
|
//@internal
|
|
45
|
-
[(_getGroupUserListDecs = [_imports.trace, (0, _validateParams.default)(_schema.stringSchema)], _addGroupsDecs = [_imports.trace, (0, _validateParams.default)(_schema.fcrGroupCreateConfigArraySchema)], _updateGroupsDecs = [_imports.trace, (0, _validateParams.default)(_schema.fcrGroupUpdateOptionsArraySchema)], _deleteGroupsDecs = [_imports.trace, (0, _validateParams.default)(_schema.stringArraySchema)], _addUsersDecs = [_imports.trace, (0, _validateParams.default)(_schema.stringArraySchema, _schema.stringSchema)], _removeUsersDecs = [_imports.trace, (0, _validateParams.default)(_schema.stringArraySchema, _schema.stringSchema)], _moveUsersDecs = [_imports.trace, (0, _validateParams.default)(_schema.stringArraySchema, _schema.stringSchema, _schema.stringSchema)], "logger")] = (_initProto(this), (0, _logger.createLogger)({
|
|
45
|
+
[(_getGroupUserListDecs = [(0, _imports.trace)(['groupId']), (0, _validateParams.default)(_schema.stringSchema)], _addGroupsDecs = [(0, _imports.trace)(['groups']), (0, _validateParams.default)(_schema.fcrGroupCreateConfigArraySchema)], _updateGroupsDecs = [(0, _imports.trace)(['groups']), (0, _validateParams.default)(_schema.fcrGroupUpdateOptionsArraySchema)], _deleteGroupsDecs = [(0, _imports.trace)(['groupIds']), (0, _validateParams.default)(_schema.stringArraySchema)], _addUsersDecs = [(0, _imports.trace)(['userList', 'groupId']), (0, _validateParams.default)(_schema.stringArraySchema, _schema.stringSchema)], _removeUsersDecs = [(0, _imports.trace)(['userList', 'groupId']), (0, _validateParams.default)(_schema.stringArraySchema, _schema.stringSchema)], _moveUsersDecs = [(0, _imports.trace)(['userList', 'fromGroupId', 'toGroupId']), (0, _validateParams.default)(_schema.stringArraySchema, _schema.stringSchema, _schema.stringSchema)], "logger")] = (_initProto(this), (0, _logger.createLogger)({
|
|
46
46
|
prefix: 'FcrGroupControl'
|
|
47
47
|
}));
|
|
48
48
|
//@internal
|
|
@@ -208,37 +208,37 @@ class FcrGroupControl {
|
|
|
208
208
|
return (0, _error.handleRequestError)(() => this._api.addGroups(groups, {
|
|
209
209
|
roomId: this._scene.sceneId,
|
|
210
210
|
startTime: Date.now()
|
|
211
|
-
}),
|
|
211
|
+
}), _imports.ErrorModuleCode.FCR_ROOM_GROUP, 'add groups failed');
|
|
212
212
|
}
|
|
213
213
|
updateGroups(groups) {
|
|
214
214
|
return (0, _error.handleRequestError)(() => this._api.updateGroups(groups, {
|
|
215
215
|
roomId: this._scene.sceneId
|
|
216
|
-
}),
|
|
216
|
+
}), _imports.ErrorModuleCode.FCR_ROOM_GROUP, 'update groups failed');
|
|
217
217
|
}
|
|
218
218
|
deleteGroups(groupIds) {
|
|
219
219
|
return (0, _error.handleRequestError)(() => this._api.deleteGroups(groupIds, {
|
|
220
220
|
roomId: this._scene.sceneId
|
|
221
|
-
}),
|
|
221
|
+
}), _imports.ErrorModuleCode.FCR_ROOM_GROUP, 'delete groups failed');
|
|
222
222
|
}
|
|
223
223
|
deleteAllGroups() {
|
|
224
224
|
return (0, _error.handleRequestError)(() => this._api.deleteAllGroups({
|
|
225
225
|
roomId: this._scene.sceneId
|
|
226
|
-
}),
|
|
226
|
+
}), _imports.ErrorModuleCode.FCR_ROOM_GROUP, 'delete all groups failed');
|
|
227
227
|
}
|
|
228
228
|
addUsers(userList, groupId) {
|
|
229
229
|
return (0, _error.handleRequestError)(() => this._api.addUsers(userList, groupId, {
|
|
230
230
|
roomId: this._scene.sceneId
|
|
231
|
-
}),
|
|
231
|
+
}), _imports.ErrorModuleCode.FCR_ROOM_GROUP, 'add users failed');
|
|
232
232
|
}
|
|
233
233
|
removeUsers(userList, groupId) {
|
|
234
234
|
return (0, _error.handleRequestError)(() => this._api.removeUsers(userList, groupId, {
|
|
235
235
|
roomId: this._scene.sceneId
|
|
236
|
-
}),
|
|
236
|
+
}), _imports.ErrorModuleCode.FCR_ROOM_GROUP, 'remove users failed');
|
|
237
237
|
}
|
|
238
238
|
moveUsers(userList, fromGroupId, toGroupId) {
|
|
239
239
|
return (0, _error.handleRequestError)(() => this._api.moveUsers(userList, fromGroupId, toGroupId, {
|
|
240
240
|
roomId: this._scene.sceneId
|
|
241
|
-
}),
|
|
241
|
+
}), _imports.ErrorModuleCode.FCR_ROOM_GROUP, 'move users failed');
|
|
242
242
|
}
|
|
243
243
|
// createSubRoomControl(groupId: string) {
|
|
244
244
|
// return new FcrSubRoomControlImpl(
|
|
@@ -256,7 +256,7 @@ class FcrGroupControl {
|
|
|
256
256
|
this._observable.removeObserver(observer);
|
|
257
257
|
}
|
|
258
258
|
_addLogObserver() {
|
|
259
|
-
this.addObserver((0, _logger.generateLogObserver)(this.logger, ['onGroupsAdded', 'onGroupsUpdated', 'onGroupsRemoved', 'onUserListAddedToGroup', 'onUserListRemovedFromGroup', 'onUserListMoveToGroup']));
|
|
259
|
+
this.addObserver((0, _logger.generateLogObserver)(this.logger, [['onGroupsAdded', ['events']], ['onGroupsUpdated', ['events']], ['onGroupsRemoved', ['events']], ['onUserListAddedToGroup', ['events']], ['onUserListRemovedFromGroup', ['events']], ['onUserListMoveToGroup', ['events']]]));
|
|
260
260
|
}
|
|
261
261
|
}
|
|
262
262
|
exports.FcrGroupControl = FcrGroupControl;
|