fcr-core 3.7.9-alpha → 3.8.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-connection/index.d.ts +1 -1
- package/lib/chat-connection/index.js +41 -26
- package/lib/engine/index.js +72 -78
- package/lib/imports.d.ts +7 -2
- package/lib/imports.js +26 -4
- package/lib/index.d.ts +2 -2
- package/lib/index.js +12 -0
- package/lib/media-control/desktop.js +22 -17
- package/lib/media-control/mobile.js +38 -33
- package/lib/media-control/type.d.ts +8 -0
- package/lib/monitor-control/index.js +10 -5
- package/lib/peer-session/index.js +48 -39
- package/lib/plugins/chatroom.js +237 -205
- package/lib/room-control/ability-control/index.js +14 -9
- package/lib/room-control/ability-control/type.d.ts +4 -1
- package/lib/room-control/ability-control/type.js +3 -0
- package/lib/room-control/group-control/index.js +21 -16
- package/lib/room-control/helpers/constants.d.ts +4 -0
- package/lib/room-control/helpers/constants.js +5 -1
- package/lib/room-control/helpers/validation-helper.js +1 -1
- package/lib/room-control/index.js +66 -38
- package/lib/room-control/interpreter-control/index.js +49 -38
- 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 +90 -17
- package/lib/room-control/privilege-control/helper.js +8 -5
- package/lib/room-control/privilege-control/index.js +66 -19
- package/lib/room-control/privilege-control/type.d.ts +57 -10
- package/lib/room-control/privilege-control/type.js +17 -0
- package/lib/room-control/room-connector-control/index.js +28 -19
- package/lib/room-control/room-control-factory.js +3 -2
- package/lib/room-control/room-session/index.js +68 -49
- package/lib/room-control/room-session/type.d.ts +2 -2
- package/lib/room-control/shared-cache.js +36 -29
- package/lib/room-control/sharing-control/index.d.ts +5 -5
- package/lib/room-control/sharing-control/index.js +81 -43
- package/lib/room-control/sharing-control/type.d.ts +9 -5
- package/lib/room-control/sharing-control/type.js +6 -1
- package/lib/room-control/stream-control/index.d.ts +8 -1
- package/lib/room-control/stream-control/index.js +310 -199
- package/lib/room-control/stream-control/type.d.ts +6 -0
- package/lib/room-control/stt-control/de-compress-gzip.d.ts +1 -0
- package/lib/room-control/stt-control/de-compress-gzip.js +49 -0
- package/lib/room-control/stt-control/index.d.ts +1 -0
- package/lib/room-control/stt-control/index.js +353 -0
- package/lib/room-control/stt-control/type.d.ts +142 -0
- package/lib/room-control/stt-control/type.js +16 -0
- package/lib/room-control/type.d.ts +15 -0
- package/lib/room-control/type.js +13 -1
- package/lib/room-control/user-control/index.js +143 -136
- package/lib/room-control/waitingroom-control/index.js +14 -9
- package/lib/room-control/whiteboard-control/enum.d.ts +15 -0
- package/lib/room-control/whiteboard-control/{types.js → enum.js} +12 -1
- package/lib/room-control/whiteboard-control/type.d.ts +38 -0
- package/lib/room-control/whiteboard-control/type.js +15 -0
- package/lib/room-control/whiteboard-control/utils.d.ts +3 -0
- package/lib/room-control/whiteboard-control/utils.js +23 -0
- package/lib/room-control/whiteboard-control-v1/board-subwindow.d.ts +6 -0
- package/lib/room-control/whiteboard-control-v1/board-subwindow.js +26 -0
- package/lib/room-control/whiteboard-control-v1/board-window.d.ts +58 -0
- package/lib/room-control/whiteboard-control-v1/board-window.js +571 -0
- package/lib/room-control/{whiteboard-control/enums.d.ts → whiteboard-control-v1/enum.d.ts} +3 -17
- package/lib/room-control/{whiteboard-control/enums.js → whiteboard-control-v1/enum.js} +3 -20
- package/lib/room-control/whiteboard-control-v1/factory.d.ts +9 -0
- package/lib/room-control/whiteboard-control-v1/factory.js +22 -0
- package/lib/room-control/whiteboard-control-v1/index.d.ts +1 -0
- package/lib/room-control/whiteboard-control-v1/index.js +440 -0
- package/lib/room-control/whiteboard-control-v1/mount-manager.d.ts +4 -0
- package/lib/room-control/whiteboard-control-v1/mount-manager.js +15 -0
- package/lib/room-control/whiteboard-control-v1/type.d.ts +300 -0
- package/lib/room-control/whiteboard-control-v1/type.js +13 -0
- package/lib/room-control/whiteboard-control-v1/utils.d.ts +53 -0
- package/lib/room-control/whiteboard-control-v1/utils.js +290 -0
- package/lib/room-control/whiteboard-control-v2/annotation-control/control.d.ts +17 -31
- package/lib/room-control/whiteboard-control-v2/annotation-control/control.js +42 -228
- package/lib/room-control/whiteboard-control-v2/annotation-control/factory.d.ts +10 -0
- package/lib/room-control/whiteboard-control-v2/annotation-control/factory.js +48 -0
- package/lib/room-control/whiteboard-control-v2/annotation-control/type.d.ts +11 -19
- package/lib/room-control/whiteboard-control-v2/annotation-control/type.js +1 -3
- package/lib/room-control/whiteboard-control-v2/base/index.d.ts +42 -0
- package/lib/room-control/whiteboard-control-v2/base/index.js +317 -0
- package/lib/room-control/whiteboard-control-v2/{main-window.d.ts → base/main-window.d.ts} +6 -4
- package/lib/room-control/whiteboard-control-v2/{main-window.js → base/main-window.js} +54 -36
- package/lib/room-control/whiteboard-control-v2/constant.d.ts +6 -0
- package/lib/room-control/whiteboard-control-v2/constant.js +15 -0
- package/lib/room-control/whiteboard-control-v2/enum.d.ts +26 -0
- package/lib/room-control/whiteboard-control-v2/enum.js +34 -0
- package/lib/room-control/{whiteboard-control/types.d.ts → whiteboard-control-v2/type.d.ts} +51 -165
- package/lib/room-control/whiteboard-control-v2/type.js +5 -0
- package/lib/room-control/whiteboard-control-v2/utils.d.ts +5 -4
- package/lib/room-control/whiteboard-control-v2/utils.js +29 -27
- package/lib/room-control/whiteboard-control-v2/whiteboard-control/control.d.ts +34 -33
- package/lib/room-control/whiteboard-control-v2/whiteboard-control/control.js +131 -187
- package/lib/room-control/whiteboard-control-v2/whiteboard-control/factory.d.ts +11 -0
- package/lib/room-control/whiteboard-control-v2/{annotation-control/index.js → whiteboard-control/factory.js} +40 -38
- package/lib/room-control/whiteboard-control-v2/whiteboard-control/type.d.ts +18 -30
- package/lib/room-control/whiteboard-control-v2/whiteboard-control/type.js +1 -9
- package/lib/room-router/index.js +56 -42
- package/lib/schema.d.ts +23 -9
- package/lib/schema.js +10 -4
- package/lib/service/api.d.ts +75 -19
- package/lib/service/api.js +401 -208
- package/lib/type.d.ts +15 -2
- package/lib/type.js +13 -0
- package/lib/utilities/collection.js +3 -2
- package/lib/utilities/error-helpers.d.ts +2 -1
- package/lib/utilities/error-helpers.js +35 -27
- package/lib/utilities/error.d.ts +1 -0
- package/lib/utilities/error.js +10 -8
- package/lib/utilities/join-helper.js +32 -25
- package/lib/utilities/logger.d.ts +2 -2
- package/lib/utilities/logger.js +6 -3
- package/lib/utilities/parameters.js +8 -4
- package/lib/utilities/retry-helpers.js +1 -0
- package/lib/utilities/shared-storage.d.ts +3 -1
- package/lib/utilities/shared-storage.js +10 -1
- 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 +11 -5
- package/lib/room-control/whiteboard-control-v2/annotation-control/index.d.ts +0 -19
- package/lib/room-control/whiteboard-control-v2/annotation-control/privilege-control.d.ts +0 -36
- package/lib/room-control/whiteboard-control-v2/annotation-control/privilege-control.js +0 -252
- package/lib/room-control/whiteboard-control-v2/index.d.ts +0 -38
- package/lib/room-control/whiteboard-control-v2/index.js +0 -274
- package/lib/room-control/whiteboard-control-v2/whiteboard-control/index.d.ts +0 -17
- package/lib/room-control/whiteboard-control-v2/whiteboard-control/index.js +0 -30
- package/lib/room-control/whiteboard-control-v2/whiteboard-control/privilege-control.d.ts +0 -36
- package/lib/room-control/whiteboard-control-v2/whiteboard-control/privilege-control.js +0 -240
package/lib/plugins/chatroom.js
CHANGED
|
@@ -1,7 +1,10 @@
|
|
|
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");
|
|
6
|
+
require("core-js/modules/esnext.iterator.filter.js");
|
|
7
|
+
require("core-js/modules/esnext.iterator.for-each.js");
|
|
5
8
|
require("core-js/modules/esnext.map.delete-all.js");
|
|
6
9
|
require("core-js/modules/esnext.map.emplace.js");
|
|
7
10
|
require("core-js/modules/esnext.map.every.js");
|
|
@@ -22,8 +25,12 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
22
25
|
value: true
|
|
23
26
|
});
|
|
24
27
|
exports.FcrChatRoomControlImpl = void 0;
|
|
28
|
+
require("core-js/modules/es.error.cause.js");
|
|
29
|
+
require("core-js/modules/es.regexp.exec.js");
|
|
25
30
|
require("core-js/modules/esnext.iterator.constructor.js");
|
|
26
31
|
require("core-js/modules/esnext.iterator.map.js");
|
|
32
|
+
require("core-js/modules/web.dom-collections.iterator.js");
|
|
33
|
+
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
27
34
|
var _imports = require("../imports");
|
|
28
35
|
var _observable = require("agora-foundation/lib/utilities/observable");
|
|
29
36
|
var _easemobWebsdk = _interopRequireDefault(require("easemob-websdk"));
|
|
@@ -34,40 +41,20 @@ var _type2 = require("../chat-connection/type");
|
|
|
34
41
|
var _logger = require("../utilities/logger");
|
|
35
42
|
var _validateParams = _interopRequireDefault(require("../utilities/validate-params"));
|
|
36
43
|
var _schema = require("../schema");
|
|
37
|
-
|
|
44
|
+
var _FcrChatRoomControlImpl;
|
|
45
|
+
let _initProto, _sendMessageDecs, _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; }
|
|
38
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)]; } }; }
|
|
39
49
|
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
|
|
40
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); }
|
|
41
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; }
|
|
42
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 = (_sendMessageDecs = [_imports.trace, (0, _validateParams.default)(_schema.messageSchema, _schema.progressSchema.optional())], "logger");
|
|
43
54
|
/**
|
|
44
55
|
* @internal
|
|
45
56
|
*/
|
|
46
57
|
class FcrChatRoomControlImpl {
|
|
47
|
-
static {
|
|
48
|
-
[_initProto] = _applyDecs(this, [[_imports.trace, 2, "join"], [_imports.trace, 2, "getConnectionState"], [_imports.trace, 2, "leave"], [_sendMessageDecs, 2, "sendMessage"], [_imports.trace, 2, "addObserver"], [_imports.trace, 2, "removeObserver"]], []).e;
|
|
49
|
-
}
|
|
50
|
-
[(_sendMessageDecs = [_imports.trace, (0, _validateParams.default)(_schema.messageSchema, _schema.progressSchema.optional())], "logger")] = (_initProto(this), (0, _logger.createLogger)({
|
|
51
|
-
prefix: 'FcrChatRoomControlImpl'
|
|
52
|
-
}));
|
|
53
|
-
_observable = new _observable.AgoraObservable();
|
|
54
|
-
_connectionState = _type.FcrChatRoomConnectionState.Disconnected;
|
|
55
|
-
_chatConnectionObserver = {
|
|
56
|
-
onConnectionStateUpdated: async state => {
|
|
57
|
-
// im reconnect
|
|
58
|
-
this.logger.info(`onConnectionStateUpdated, chatConnectionState: ${state}, chatControlState: ${this.getConnectionState()}`);
|
|
59
|
-
if (state === _type2.FcrChatConnectionState.DISCONNECTED && this.getConnectionState() === _type.FcrChatRoomConnectionState.Connected) {
|
|
60
|
-
this._setConnectionState(_type.FcrChatRoomConnectionState.Disconnected);
|
|
61
|
-
} else if (state === _type2.FcrChatConnectionState.CONNECTED && this.getConnectionState() !== _type.FcrChatRoomConnectionState.Connected) {
|
|
62
|
-
this._removeEventListener();
|
|
63
|
-
this._addEventListener();
|
|
64
|
-
await this._joinChatRoom(state);
|
|
65
|
-
}
|
|
66
|
-
},
|
|
67
|
-
onConnectionLoginSuccess: () => {
|
|
68
|
-
this._addEventListener();
|
|
69
|
-
}
|
|
70
|
-
};
|
|
71
58
|
get conn() {
|
|
72
59
|
if (!this._chatConnection.getConnectionInstance()) {
|
|
73
60
|
throw (0, _error.generateFcrCoreClientError)(_error.FcrErrorModuleCode.ROOM_CHATROOM, _error.FcrErrorCode.UNDEFINED_ERROR, 'chat room connection not initialized, please get chat room token first', new Error('chat room connection not initialized, please get chat room token first'));
|
|
@@ -75,13 +62,216 @@ class FcrChatRoomControlImpl {
|
|
|
75
62
|
return this._chatConnection.getConnectionInstance();
|
|
76
63
|
}
|
|
77
64
|
get chatRoomId() {
|
|
65
|
+
if (!this._joinSceneSuccess) {
|
|
66
|
+
return '';
|
|
67
|
+
}
|
|
78
68
|
return this._scene.getScenePropertiesByKeyPath('widgets.easemobIM.extra.chatRoomId');
|
|
79
69
|
}
|
|
80
|
-
constructor(_scene, _chatConnection,
|
|
70
|
+
constructor(_scene, _chatConnection, sharedCache, joinSceneSuccess) {
|
|
71
|
+
(0, _defineProperty2.default)(this, _ref, (_initProto(this), (0, _logger.createLogger)({
|
|
72
|
+
prefix: 'FcrChatRoomControlImpl'
|
|
73
|
+
})));
|
|
74
|
+
(0, _defineProperty2.default)(this, "_observable", new _observable.AgoraObservable());
|
|
75
|
+
(0, _defineProperty2.default)(this, "_connectionState", _type.FcrChatRoomConnectionState.Disconnected);
|
|
76
|
+
(0, _defineProperty2.default)(this, "_sceneObserver", {
|
|
77
|
+
onJoinSceneSuccess: () => this._handleJoinSceneSuccess(),
|
|
78
|
+
onJoinSceneFailure: () => this._handleJoinSceneFailure()
|
|
79
|
+
});
|
|
80
|
+
(0, _defineProperty2.default)(this, "_chatConnectionObserver", {
|
|
81
|
+
onConnectionStateUpdated: async state => {
|
|
82
|
+
// im reconnect
|
|
83
|
+
this.logger.info("onConnectionStateUpdated, chatConnectionState: ".concat(state, ", chatControlState: ").concat(this.getConnectionState()));
|
|
84
|
+
if (state === _type2.FcrChatConnectionState.DISCONNECTED && this.getConnectionState() === _type.FcrChatRoomConnectionState.Connected) {
|
|
85
|
+
this._setConnectionState(_type.FcrChatRoomConnectionState.Disconnected);
|
|
86
|
+
} else if (state === _type2.FcrChatConnectionState.CONNECTED && this.getConnectionState() !== _type.FcrChatRoomConnectionState.Connected) {
|
|
87
|
+
this._removeEventListener();
|
|
88
|
+
this._addEventListener();
|
|
89
|
+
await this._joinChatRoom(state);
|
|
90
|
+
}
|
|
91
|
+
},
|
|
92
|
+
onConnectionLoginSuccess: () => {
|
|
93
|
+
this._addEventListener();
|
|
94
|
+
}
|
|
95
|
+
});
|
|
96
|
+
(0, _defineProperty2.default)(this, "_joinChatRoom", async state => {
|
|
97
|
+
this.logger.info("joinChatRoom, chatConnectionState: ".concat(state, ", chatControlState: ").concat(this.getConnectionState()));
|
|
98
|
+
if (state === _type2.FcrChatConnectionState.CONNECTED && this.getConnectionState() === _type.FcrChatRoomConnectionState.Disconnected && this.chatRoomId) {
|
|
99
|
+
this._setConnectionState(_type.FcrChatRoomConnectionState.Connecting);
|
|
100
|
+
this.logger.info("start join chat room, room id: ".concat(this.chatRoomId, ", scene id: ").concat(this._scene.sceneId));
|
|
101
|
+
let error = null;
|
|
102
|
+
[error] = await (0, _imports.to)((0, _imports.retryAttempt)(async () => {
|
|
103
|
+
await this.conn.joinChatRoom({
|
|
104
|
+
roomId: this.chatRoomId
|
|
105
|
+
});
|
|
106
|
+
}, [], {
|
|
107
|
+
retriesMax: 4
|
|
108
|
+
}).fail(async _ref2 => {
|
|
109
|
+
let {
|
|
110
|
+
error,
|
|
111
|
+
timeFn,
|
|
112
|
+
currentRetry
|
|
113
|
+
} = _ref2;
|
|
114
|
+
this.logger.error("retry to join chat room, ".concat(error.message, ", retry ").concat(currentRetry, " times"));
|
|
115
|
+
await timeFn();
|
|
116
|
+
return true;
|
|
117
|
+
}).exec());
|
|
118
|
+
if (error) {
|
|
119
|
+
this._setConnectionState(_type.FcrChatRoomConnectionState.Disconnected);
|
|
120
|
+
throw error;
|
|
121
|
+
}
|
|
122
|
+
this._setConnectionState(_type.FcrChatRoomConnectionState.Connected);
|
|
123
|
+
}
|
|
124
|
+
});
|
|
125
|
+
(0, _defineProperty2.default)(this, "_convertAgoraChatMessageToFcrChatRoomReceiveMessage", msg => {
|
|
126
|
+
// TODO: 没看到有 contentsType 字段
|
|
127
|
+
//@ts-ignore
|
|
128
|
+
switch (msg.type) {
|
|
129
|
+
case 'txt':
|
|
130
|
+
{
|
|
131
|
+
var _msg$ext, _msg$ext2;
|
|
132
|
+
const message = {
|
|
133
|
+
id: msg.id,
|
|
134
|
+
//@ts-ignore
|
|
135
|
+
from: msg.ext.sender,
|
|
136
|
+
type: _type.FcrChatRoomMessageType.Text,
|
|
137
|
+
//@ts-ignore
|
|
138
|
+
timestamp: parseInt(msg.time),
|
|
139
|
+
//@ts-ignore
|
|
140
|
+
content: msg.msg,
|
|
141
|
+
isPrivate: (_msg$ext = msg.ext) === null || _msg$ext === void 0 ? void 0 : _msg$ext.isPrivate,
|
|
142
|
+
properties: (_msg$ext2 = msg.ext) === null || _msg$ext2 === void 0 ? void 0 : _msg$ext2.properties
|
|
143
|
+
};
|
|
144
|
+
return message;
|
|
145
|
+
}
|
|
146
|
+
case 'img':
|
|
147
|
+
{
|
|
148
|
+
var _msg$ext3, _msg$ext4, _msg$ext5;
|
|
149
|
+
const message = {
|
|
150
|
+
id: msg.id,
|
|
151
|
+
from: (_msg$ext3 = msg.ext) === null || _msg$ext3 === void 0 ? void 0 : _msg$ext3.sender,
|
|
152
|
+
type: _type.FcrChatRoomMessageType.Image,
|
|
153
|
+
//@ts-ignore
|
|
154
|
+
timestamp: parseInt(msg.time),
|
|
155
|
+
url: msg.url || '',
|
|
156
|
+
isPrivate: (_msg$ext4 = msg.ext) === null || _msg$ext4 === void 0 ? void 0 : _msg$ext4.isPrivate,
|
|
157
|
+
properties: (_msg$ext5 = msg.ext) === null || _msg$ext5 === void 0 ? void 0 : _msg$ext5.properties
|
|
158
|
+
};
|
|
159
|
+
return message;
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
throw (0, _error.generateFcrCoreClientError)(_error.FcrErrorModuleCode.ROOM_CHATROOM, _error.FcrErrorCode.UNDEFINED_ERROR, 'unknown remote message type', new Error('unknown remote message type'));
|
|
163
|
+
});
|
|
164
|
+
(0, _defineProperty2.default)(this, "_convertAgoraChatHistoryMessageToFcrChatRoomReceiveMessage", msg => {
|
|
165
|
+
// TODO: 没看到有 contentsType 字段
|
|
166
|
+
//@ts-ignore
|
|
167
|
+
switch (msg.contentsType) {
|
|
168
|
+
case 'TEXT':
|
|
169
|
+
{
|
|
170
|
+
var _msg$ext6;
|
|
171
|
+
const message = {
|
|
172
|
+
id: msg.id,
|
|
173
|
+
//@ts-ignore
|
|
174
|
+
from: msg.ext.sender,
|
|
175
|
+
type: _type.FcrChatRoomMessageType.Text,
|
|
176
|
+
//@ts-ignore
|
|
177
|
+
timestamp: parseInt(msg.time),
|
|
178
|
+
//@ts-ignore
|
|
179
|
+
content: msg.data,
|
|
180
|
+
//@ts-ignore
|
|
181
|
+
isPrivate: msg.ext.isPrivate,
|
|
182
|
+
//@ts-ignore
|
|
183
|
+
properties: (_msg$ext6 = msg.ext) === null || _msg$ext6 === void 0 ? void 0 : _msg$ext6.properties
|
|
184
|
+
};
|
|
185
|
+
return message;
|
|
186
|
+
}
|
|
187
|
+
case 'IMAGE':
|
|
188
|
+
{
|
|
189
|
+
var _msg$ext7, _msg$ext8, _msg$ext9;
|
|
190
|
+
const message = {
|
|
191
|
+
id: msg.id,
|
|
192
|
+
//@ts-ignore
|
|
193
|
+
from: (_msg$ext7 = msg.ext) === null || _msg$ext7 === void 0 ? void 0 : _msg$ext7.sender,
|
|
194
|
+
type: _type.FcrChatRoomMessageType.Image,
|
|
195
|
+
//@ts-ignore
|
|
196
|
+
timestamp: parseInt(msg.time),
|
|
197
|
+
//@ts-ignore
|
|
198
|
+
url: msg.url || '',
|
|
199
|
+
//@ts-ignore
|
|
200
|
+
isPrivate: (_msg$ext8 = msg.ext) === null || _msg$ext8 === void 0 ? void 0 : _msg$ext8.isPrivate,
|
|
201
|
+
//@ts-ignore
|
|
202
|
+
properties: (_msg$ext9 = msg.ext) === null || _msg$ext9 === void 0 ? void 0 : _msg$ext9.properties
|
|
203
|
+
};
|
|
204
|
+
return message;
|
|
205
|
+
}
|
|
206
|
+
}
|
|
207
|
+
throw (0, _error.generateFcrCoreClientError)(_error.FcrErrorModuleCode.ROOM_CHATROOM, _error.FcrErrorCode.UNDEFINED_ERROR, 'unknown remote message type', new Error('unknown remote message type'));
|
|
208
|
+
});
|
|
209
|
+
(0, _defineProperty2.default)(this, "_convertFcrChatRoomSendBaseMessageToAgoraChatMessage", (msg, progress) => {
|
|
210
|
+
switch (msg.type) {
|
|
211
|
+
case _type.FcrChatRoomMessageType.Text:
|
|
212
|
+
{
|
|
213
|
+
var _message$to;
|
|
214
|
+
const message = msg;
|
|
215
|
+
const isPrivate = !!((_message$to = message.to) !== null && _message$to !== void 0 && _message$to.length);
|
|
216
|
+
const localUserId = this._scene.getLocalUser().getLocalUserId();
|
|
217
|
+
const localUserInfo = this._scene.getUser(localUserId);
|
|
218
|
+
return _easemobWebsdk.default.message.create({
|
|
219
|
+
to: this.chatRoomId,
|
|
220
|
+
msg: message.content,
|
|
221
|
+
type: 'txt',
|
|
222
|
+
chatType: 'chatRoom',
|
|
223
|
+
ext: {
|
|
224
|
+
sender: (0, _user.convertRteUserToFcrUser)(localUserInfo, this._roomCache),
|
|
225
|
+
roomUuid: this._scene.sceneId,
|
|
226
|
+
isPrivate,
|
|
227
|
+
properties: msg.properties
|
|
228
|
+
},
|
|
229
|
+
receiverList: message.to
|
|
230
|
+
});
|
|
231
|
+
}
|
|
232
|
+
case _type.FcrChatRoomMessageType.Image:
|
|
233
|
+
{
|
|
234
|
+
var _imageMessage$to;
|
|
235
|
+
const imageMessage = msg;
|
|
236
|
+
const isPrivateImage = !!((_imageMessage$to = imageMessage.to) !== null && _imageMessage$to !== void 0 && _imageMessage$to.length);
|
|
237
|
+
const localUser = this._scene.getUser(this._scene.getLocalUser().getLocalUserId());
|
|
238
|
+
return _easemobWebsdk.default.message.create({
|
|
239
|
+
to: this.chatRoomId,
|
|
240
|
+
type: 'img',
|
|
241
|
+
chatType: 'chatRoom',
|
|
242
|
+
url: imageMessage.file.filePath,
|
|
243
|
+
file: {
|
|
244
|
+
filename: imageMessage.file.fileName,
|
|
245
|
+
filetype: imageMessage.file.fileType,
|
|
246
|
+
data: imageMessage.file.data,
|
|
247
|
+
url: ''
|
|
248
|
+
},
|
|
249
|
+
ext: {
|
|
250
|
+
sender: (0, _user.convertRteUserToFcrUser)(localUser, this._roomCache),
|
|
251
|
+
roomUuid: this._scene.sceneId,
|
|
252
|
+
isPrivate: isPrivateImage,
|
|
253
|
+
properties: msg.properties
|
|
254
|
+
},
|
|
255
|
+
receiverList: imageMessage.to,
|
|
256
|
+
onFileUploadProgress: e => {
|
|
257
|
+
progress === null || progress === void 0 || progress(Math.round(e.loaded / e.total * 100));
|
|
258
|
+
}
|
|
259
|
+
});
|
|
260
|
+
}
|
|
261
|
+
}
|
|
262
|
+
throw (0, _error.generateFcrCoreClientError)(_error.FcrErrorModuleCode.ROOM_CHATROOM, _error.FcrErrorCode.UNDEFINED_ERROR, 'unknown local message type', new Error('unknown local message type'));
|
|
263
|
+
});
|
|
264
|
+
(0, _defineProperty2.default)(this, "_handleJoinSceneSuccess", () => {
|
|
265
|
+
this._joinSceneSuccess = true;
|
|
266
|
+
this._joinChatRoom(this._chatConnection.getConnectionState());
|
|
267
|
+
});
|
|
268
|
+
(0, _defineProperty2.default)(this, "_handleJoinSceneFailure", () => {
|
|
269
|
+
this._joinSceneSuccess = false;
|
|
270
|
+
});
|
|
81
271
|
this._scene = _scene;
|
|
82
272
|
this._chatConnection = _chatConnection;
|
|
83
|
-
this.
|
|
84
|
-
this.
|
|
273
|
+
this._roomCache = sharedCache.getRoomCache(_scene.sceneId);
|
|
274
|
+
this._joinSceneSuccess = joinSceneSuccess;
|
|
85
275
|
this._addLogObserver();
|
|
86
276
|
this._chatConnection.addObserver(this._chatConnectionObserver);
|
|
87
277
|
if (this._chatConnection.getConnectionInstance()) {
|
|
@@ -116,40 +306,14 @@ class FcrChatRoomControlImpl {
|
|
|
116
306
|
}
|
|
117
307
|
});
|
|
118
308
|
}
|
|
119
|
-
_joinChatRoom = async state => {
|
|
120
|
-
this.logger.info(`joinChatRoom, chatConnectionState: ${state}, chatControlState: ${this.getConnectionState()}`);
|
|
121
|
-
if (state === _type2.FcrChatConnectionState.CONNECTED && this.getConnectionState() === _type.FcrChatRoomConnectionState.Disconnected && this.chatRoomId) {
|
|
122
|
-
this._setConnectionState(_type.FcrChatRoomConnectionState.Connecting);
|
|
123
|
-
this.logger.info(`start join chat room, room id: ${this.chatRoomId}, scene id: ${this._scene.sceneId}`);
|
|
124
|
-
let error = null;
|
|
125
|
-
[error] = await (0, _imports.to)((0, _imports.retryAttempt)(async () => {
|
|
126
|
-
await this.conn.joinChatRoom({
|
|
127
|
-
roomId: this.chatRoomId
|
|
128
|
-
});
|
|
129
|
-
}, [], {
|
|
130
|
-
retriesMax: 4
|
|
131
|
-
}).fail(async ({
|
|
132
|
-
error,
|
|
133
|
-
timeFn,
|
|
134
|
-
currentRetry
|
|
135
|
-
}) => {
|
|
136
|
-
this.logger.error(`retry to join chat room, ${error.message}, retry ${currentRetry} times`);
|
|
137
|
-
await timeFn();
|
|
138
|
-
return true;
|
|
139
|
-
}).exec());
|
|
140
|
-
if (error) {
|
|
141
|
-
this._setConnectionState(_type.FcrChatRoomConnectionState.Disconnected);
|
|
142
|
-
throw error;
|
|
143
|
-
}
|
|
144
|
-
this._setConnectionState(_type.FcrChatRoomConnectionState.Connected);
|
|
145
|
-
}
|
|
146
|
-
};
|
|
147
309
|
_removeEventListener() {
|
|
148
|
-
this.
|
|
310
|
+
this._scene.removeObserver(this._sceneObserver);
|
|
311
|
+
this.conn.removeEventHandler("chatroom".concat(this._scene.sceneId));
|
|
149
312
|
}
|
|
150
313
|
_addEventListener() {
|
|
151
314
|
this._removeEventListener();
|
|
152
|
-
this.
|
|
315
|
+
this._scene.addObserver(this._sceneObserver);
|
|
316
|
+
this.conn.addEventHandler("chatroom".concat(this._scene.sceneId), {
|
|
153
317
|
onTextMessage: msg => {
|
|
154
318
|
if (msg.to !== this.chatRoomId) {
|
|
155
319
|
return;
|
|
@@ -164,10 +328,9 @@ class FcrChatRoomControlImpl {
|
|
|
164
328
|
}
|
|
165
329
|
// 这里的数据结构和 onTextMessage 不一样,实际上contentsType是img ,type是chatroom,
|
|
166
330
|
// 但是因为在onPictureMessage的回调中,所以这里直接用type: 'img',后续可以考虑优化
|
|
167
|
-
const message = this._convertAgoraChatMessageToFcrChatRoomReceiveMessage({
|
|
168
|
-
...msg,
|
|
331
|
+
const message = this._convertAgoraChatMessageToFcrChatRoomReceiveMessage(_objectSpread(_objectSpread({}, msg), {}, {
|
|
169
332
|
type: 'img'
|
|
170
|
-
});
|
|
333
|
+
}));
|
|
171
334
|
this._observable.notifyObservers('onImageMessageReceived', this._scene.sceneId, message);
|
|
172
335
|
};
|
|
173
336
|
|
|
@@ -195,158 +358,25 @@ class FcrChatRoomControlImpl {
|
|
|
195
358
|
// }
|
|
196
359
|
// };
|
|
197
360
|
}
|
|
198
|
-
_convertAgoraChatMessageToFcrChatRoomReceiveMessage = msg => {
|
|
199
|
-
// TODO: 没看到有 contentsType 字段
|
|
200
|
-
//@ts-ignore
|
|
201
|
-
switch (msg.type) {
|
|
202
|
-
case 'txt':
|
|
203
|
-
{
|
|
204
|
-
const message = {
|
|
205
|
-
id: msg.id,
|
|
206
|
-
//@ts-ignore
|
|
207
|
-
from: msg.ext.sender,
|
|
208
|
-
type: _type.FcrChatRoomMessageType.Text,
|
|
209
|
-
//@ts-ignore
|
|
210
|
-
timestamp: parseInt(msg.time),
|
|
211
|
-
//@ts-ignore
|
|
212
|
-
content: msg.msg,
|
|
213
|
-
isPrivate: msg.ext?.isPrivate,
|
|
214
|
-
properties: msg.ext?.properties
|
|
215
|
-
};
|
|
216
|
-
return message;
|
|
217
|
-
}
|
|
218
|
-
case 'img':
|
|
219
|
-
{
|
|
220
|
-
const message = {
|
|
221
|
-
id: msg.id,
|
|
222
|
-
from: msg.ext?.sender,
|
|
223
|
-
type: _type.FcrChatRoomMessageType.Image,
|
|
224
|
-
//@ts-ignore
|
|
225
|
-
timestamp: parseInt(msg.time),
|
|
226
|
-
url: msg.url || '',
|
|
227
|
-
isPrivate: msg.ext?.isPrivate,
|
|
228
|
-
properties: msg.ext?.properties
|
|
229
|
-
};
|
|
230
|
-
return message;
|
|
231
|
-
}
|
|
232
|
-
}
|
|
233
|
-
throw (0, _error.generateFcrCoreClientError)(_error.FcrErrorModuleCode.ROOM_CHATROOM, _error.FcrErrorCode.UNDEFINED_ERROR, 'unknown remote message type', new Error('unknown remote message type'));
|
|
234
|
-
};
|
|
235
|
-
_convertAgoraChatHistoryMessageToFcrChatRoomReceiveMessage = msg => {
|
|
236
|
-
// TODO: 没看到有 contentsType 字段
|
|
237
|
-
//@ts-ignore
|
|
238
|
-
switch (msg.contentsType) {
|
|
239
|
-
case 'TEXT':
|
|
240
|
-
{
|
|
241
|
-
const message = {
|
|
242
|
-
id: msg.id,
|
|
243
|
-
//@ts-ignore
|
|
244
|
-
from: msg.ext.sender,
|
|
245
|
-
type: _type.FcrChatRoomMessageType.Text,
|
|
246
|
-
//@ts-ignore
|
|
247
|
-
timestamp: parseInt(msg.time),
|
|
248
|
-
//@ts-ignore
|
|
249
|
-
content: msg.data,
|
|
250
|
-
//@ts-ignore
|
|
251
|
-
isPrivate: msg.ext.isPrivate,
|
|
252
|
-
//@ts-ignore
|
|
253
|
-
properties: msg.ext?.properties
|
|
254
|
-
};
|
|
255
|
-
return message;
|
|
256
|
-
}
|
|
257
|
-
case 'IMAGE':
|
|
258
|
-
{
|
|
259
|
-
const message = {
|
|
260
|
-
id: msg.id,
|
|
261
|
-
//@ts-ignore
|
|
262
|
-
from: msg.ext?.sender,
|
|
263
|
-
type: _type.FcrChatRoomMessageType.Image,
|
|
264
|
-
//@ts-ignore
|
|
265
|
-
timestamp: parseInt(msg.time),
|
|
266
|
-
//@ts-ignore
|
|
267
|
-
url: msg.url || '',
|
|
268
|
-
//@ts-ignore
|
|
269
|
-
isPrivate: msg.ext?.isPrivate,
|
|
270
|
-
//@ts-ignore
|
|
271
|
-
properties: msg.ext?.properties
|
|
272
|
-
};
|
|
273
|
-
return message;
|
|
274
|
-
}
|
|
275
|
-
}
|
|
276
|
-
throw (0, _error.generateFcrCoreClientError)(_error.FcrErrorModuleCode.ROOM_CHATROOM, _error.FcrErrorCode.UNDEFINED_ERROR, 'unknown remote message type', new Error('unknown remote message type'));
|
|
277
|
-
};
|
|
278
|
-
_convertFcrChatRoomSendBaseMessageToAgoraChatMessage = (msg, progress) => {
|
|
279
|
-
switch (msg.type) {
|
|
280
|
-
case _type.FcrChatRoomMessageType.Text:
|
|
281
|
-
{
|
|
282
|
-
const message = msg;
|
|
283
|
-
const isPrivate = !!message.to?.length;
|
|
284
|
-
const localUserId = this._scene.getLocalUser().getLocalUserId();
|
|
285
|
-
const localUserInfo = this._scene.getUser(localUserId);
|
|
286
|
-
return _easemobWebsdk.default.message.create({
|
|
287
|
-
to: this.chatRoomId,
|
|
288
|
-
msg: message.content,
|
|
289
|
-
type: 'txt',
|
|
290
|
-
chatType: 'chatRoom',
|
|
291
|
-
ext: {
|
|
292
|
-
sender: (0, _user.convertRteUserToFcrUser)(localUserInfo, this._roomCache),
|
|
293
|
-
roomUuid: this._scene.sceneId,
|
|
294
|
-
isPrivate,
|
|
295
|
-
properties: msg.properties
|
|
296
|
-
},
|
|
297
|
-
receiverList: message.to
|
|
298
|
-
});
|
|
299
|
-
}
|
|
300
|
-
case _type.FcrChatRoomMessageType.Image:
|
|
301
|
-
{
|
|
302
|
-
const imageMessage = msg;
|
|
303
|
-
const isPrivateImage = !!imageMessage.to?.length;
|
|
304
|
-
const localUser = this._scene.getUser(this._scene.getLocalUser().getLocalUserId());
|
|
305
|
-
return _easemobWebsdk.default.message.create({
|
|
306
|
-
to: this.chatRoomId,
|
|
307
|
-
type: 'img',
|
|
308
|
-
chatType: 'chatRoom',
|
|
309
|
-
url: imageMessage.file.filePath,
|
|
310
|
-
file: {
|
|
311
|
-
filename: imageMessage.file.fileName,
|
|
312
|
-
filetype: imageMessage.file.fileType,
|
|
313
|
-
data: imageMessage.file.data,
|
|
314
|
-
url: ''
|
|
315
|
-
},
|
|
316
|
-
ext: {
|
|
317
|
-
sender: (0, _user.convertRteUserToFcrUser)(localUser, this._roomCache),
|
|
318
|
-
roomUuid: this._scene.sceneId,
|
|
319
|
-
isPrivate: isPrivateImage,
|
|
320
|
-
properties: msg.properties
|
|
321
|
-
},
|
|
322
|
-
receiverList: imageMessage.to,
|
|
323
|
-
onFileUploadProgress: e => {
|
|
324
|
-
progress?.(Math.round(e.loaded / e.total * 100));
|
|
325
|
-
}
|
|
326
|
-
});
|
|
327
|
-
}
|
|
328
|
-
}
|
|
329
|
-
throw (0, _error.generateFcrCoreClientError)(_error.FcrErrorModuleCode.ROOM_CHATROOM, _error.FcrErrorCode.UNDEFINED_ERROR, 'unknown local message type', new Error('unknown local message type'));
|
|
330
|
-
};
|
|
331
361
|
async sendMessage(message, progress) {
|
|
362
|
+
var _message$to2;
|
|
332
363
|
const msg = this._convertFcrChatRoomSendBaseMessageToAgoraChatMessage(message, progress);
|
|
333
364
|
const sendMsgRes = await this.conn.send(msg);
|
|
334
365
|
const localUserInfo = this._scene.getUser(this._scene.getLocalUser().getLocalUserId());
|
|
335
|
-
const res = {
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
}),
|
|
366
|
+
const res = _objectSpread(_objectSpread({}, message.type === _type.FcrChatRoomMessageType.Text ? {
|
|
367
|
+
content: message.content
|
|
368
|
+
} :
|
|
369
|
+
// @ts-ignore
|
|
370
|
+
{
|
|
371
|
+
url: sendMsgRes.message.url
|
|
372
|
+
}), {}, {
|
|
343
373
|
from: (0, _user.convertRteUserToFcrUser)(localUserInfo, this._roomCache),
|
|
344
374
|
id: sendMsgRes.serverMsgId,
|
|
345
375
|
type: message.type,
|
|
346
376
|
properties: message.properties,
|
|
347
377
|
timestamp: Date.now(),
|
|
348
|
-
isPrivate: !!message.to
|
|
349
|
-
};
|
|
378
|
+
isPrivate: !!((_message$to2 = message.to) !== null && _message$to2 !== void 0 && _message$to2.length)
|
|
379
|
+
});
|
|
350
380
|
return res;
|
|
351
381
|
}
|
|
352
382
|
addObserver(observer) {
|
|
@@ -435,4 +465,6 @@ class FcrChatRoomControlImpl {
|
|
|
435
465
|
// });
|
|
436
466
|
// }
|
|
437
467
|
}
|
|
438
|
-
exports.FcrChatRoomControlImpl = FcrChatRoomControlImpl;
|
|
468
|
+
exports.FcrChatRoomControlImpl = FcrChatRoomControlImpl;
|
|
469
|
+
_FcrChatRoomControlImpl = FcrChatRoomControlImpl;
|
|
470
|
+
[_initProto] = _applyDecs(_FcrChatRoomControlImpl, [[_imports.trace, 2, "join"], [_imports.trace, 2, "getConnectionState"], [_imports.trace, 2, "leave"], [_sendMessageDecs, 2, "sendMessage"], [_imports.trace, 2, "addObserver"], [_imports.trace, 2, "removeObserver"]], []).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");
|
|
@@ -17,12 +19,16 @@ require("core-js/modules/esnext.map.reduce.js");
|
|
|
17
19
|
require("core-js/modules/esnext.map.some.js");
|
|
18
20
|
require("core-js/modules/esnext.map.update.js");
|
|
19
21
|
require("core-js/modules/esnext.symbol.metadata.js");
|
|
22
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
20
23
|
Object.defineProperty(exports, "__esModule", {
|
|
21
24
|
value: true
|
|
22
25
|
});
|
|
23
26
|
exports.FcrAbilityControlImpl = void 0;
|
|
27
|
+
require("core-js/modules/web.dom-collections.iterator.js");
|
|
28
|
+
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
24
29
|
var _imports = require("../../imports");
|
|
25
30
|
var _logger = require("../../utilities/logger");
|
|
31
|
+
var _FcrAbilityControlImpl;
|
|
26
32
|
let _initProto;
|
|
27
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)]; } }; }
|
|
28
34
|
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
|
|
@@ -34,18 +40,15 @@ function _checkInRHS(e) { if (Object(e) !== e) throw TypeError("right-hand side
|
|
|
34
40
|
* @internal
|
|
35
41
|
*/
|
|
36
42
|
class FcrAbilityControlImpl {
|
|
37
|
-
static {
|
|
38
|
-
[_initProto] = _applyDecs(this, [[_imports.trace, 2, "isPlatformAbilitySupported"]], []).e;
|
|
39
|
-
}
|
|
40
|
-
//@internal
|
|
41
|
-
logger = (_initProto(this), (0, _logger.createLogger)({
|
|
42
|
-
prefix: 'FcrAbilityControlImpl'
|
|
43
|
-
}));
|
|
44
43
|
constructor(_scene) {
|
|
44
|
+
//@internal
|
|
45
|
+
(0, _defineProperty2.default)(this, "logger", (_initProto(this), (0, _logger.createLogger)({
|
|
46
|
+
prefix: 'FcrAbilityControlImpl'
|
|
47
|
+
})));
|
|
45
48
|
this._scene = _scene;
|
|
46
49
|
}
|
|
47
50
|
getPlatformAbility(ability) {
|
|
48
|
-
const platforms = this._scene.getScenePropertiesByKeyPath(
|
|
51
|
+
const platforms = this._scene.getScenePropertiesByKeyPath("setting.ability.".concat(ability));
|
|
49
52
|
if (!Array.isArray(platforms)) {
|
|
50
53
|
return [];
|
|
51
54
|
}
|
|
@@ -61,4 +64,6 @@ class FcrAbilityControlImpl {
|
|
|
61
64
|
return platforms.includes(platform);
|
|
62
65
|
}
|
|
63
66
|
}
|
|
64
|
-
exports.FcrAbilityControlImpl = FcrAbilityControlImpl;
|
|
67
|
+
exports.FcrAbilityControlImpl = FcrAbilityControlImpl;
|
|
68
|
+
_FcrAbilityControlImpl = FcrAbilityControlImpl;
|
|
69
|
+
[_initProto] = _applyDecs(_FcrAbilityControlImpl, [[_imports.trace, 2, "isPlatformAbilitySupported"]], []).e;
|
|
@@ -4,7 +4,10 @@ export declare enum FcrAbility {
|
|
|
4
4
|
RoomDetail = "room:detail",
|
|
5
5
|
Live = "live",
|
|
6
6
|
Interpreter = "interpreter",
|
|
7
|
-
Annotation = "annotation"
|
|
7
|
+
Annotation = "annotation",
|
|
8
|
+
Caption = "caption",
|
|
9
|
+
Transcribe = "transcribe",
|
|
10
|
+
Recording = "recording"
|
|
8
11
|
}
|
|
9
12
|
export interface FcrAbilityControl {
|
|
10
13
|
isAbilitySupported(ability: FcrAbility): boolean;
|
|
@@ -10,5 +10,8 @@ let FcrAbility = exports.FcrAbility = /*#__PURE__*/function (FcrAbility) {
|
|
|
10
10
|
FcrAbility["Live"] = "live";
|
|
11
11
|
FcrAbility["Interpreter"] = "interpreter";
|
|
12
12
|
FcrAbility["Annotation"] = "annotation";
|
|
13
|
+
FcrAbility["Caption"] = "caption";
|
|
14
|
+
FcrAbility["Transcribe"] = "transcribe";
|
|
15
|
+
FcrAbility["Recording"] = "recording";
|
|
13
16
|
return FcrAbility;
|
|
14
17
|
}({});
|