fcr-core 3.7.5 → 3.7.7-rc.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/lib/chat-connection/index.js +34 -20
- package/lib/engine/index.js +62 -69
- package/lib/imports.js +1 -0
- package/lib/media-control/desktop.js +13 -8
- package/lib/media-control/mobile.js +17 -12
- package/lib/monitor-control/index.js +9 -4
- package/lib/peer-session/index.js +47 -38
- package/lib/plugins/chatroom.js +217 -202
- package/lib/room-control/ability-control/index.js +13 -8
- package/lib/room-control/group-control/index.js +20 -15
- package/lib/room-control/helpers/validation-helper.js +1 -1
- package/lib/room-control/index.js +53 -36
- package/lib/room-control/interpreter-control/index.js +23 -17
- package/lib/room-control/interpreter-control/room.js +6 -4
- package/lib/room-control/join-before-host-waitingroom-control/index.js +6 -4
- package/lib/room-control/mainroom-control/index.js +24 -16
- package/lib/room-control/privilege-control/helper.js +8 -5
- package/lib/room-control/privilege-control/index.js +25 -18
- package/lib/room-control/room-connector-control/index.js +22 -15
- package/lib/room-control/room-control-factory.js +2 -1
- package/lib/room-control/room-session/index.js +47 -38
- package/lib/room-control/shared-cache.js +36 -29
- package/lib/room-control/sharing-control/index.js +40 -29
- package/lib/room-control/stream-control/index.js +177 -172
- package/lib/room-control/user-control/index.js +142 -135
- package/lib/room-control/waitingroom-control/index.js +13 -8
- package/lib/room-control/whiteboard-control-v2/annotation-control/control.js +25 -18
- package/lib/room-control/whiteboard-control-v2/annotation-control/index.js +26 -15
- package/lib/room-control/whiteboard-control-v2/annotation-control/privilege-control.js +62 -52
- package/lib/room-control/whiteboard-control-v2/index.js +35 -24
- package/lib/room-control/whiteboard-control-v2/main-window.js +27 -22
- package/lib/room-control/whiteboard-control-v2/utils.js +5 -5
- package/lib/room-control/whiteboard-control-v2/whiteboard-control/control.js +32 -23
- package/lib/room-control/whiteboard-control-v2/whiteboard-control/index.js +5 -3
- package/lib/room-control/whiteboard-control-v2/whiteboard-control/privilege-control.js +53 -41
- package/lib/room-router/index.js +67 -34
- package/lib/room-router/type.d.ts +4 -0
- package/lib/service/api.d.ts +12 -1
- package/lib/service/api.js +98 -88
- package/lib/utilities/collection.js +3 -2
- package/lib/utilities/error-helpers.js +32 -26
- package/lib/utilities/error.js +9 -8
- package/lib/utilities/join-helper.js +22 -18
- package/lib/utilities/logger.js +2 -2
- package/lib/utilities/parameters.js +8 -4
- package/lib/utilities/retry-helpers.js +1 -0
- package/lib/utilities/shared-storage.js +1 -0
- package/lib/utilities/storage.js +1 -0
- package/lib/utilities/stream.js +16 -11
- package/lib/utilities/user.js +4 -3
- package/lib/utilities/validate-params.js +2 -1
- package/package.json +4 -4
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
+
require("core-js/modules/es.symbol.description.js");
|
|
4
|
+
require("core-js/modules/es.error.cause.js");
|
|
3
5
|
require("core-js/modules/esnext.function.metadata.js");
|
|
6
|
+
require("core-js/modules/esnext.iterator.filter.js");
|
|
4
7
|
require("core-js/modules/esnext.map.delete-all.js");
|
|
5
8
|
require("core-js/modules/esnext.map.emplace.js");
|
|
6
9
|
require("core-js/modules/esnext.map.every.js");
|
|
@@ -27,6 +30,8 @@ require("core-js/modules/esnext.iterator.find.js");
|
|
|
27
30
|
require("core-js/modules/esnext.iterator.for-each.js");
|
|
28
31
|
require("core-js/modules/esnext.iterator.map.js");
|
|
29
32
|
require("core-js/modules/esnext.iterator.reduce.js");
|
|
33
|
+
require("core-js/modules/web.dom-collections.iterator.js");
|
|
34
|
+
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
30
35
|
var _imports = require("../../imports");
|
|
31
36
|
var _type = require("../../type");
|
|
32
37
|
var _user = require("../../utilities/user");
|
|
@@ -36,157 +41,157 @@ var _logger = require("../../utilities/logger");
|
|
|
36
41
|
var _error = require("../../utilities/error");
|
|
37
42
|
var _validateParams = _interopRequireDefault(require("../../utilities/validate-params"));
|
|
38
43
|
var _schema = require("../../schema");
|
|
39
|
-
var
|
|
40
|
-
let _initProto, _getUserDecs, _updateUserNameDecs, _updateUserPropertiesDecs, _updateIncrementUserPropertiesDecs, _deleteUserPropertiesDecs, _getUserPropertiesByUserIdDecs, _getUserPropertiesByKeyPathDecs, _updateRemoteUserRoleDecs, _claimHostDecs, _kickOutDecs, _kickOutByUserIdsDecs, _kickOutByUserRolesDecs, _mergeAudioStreamDecs;
|
|
44
|
+
var _FcrUserControlImpl;
|
|
45
|
+
let _initProto, _getUserDecs, _updateUserNameDecs, _updateUserPropertiesDecs, _updateIncrementUserPropertiesDecs, _deleteUserPropertiesDecs, _getUserPropertiesByUserIdDecs, _getUserPropertiesByKeyPathDecs, _updateRemoteUserRoleDecs, _claimHostDecs, _kickOutDecs, _kickOutByUserIdsDecs, _kickOutByUserRolesDecs, _mergeAudioStreamDecs, _ref;
|
|
46
|
+
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
47
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { (0, _defineProperty2.default)(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
41
48
|
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)]; } }; }
|
|
42
49
|
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
|
|
43
50
|
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); }
|
|
44
51
|
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; }
|
|
45
52
|
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; }
|
|
53
|
+
_ref = (_getUserDecs = [_imports.bound, (0, _validateParams.default)(_schema.stringSchema)], _updateUserNameDecs = [_imports.bound, _imports.trace, (0, _validateParams.default)(_schema.stringSchema, _schema.stringSchema)], _updateUserPropertiesDecs = [_imports.bound, _imports.trace, (0, _validateParams.default)(_schema.stringKeyUnknownValueSchema, _schema.stringKeyUnknownValueSchema, _schema.stringSchema)], _updateIncrementUserPropertiesDecs = [_imports.bound, _imports.trace, (0, _validateParams.default)(_schema.stringKeyNumberValueSchema, _schema.stringKeyUnknownValueSchema, _schema.stringSchema)], _deleteUserPropertiesDecs = [_imports.bound, _imports.trace, (0, _validateParams.default)(_schema.stringArraySchema, _schema.stringKeyUnknownValueSchema, _schema.stringSchema)], _getUserPropertiesByUserIdDecs = [_imports.bound, _imports.trace, (0, _validateParams.default)(_schema.stringSchema)], _getUserPropertiesByKeyPathDecs = [_imports.bound, _imports.trace, (0, _validateParams.default)(_schema.stringSchema, _schema.stringSchema)], _updateRemoteUserRoleDecs = [_imports.bound, _imports.trace, (0, _validateParams.default)(_schema.stringSchema, _schema.fcrUserRoleSchema)], _claimHostDecs = [_imports.bound, _imports.trace, (0, _validateParams.default)(_schema.stringSchema)], _kickOutDecs = [_imports.bound, _imports.trace, (0, _validateParams.default)(_schema.stringSchema, _schema.fcrUserKickedOutTypeSchema)], _kickOutByUserIdsDecs = [_imports.trace, (0, _validateParams.default)(_schema.stringArraySchema, _schema.fcrUserKickedOutTypeSchema)], _kickOutByUserRolesDecs = [_imports.trace, (0, _validateParams.default)(_schema.fcrUserRolesSchema, _schema.fcrUserKickedOutTypeSchema)], _mergeAudioStreamDecs = [_imports.trace, (0, _validateParams.default)(_schema.stringSchema)], "logger");
|
|
46
54
|
/**
|
|
47
55
|
* @internal
|
|
48
56
|
*/
|
|
49
57
|
class FcrUserControlImpl {
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
58
|
+
constructor(_scene, _api, _sharedCache) {
|
|
59
|
+
//@internal
|
|
60
|
+
(0, _defineProperty2.default)(this, _ref, (_initProto(this), (0, _logger.createLogger)({
|
|
61
|
+
prefix: 'FcrUserControlImpl'
|
|
62
|
+
})));
|
|
63
|
+
//@internal
|
|
64
|
+
(0, _defineProperty2.default)(this, "_observable", new _imports.AgoraObservable());
|
|
65
|
+
//@internal
|
|
66
|
+
(0, _defineProperty2.default)(this, "_userMapByUserId", {});
|
|
67
|
+
//@internal
|
|
68
|
+
(0, _defineProperty2.default)(this, "_userList", []);
|
|
69
|
+
//@internal
|
|
70
|
+
(0, _defineProperty2.default)(this, "_sceneObserver", {
|
|
71
|
+
onRemoteUsersJoined: (roomId, events) => {
|
|
72
|
+
events.forEach(event => {
|
|
73
|
+
const userProperties = this._scene.getUserPropertiesByUserId(event.userInfo.userId);
|
|
74
|
+
this._roomCache.setUserPlatform(event.userInfo.userId, userProperties === null || userProperties === void 0 ? void 0 : userProperties.platform);
|
|
75
|
+
this._roomCache.setUserAvatar(event.userInfo.userId, userProperties === null || userProperties === void 0 ? void 0 : userProperties.avatar);
|
|
76
|
+
});
|
|
77
|
+
const fcrUserEvents = events.map(e => {
|
|
78
|
+
return {
|
|
79
|
+
userInfo: e.userInfo && (0, _user.convertRteUserToFcrUser)(e.userInfo, this._roomCache),
|
|
80
|
+
operatorUser: e.operatorUser && (0, _user.convertRteUserToFcrUser)(e.operatorUser, this._roomCache)
|
|
81
|
+
};
|
|
82
|
+
});
|
|
83
|
+
fcrUserEvents.forEach(event => {
|
|
84
|
+
const user = event.userInfo;
|
|
85
|
+
const exists = user.userId in this._userMapByUserId;
|
|
86
|
+
if (exists) {
|
|
87
|
+
this.logger.warn("[FcrUserControl] user joined when the user already exists, userId: ".concat(user.userId));
|
|
88
|
+
} else {
|
|
89
|
+
this._userMapByUserId[user.userId] = user;
|
|
90
|
+
this._userList.push(user);
|
|
91
|
+
}
|
|
92
|
+
});
|
|
93
|
+
this._observable.notifyObservers('onRemoteUsersJoined', roomId, fcrUserEvents);
|
|
94
|
+
},
|
|
95
|
+
onRemoteUsersLeft: (roomId, events) => {
|
|
96
|
+
const fcrUserEvents = events.map(e => {
|
|
97
|
+
var _e$cause;
|
|
98
|
+
return {
|
|
99
|
+
userInfo: e.userInfo && (0, _user.convertRteUserToFcrUser)(e.userInfo, this._roomCache),
|
|
100
|
+
userProperties: e.userProperties,
|
|
101
|
+
operatorUser: e.operatorUser && (0, _user.convertRteUserToFcrUser)(e.operatorUser, this._roomCache),
|
|
102
|
+
reason: ((_e$cause = e.cause) === null || _e$cause === void 0 ? void 0 : _e$cause.cmd) === 5 ? _type2.FcrUserLeftReason.kickOut : _type2.FcrUserLeftReason.LeaveRoom
|
|
103
|
+
};
|
|
104
|
+
});
|
|
105
|
+
fcrUserEvents.forEach(event => {
|
|
106
|
+
const user = event.userInfo;
|
|
107
|
+
const exists = user.userId in this._userMapByUserId;
|
|
108
|
+
if (!exists) {
|
|
109
|
+
this.logger.warn("[FcrUserControl] user left when the user does not exist, userId: ".concat(user.userId));
|
|
110
|
+
} else {
|
|
111
|
+
delete this._userMapByUserId[user.userId];
|
|
112
|
+
const index = this._userList.findIndex(u => user.userId === u.userId);
|
|
113
|
+
if (index !== -1) {
|
|
114
|
+
this._userList.splice(index, 1);
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
});
|
|
118
|
+
events.forEach(event => {
|
|
119
|
+
this._roomCache.deleteUserPlatform(event.userInfo.userId);
|
|
120
|
+
this._roomCache.deleteUserAvatar(event.userInfo.userId);
|
|
121
|
+
});
|
|
122
|
+
this._observable.notifyObservers('onRemoteUsersLeft', roomId, fcrUserEvents);
|
|
123
|
+
},
|
|
124
|
+
onUserUpdated: (sceneId, event) => {
|
|
125
|
+
const fcrUserUpdatedEvent = {
|
|
126
|
+
modifiedUser: event.modifiedUser && (0, _user.convertRteUserToFcrUser)(event.modifiedUser, this._roomCache),
|
|
127
|
+
operatorUser: event.operatorUser && (0, _user.convertRteUserToFcrUser)(event.operatorUser, this._roomCache),
|
|
128
|
+
reason: event.reason
|
|
97
129
|
};
|
|
98
|
-
|
|
99
|
-
fcrUserEvents.forEach(event => {
|
|
100
|
-
const user = event.userInfo;
|
|
130
|
+
const user = fcrUserUpdatedEvent.modifiedUser;
|
|
101
131
|
const exists = user.userId in this._userMapByUserId;
|
|
102
132
|
if (!exists) {
|
|
103
|
-
this.logger.warn(
|
|
133
|
+
this.logger.warn("[FcrUserControl] user updated when the user does not exist, userId: ".concat(user.userId));
|
|
104
134
|
} else {
|
|
105
|
-
|
|
135
|
+
this._userMapByUserId[user.userId] = user;
|
|
106
136
|
const index = this._userList.findIndex(u => user.userId === u.userId);
|
|
107
137
|
if (index !== -1) {
|
|
108
|
-
this._userList.splice(index, 1);
|
|
109
|
-
}
|
|
110
|
-
}
|
|
111
|
-
});
|
|
112
|
-
events.forEach(event => {
|
|
113
|
-
this._roomCache.deleteUserPlatform(event.userInfo.userId);
|
|
114
|
-
this._roomCache.deleteUserAvatar(event.userInfo.userId);
|
|
115
|
-
});
|
|
116
|
-
this._observable.notifyObservers('onRemoteUsersLeft', roomId, fcrUserEvents);
|
|
117
|
-
},
|
|
118
|
-
onUserUpdated: (sceneId, event) => {
|
|
119
|
-
const fcrUserUpdatedEvent = {
|
|
120
|
-
modifiedUser: event.modifiedUser && (0, _user.convertRteUserToFcrUser)(event.modifiedUser, this._roomCache),
|
|
121
|
-
operatorUser: event.operatorUser && (0, _user.convertRteUserToFcrUser)(event.operatorUser, this._roomCache),
|
|
122
|
-
reason: event.reason
|
|
123
|
-
};
|
|
124
|
-
const user = fcrUserUpdatedEvent.modifiedUser;
|
|
125
|
-
const exists = user.userId in this._userMapByUserId;
|
|
126
|
-
if (!exists) {
|
|
127
|
-
this.logger.warn(`[FcrUserControl] user updated when the user does not exist, userId: ${user.userId}`);
|
|
128
|
-
} else {
|
|
129
|
-
this._userMapByUserId[user.userId] = user;
|
|
130
|
-
const index = this._userList.findIndex(u => user.userId === u.userId);
|
|
131
|
-
if (index !== -1) {
|
|
132
|
-
this._userList.splice(index, 1, user);
|
|
133
|
-
}
|
|
134
|
-
}
|
|
135
|
-
this._observable.notifyObservers('onUserInfoUpdated', sceneId, fcrUserUpdatedEvent);
|
|
136
|
-
},
|
|
137
|
-
onAllUserCountUpdated: (sceneId, count) => {
|
|
138
|
-
this._observable.notifyObservers('onAllUserCountUpdated', sceneId, count);
|
|
139
|
-
},
|
|
140
|
-
onUserPropertiesUpdated: (roomId, event) => {
|
|
141
|
-
if (event.cause?.cmd === 5 && event.modifiedUser.userId === this._localUserId) {
|
|
142
|
-
const {
|
|
143
|
-
changedProperties
|
|
144
|
-
} = event;
|
|
145
|
-
const dirtyStateMap = {
|
|
146
|
-
'0': _type2.FcrUserKickedOutType.Once,
|
|
147
|
-
'1': _type2.FcrUserKickedOutType.Forever,
|
|
148
|
-
'2': 2
|
|
149
|
-
};
|
|
150
|
-
const key = (0, _imports.get)(changedProperties, 'dirty.state');
|
|
151
|
-
const type = dirtyStateMap[key];
|
|
152
|
-
this._observable.notifyObservers('onLocalUserKickedOut', roomId, {
|
|
153
|
-
type
|
|
154
|
-
});
|
|
155
|
-
}
|
|
156
|
-
if (event.cause?.cmd === 8) {
|
|
157
|
-
const changedProperties = {};
|
|
158
|
-
for (const key in event.changedProperties) {
|
|
159
|
-
if (key.startsWith('flexProps')) {
|
|
160
|
-
changedProperties[key] = event.changedProperties[key];
|
|
138
|
+
this._userList.splice(index, 1, user);
|
|
161
139
|
}
|
|
162
140
|
}
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
141
|
+
this._observable.notifyObservers('onUserInfoUpdated', sceneId, fcrUserUpdatedEvent);
|
|
142
|
+
},
|
|
143
|
+
onAllUserCountUpdated: (sceneId, count) => {
|
|
144
|
+
this._observable.notifyObservers('onAllUserCountUpdated', sceneId, count);
|
|
145
|
+
},
|
|
146
|
+
onUserPropertiesUpdated: (roomId, event) => {
|
|
147
|
+
var _event$cause, _event$cause2;
|
|
148
|
+
if (((_event$cause = event.cause) === null || _event$cause === void 0 ? void 0 : _event$cause.cmd) === 5 && event.modifiedUser.userId === this._localUserId) {
|
|
149
|
+
const {
|
|
150
|
+
changedProperties
|
|
151
|
+
} = event;
|
|
152
|
+
const dirtyStateMap = {
|
|
153
|
+
'0': _type2.FcrUserKickedOutType.Once,
|
|
154
|
+
'1': _type2.FcrUserKickedOutType.Forever,
|
|
155
|
+
'2': 2
|
|
156
|
+
};
|
|
157
|
+
const key = (0, _imports.get)(changedProperties, 'dirty.state');
|
|
158
|
+
const type = dirtyStateMap[key];
|
|
159
|
+
this._observable.notifyObservers('onLocalUserKickedOut', roomId, {
|
|
160
|
+
type
|
|
168
161
|
});
|
|
169
162
|
}
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
163
|
+
if (((_event$cause2 = event.cause) === null || _event$cause2 === void 0 ? void 0 : _event$cause2.cmd) === 8) {
|
|
164
|
+
const changedProperties = {};
|
|
165
|
+
for (const key in event.changedProperties) {
|
|
166
|
+
if (key.startsWith('flexProps')) {
|
|
167
|
+
changedProperties[key] = event.changedProperties[key];
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
if (Object.keys(changedProperties).length > 0) {
|
|
171
|
+
const structure = (0, _collection.convertToStructure)(changedProperties);
|
|
172
|
+
this._observable.notifyObservers('onUserPropertiesUpdated', roomId, _objectSpread(_objectSpread({}, event), {}, {
|
|
173
|
+
changedProperties: structure['flexProps']
|
|
174
|
+
}));
|
|
178
175
|
}
|
|
179
176
|
}
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
177
|
+
},
|
|
178
|
+
onUserPropertiesDeleted: (roomId, event) => {
|
|
179
|
+
var _event$cause3;
|
|
180
|
+
if (((_event$cause3 = event.cause) === null || _event$cause3 === void 0 ? void 0 : _event$cause3.cmd) === 8) {
|
|
181
|
+
const changedKeyPaths = [];
|
|
182
|
+
for (const keyPath of event.changedKeyPaths) {
|
|
183
|
+
if (keyPath.startsWith('flexProps')) {
|
|
184
|
+
changedKeyPaths.push(keyPath);
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
if (changedKeyPaths.length > 0) {
|
|
188
|
+
this._observable.notifyObservers('onUserPropertiesDeleted', roomId, _objectSpread(_objectSpread({}, event), {}, {
|
|
189
|
+
changedKeyPaths
|
|
190
|
+
}));
|
|
191
|
+
}
|
|
185
192
|
}
|
|
186
193
|
}
|
|
187
|
-
}
|
|
188
|
-
};
|
|
189
|
-
constructor(_scene, _api, _sharedCache) {
|
|
194
|
+
});
|
|
190
195
|
this._scene = _scene;
|
|
191
196
|
this._api = _api;
|
|
192
197
|
this._sharedCache = _sharedCache;
|
|
@@ -194,8 +199,8 @@ class FcrUserControlImpl {
|
|
|
194
199
|
const users = this._scene.getUsers();
|
|
195
200
|
Object.keys(users).forEach(userId => {
|
|
196
201
|
const userProperties = this._scene.getUserPropertiesByUserId(userId);
|
|
197
|
-
this._roomCache.setUserAvatar(userId, userProperties
|
|
198
|
-
this._roomCache.setUserPlatform(userId, userProperties
|
|
202
|
+
this._roomCache.setUserAvatar(userId, userProperties === null || userProperties === void 0 ? void 0 : userProperties.avatar);
|
|
203
|
+
this._roomCache.setUserPlatform(userId, userProperties === null || userProperties === void 0 ? void 0 : userProperties.platform);
|
|
199
204
|
});
|
|
200
205
|
this._userMapByUserId = Object.keys(users).reduce((prev, userId) => {
|
|
201
206
|
prev[userId] = (0, _user.convertRteUserToFcrUser)(users[userId], this._roomCache);
|
|
@@ -275,12 +280,14 @@ class FcrUserControlImpl {
|
|
|
275
280
|
const userProperties = this._scene.getUserProperties();
|
|
276
281
|
const res = {};
|
|
277
282
|
for (const userId in userProperties) {
|
|
278
|
-
|
|
283
|
+
var _userProperties$userI;
|
|
284
|
+
res[userId] = (_userProperties$userI = userProperties[userId]) === null || _userProperties$userI === void 0 ? void 0 : _userProperties$userI['flexProps'];
|
|
279
285
|
}
|
|
280
286
|
return res;
|
|
281
287
|
}
|
|
282
288
|
getUserPropertiesByUserId(userId) {
|
|
283
|
-
|
|
289
|
+
var _this$_scene$getUserP;
|
|
290
|
+
return (_this$_scene$getUserP = this._scene.getUserPropertiesByUserId(userId)) === null || _this$_scene$getUserP === void 0 ? void 0 : _this$_scene$getUserP['flexProps'];
|
|
284
291
|
}
|
|
285
292
|
getUserPropertiesByKeyPath(keyPath, userId) {
|
|
286
293
|
return this._scene.getUserPropertiesByKeyPath('flexProps.' + keyPath, userId);
|
|
@@ -301,7 +308,7 @@ class FcrUserControlImpl {
|
|
|
301
308
|
roomId: this._scene.sceneId,
|
|
302
309
|
localRole: _type.FcrUserRoleToStringMap[_type.FcrUserRole.HOST],
|
|
303
310
|
remoteRole: _type.FcrUserRoleToStringMap[_type.FcrUserRole.PARTICIPANT],
|
|
304
|
-
userId: originHostUser
|
|
311
|
+
userId: originHostUser === null || originHostUser === void 0 ? void 0 : originHostUser.userId
|
|
305
312
|
}), _error.FcrErrorModuleCode.ROOM_USER, 'revoke host failed');
|
|
306
313
|
}
|
|
307
314
|
}
|
|
@@ -344,7 +351,7 @@ class FcrUserControlImpl {
|
|
|
344
351
|
_addLogObserver() {
|
|
345
352
|
this.addObserver((0, _logger.generateLogObserver)(this.logger, ['onRemoteUsersJoined', 'onRemoteUsersLeft', 'onUserInfoUpdated', 'onAllUserCountUpdated', 'onLocalUserKickedOut', 'onUserPropertiesUpdated', 'onUserPropertiesDeleted']));
|
|
346
353
|
}
|
|
347
|
-
static #_ = (() => _staticBlock = () => [_initProto] = _applyDecs(this, [[_imports.bound, 2, "getLocalUser"], [_imports.bound, 2, "getUsers"], [_imports.bound, 2, "getUserList"], [_getUserDecs, 2, "getUser"], [[_imports.bound, _imports.trace], 2, "getAllUserCount"], [_imports.bound, 2, "getWaterMarkContent"], [[_imports.bound, _imports.trace], 2, "fetchUserList"], [_updateUserNameDecs, 2, "updateUserName"], [_updateUserPropertiesDecs, 2, "updateUserProperties"], [_updateIncrementUserPropertiesDecs, 2, "updateIncrementUserProperties"], [_deleteUserPropertiesDecs, 2, "deleteUserProperties"], [[_imports.bound, _imports.trace], 2, "getUserProperties"], [_getUserPropertiesByUserIdDecs, 2, "getUserPropertiesByUserId"], [_getUserPropertiesByKeyPathDecs, 2, "getUserPropertiesByKeyPath"], [_updateRemoteUserRoleDecs, 2, "updateRemoteUserRole"], [[_imports.bound, _imports.trace], 2, "revokeHost"], [_claimHostDecs, 2, "claimHost"], [_kickOutDecs, 2, "kickOut"], [_kickOutByUserIdsDecs, 2, "kickOutByUserIds"], [_kickOutByUserRolesDecs, 2, "kickOutByUserRoles"], [_mergeAudioStreamDecs, 2, "mergeAudioStream"]], []).e)();
|
|
348
354
|
}
|
|
349
355
|
exports.FcrUserControlImpl = FcrUserControlImpl;
|
|
350
|
-
|
|
356
|
+
_FcrUserControlImpl = FcrUserControlImpl;
|
|
357
|
+
[_initProto] = _applyDecs(_FcrUserControlImpl, [[_imports.bound, 2, "getLocalUser"], [_imports.bound, 2, "getUsers"], [_imports.bound, 2, "getUserList"], [_getUserDecs, 2, "getUser"], [[_imports.bound, _imports.trace], 2, "getAllUserCount"], [_imports.bound, 2, "getWaterMarkContent"], [[_imports.bound, _imports.trace], 2, "fetchUserList"], [_updateUserNameDecs, 2, "updateUserName"], [_updateUserPropertiesDecs, 2, "updateUserProperties"], [_updateIncrementUserPropertiesDecs, 2, "updateIncrementUserProperties"], [_deleteUserPropertiesDecs, 2, "deleteUserProperties"], [[_imports.bound, _imports.trace], 2, "getUserProperties"], [_getUserPropertiesByUserIdDecs, 2, "getUserPropertiesByUserId"], [_getUserPropertiesByKeyPathDecs, 2, "getUserPropertiesByKeyPath"], [_updateRemoteUserRoleDecs, 2, "updateRemoteUserRole"], [[_imports.bound, _imports.trace], 2, "revokeHost"], [_claimHostDecs, 2, "claimHost"], [_kickOutDecs, 2, "kickOut"], [_kickOutByUserIdsDecs, 2, "kickOutByUserIds"], [_kickOutByUserRolesDecs, 2, "kickOutByUserRoles"], [_mergeAudioStreamDecs, 2, "mergeAudioStream"]], []).e;
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
+
require("core-js/modules/es.symbol.description.js");
|
|
4
|
+
require("core-js/modules/es.error.cause.js");
|
|
3
5
|
require("core-js/modules/es.array.push.js");
|
|
4
6
|
require("core-js/modules/esnext.function.metadata.js");
|
|
5
7
|
require("core-js/modules/esnext.map.delete-all.js");
|
|
@@ -24,6 +26,8 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
24
26
|
exports.FcrWaitingRoomControlImpl = void 0;
|
|
25
27
|
require("core-js/modules/esnext.iterator.constructor.js");
|
|
26
28
|
require("core-js/modules/esnext.iterator.map.js");
|
|
29
|
+
require("core-js/modules/web.dom-collections.iterator.js");
|
|
30
|
+
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
27
31
|
var _imports = require("../../imports");
|
|
28
32
|
var _ = require("..");
|
|
29
33
|
var _type = require("../type");
|
|
@@ -32,23 +36,24 @@ var _logger = require("../../utilities/logger");
|
|
|
32
36
|
var _error = require("../../utilities/error");
|
|
33
37
|
var _validateParams = _interopRequireDefault(require("../../utilities/validate-params"));
|
|
34
38
|
var _schema = require("../../schema");
|
|
35
|
-
var
|
|
36
|
-
let _initProto, _moveToMainRoomByUserIdsDecs, _moveToMainRoomByUserRolesDecs;
|
|
39
|
+
var _FcrWaitingRoomControlImpl;
|
|
40
|
+
let _initProto, _moveToMainRoomByUserIdsDecs, _moveToMainRoomByUserRolesDecs, _ref;
|
|
37
41
|
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)]; } }; }
|
|
38
42
|
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
|
|
39
43
|
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); }
|
|
40
44
|
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; }
|
|
41
45
|
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; }
|
|
46
|
+
_ref = (_moveToMainRoomByUserIdsDecs = [_imports.trace, (0, _validateParams.default)(_schema.stringArraySchema)], _moveToMainRoomByUserRolesDecs = [_imports.trace, (0, _validateParams.default)(_schema.fcrUserRolesSchema)], "logger");
|
|
42
47
|
/**
|
|
43
48
|
* @internal
|
|
44
49
|
*/
|
|
45
50
|
class FcrWaitingRoomControlImpl extends _.FcrBaseRoomControlImpl {
|
|
46
|
-
//@internal
|
|
47
|
-
[(_moveToMainRoomByUserIdsDecs = [_imports.trace, (0, _validateParams.default)(_schema.stringArraySchema)], _moveToMainRoomByUserRolesDecs = [_imports.trace, (0, _validateParams.default)(_schema.fcrUserRolesSchema)], "logger")] = (() => (_initProto(this), (0, _logger.createLogger)({
|
|
48
|
-
prefix: 'FcrWaitingRoomControlImpl'
|
|
49
|
-
})))();
|
|
50
51
|
constructor(engine, scene, api, config, sharedCache, chatConnection, chatRoomControl) {
|
|
51
52
|
super(engine, scene, api, config, _type.FcrRoomType.Waitingroom, chatConnection, sharedCache, chatRoomControl);
|
|
53
|
+
//@internal
|
|
54
|
+
(0, _defineProperty2.default)(this, _ref, (_initProto(this), (0, _logger.createLogger)({
|
|
55
|
+
prefix: 'FcrWaitingRoomControlImpl'
|
|
56
|
+
})));
|
|
52
57
|
this._addLogObserver();
|
|
53
58
|
}
|
|
54
59
|
addObserver(observer) {
|
|
@@ -69,7 +74,7 @@ class FcrWaitingRoomControlImpl extends _.FcrBaseRoomControlImpl {
|
|
|
69
74
|
// 'onNetworkStatsUpdated',
|
|
70
75
|
'onRoomMessageReceived', 'onRoomPropertiesDeleted', 'onRoomPropertiesUpdated', 'onRoomStateUpdated']));
|
|
71
76
|
}
|
|
72
|
-
static #_ = (() => _staticBlock = () => [_initProto] = _applyDecs(this, [[_moveToMainRoomByUserIdsDecs, 2, "moveToMainRoomByUserIds"], [_moveToMainRoomByUserRolesDecs, 2, "moveToMainRoomByUserRoles"]], [], 0, void 0, _.FcrBaseRoomControlImpl).e)();
|
|
73
77
|
}
|
|
74
78
|
exports.FcrWaitingRoomControlImpl = FcrWaitingRoomControlImpl;
|
|
75
|
-
|
|
79
|
+
_FcrWaitingRoomControlImpl = FcrWaitingRoomControlImpl;
|
|
80
|
+
[_initProto] = _applyDecs(_FcrWaitingRoomControlImpl, [[_moveToMainRoomByUserIdsDecs, 2, "moveToMainRoomByUserIds"], [_moveToMainRoomByUserRolesDecs, 2, "moveToMainRoomByUserRoles"]], [], 0, void 0, _.FcrBaseRoomControlImpl).e;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
+
require("core-js/modules/es.symbol.description.js");
|
|
3
4
|
require("core-js/modules/es.array.push.js");
|
|
4
5
|
require("core-js/modules/esnext.function.metadata.js");
|
|
5
6
|
require("core-js/modules/esnext.map.delete-all.js");
|
|
@@ -17,10 +18,16 @@ require("core-js/modules/esnext.map.reduce.js");
|
|
|
17
18
|
require("core-js/modules/esnext.map.some.js");
|
|
18
19
|
require("core-js/modules/esnext.map.update.js");
|
|
19
20
|
require("core-js/modules/esnext.symbol.metadata.js");
|
|
21
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
20
22
|
Object.defineProperty(exports, "__esModule", {
|
|
21
23
|
value: true
|
|
22
24
|
});
|
|
23
25
|
exports.FcrAnnotationControlImpl = void 0;
|
|
26
|
+
require("core-js/modules/es.error.cause.js");
|
|
27
|
+
require("core-js/modules/es.json.stringify.js");
|
|
28
|
+
require("core-js/modules/es.regexp.exec.js");
|
|
29
|
+
require("core-js/modules/web.dom-collections.iterator.js");
|
|
30
|
+
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
24
31
|
var _type = require("./type");
|
|
25
32
|
var _forgeRoom = require("@netless/forge-room");
|
|
26
33
|
var _forgeWhiteboard = require("@netless/forge-whiteboard");
|
|
@@ -31,7 +38,7 @@ var _forgeRtm = require("@netless/forge-rtm");
|
|
|
31
38
|
var _error = require("../../../utilities/error");
|
|
32
39
|
var _logger = require("../../../utilities/logger");
|
|
33
40
|
var _imports2 = require("../../../imports");
|
|
34
|
-
var
|
|
41
|
+
var _FcrAnnotationControlImpl;
|
|
35
42
|
let _initProto;
|
|
36
43
|
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)]; } }; }
|
|
37
44
|
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
|
|
@@ -39,13 +46,13 @@ function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e =
|
|
|
39
46
|
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; }
|
|
40
47
|
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; }
|
|
41
48
|
class FcrAnnotationControlImpl {
|
|
42
|
-
logger = (() => (_initProto(this), (0, _logger.createLogger)({
|
|
43
|
-
prefix: 'FcrAnnotationControlImpl'
|
|
44
|
-
})))();
|
|
45
|
-
observable = (() => new _imports2.AgoraObservable())();
|
|
46
|
-
connectState = (() => _type2.FcrConnectionState.DISCONNECTED)();
|
|
47
|
-
_openAbortController = null;
|
|
48
49
|
constructor(rtmClient, annotationConfig) {
|
|
50
|
+
(0, _defineProperty2.default)(this, "logger", (_initProto(this), (0, _logger.createLogger)({
|
|
51
|
+
prefix: 'FcrAnnotationControlImpl'
|
|
52
|
+
})));
|
|
53
|
+
(0, _defineProperty2.default)(this, "observable", new _imports2.AgoraObservable());
|
|
54
|
+
(0, _defineProperty2.default)(this, "connectState", _type2.FcrConnectionState.DISCONNECTED);
|
|
55
|
+
(0, _defineProperty2.default)(this, "_openAbortController", null);
|
|
49
56
|
this.rtmClient = rtmClient;
|
|
50
57
|
this.annotationConfig = annotationConfig;
|
|
51
58
|
this._addLogObserver();
|
|
@@ -83,7 +90,7 @@ class FcrAnnotationControlImpl {
|
|
|
83
90
|
if (annotation) {
|
|
84
91
|
annotation.permissions.addPermission(permission);
|
|
85
92
|
} else {
|
|
86
|
-
this.logger.warn(
|
|
93
|
+
this.logger.warn("add permission failed, annotation is not initialized, permission: ".concat(permission));
|
|
87
94
|
}
|
|
88
95
|
}
|
|
89
96
|
removePermission(permission) {
|
|
@@ -91,7 +98,7 @@ class FcrAnnotationControlImpl {
|
|
|
91
98
|
if (annotation) {
|
|
92
99
|
annotation.permissions.removePermission(permission);
|
|
93
100
|
} else {
|
|
94
|
-
this.logger.warn(
|
|
101
|
+
this.logger.warn("remove permission failed, annotation is not initialized, permission: ".concat(permission));
|
|
95
102
|
}
|
|
96
103
|
}
|
|
97
104
|
addObserver(observer) {
|
|
@@ -145,14 +152,14 @@ class FcrAnnotationControlImpl {
|
|
|
145
152
|
throw (0, _error.generateFcrCoreClientError)(_error.FcrErrorModuleCode.ROOM_WHITEBOARD, _error.FcrErrorCode.UNDEFINED_ERROR, 'boardToken is required', new Error('boardToken is required'));
|
|
146
153
|
}
|
|
147
154
|
if (!width) {
|
|
148
|
-
this.logger.warn(
|
|
155
|
+
this.logger.warn("annotation width is a invalid vlaue: ".concat(width, ", using default value 800"));
|
|
149
156
|
width = 800;
|
|
150
157
|
}
|
|
151
158
|
if (!height) {
|
|
152
|
-
this.logger.warn(
|
|
159
|
+
this.logger.warn("annotation height is a invalid value: ".concat(height, ", using default value 600"));
|
|
153
160
|
height = 600;
|
|
154
161
|
}
|
|
155
|
-
this.logger.info(
|
|
162
|
+
this.logger.info("open annotation with boardId: ".concat(boardId, ", boardToken: ").concat(boardToken, ", region: ").concat(region));
|
|
156
163
|
|
|
157
164
|
// @ts-ignore
|
|
158
165
|
const rtmProvider = new _forgeRtm.RTMProvider_2_2(this.rtmClient);
|
|
@@ -178,7 +185,7 @@ class FcrAnnotationControlImpl {
|
|
|
178
185
|
useMultiViews: true
|
|
179
186
|
}
|
|
180
187
|
};
|
|
181
|
-
this.logger.info(
|
|
188
|
+
this.logger.info("join params: ".concat((0, _imports2.jsonstring)(joinRoomParams)));
|
|
182
189
|
await wbRoom.joinRoom(joinRoomParams);
|
|
183
190
|
boardRoom = wbRoom;
|
|
184
191
|
whiteboard = await wbRoom.applicationManager.launchApplication(_forgeWhiteboard.WhiteboardApplication, {
|
|
@@ -200,7 +207,7 @@ class FcrAnnotationControlImpl {
|
|
|
200
207
|
if (abortController.signal.aborted) {
|
|
201
208
|
throw new Error('join board aborted');
|
|
202
209
|
}
|
|
203
|
-
this.logger.info(
|
|
210
|
+
this.logger.info("failed to join board, error: ".concat(error.message, ", current retry: ").concat(currentRetry));
|
|
204
211
|
await timeFn();
|
|
205
212
|
return true;
|
|
206
213
|
}).exec());
|
|
@@ -208,7 +215,7 @@ class FcrAnnotationControlImpl {
|
|
|
208
215
|
throw new Error('join board aborted');
|
|
209
216
|
}
|
|
210
217
|
if (error) {
|
|
211
|
-
this.logger.error(
|
|
218
|
+
this.logger.error("join board failed, ".concat(error.message, "-").concat(JSON.stringify(error)));
|
|
212
219
|
throw error;
|
|
213
220
|
}
|
|
214
221
|
whiteboard.enableCameraByMouse = false;
|
|
@@ -222,7 +229,7 @@ class FcrAnnotationControlImpl {
|
|
|
222
229
|
this.updateConnnectionState(_type2.FcrConnectionState.CONNECTED);
|
|
223
230
|
resolve(boardView);
|
|
224
231
|
} catch (e) {
|
|
225
|
-
this.logger.error(
|
|
232
|
+
this.logger.error("join board failed");
|
|
226
233
|
this.updateConnnectionState(_type2.FcrConnectionState.DISCONNECTED);
|
|
227
234
|
reject(e);
|
|
228
235
|
} finally {
|
|
@@ -233,7 +240,7 @@ class FcrAnnotationControlImpl {
|
|
|
233
240
|
_addLogObserver() {
|
|
234
241
|
this.addObserver((0, _logger.generateLogObserver)(this.logger, ['onConnectionStateUpdated', 'onActive', 'onInactive', 'onBackgroundColorUpdated']));
|
|
235
242
|
}
|
|
236
|
-
static #_ = (() => _staticBlock = () => [_initProto] = _applyDecs(this, [[_imports2.trace, 2, "open"], [_imports2.trace, 2, "close"], [_imports2.trace, 2, "getConnectionState"], [_imports2.trace, 2, "getMainWindow"], [_imports2.trace, 2, "addPermission"], [_imports2.trace, 2, "removePermission"]], []).e)();
|
|
237
243
|
}
|
|
238
244
|
exports.FcrAnnotationControlImpl = FcrAnnotationControlImpl;
|
|
239
|
-
|
|
245
|
+
_FcrAnnotationControlImpl = FcrAnnotationControlImpl;
|
|
246
|
+
[_initProto] = _applyDecs(_FcrAnnotationControlImpl, [[_imports2.trace, 2, "open"], [_imports2.trace, 2, "close"], [_imports2.trace, 2, "getConnectionState"], [_imports2.trace, 2, "getMainWindow"], [_imports2.trace, 2, "addPermission"], [_imports2.trace, 2, "removePermission"]], []).e;
|