fcr-core 3.8.0-alpha → 3.8.1-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.js +26 -40
- package/lib/engine/index.js +72 -66
- package/lib/imports.js +0 -1
- package/lib/media-control/desktop.js +13 -18
- package/lib/media-control/mobile.js +13 -18
- package/lib/monitor-control/index.js +5 -10
- package/lib/peer-session/index.js +39 -47
- package/lib/plugins/chatroom.js +213 -229
- package/lib/room-control/ability-control/index.js +9 -14
- package/lib/room-control/group-control/index.js +16 -21
- package/lib/room-control/helpers/validation-helper.js +1 -1
- package/lib/room-control/index.js +36 -53
- package/lib/room-control/interpreter-control/index.js +34 -47
- package/lib/room-control/interpreter-control/room.js +4 -6
- package/lib/room-control/join-before-host-waitingroom-control/index.js +4 -6
- package/lib/room-control/mainroom-control/index.js +27 -35
- package/lib/room-control/privilege-control/helper.js +5 -8
- package/lib/room-control/privilege-control/index.js +19 -26
- package/lib/room-control/room-connector-control/index.js +19 -28
- package/lib/room-control/room-control-factory.js +1 -2
- package/lib/room-control/room-session/index.js +39 -46
- package/lib/room-control/shared-cache.js +29 -36
- package/lib/room-control/sharing-control/index.d.ts +1 -1
- package/lib/room-control/sharing-control/index.js +34 -42
- package/lib/room-control/stream-control/index.js +191 -195
- package/lib/room-control/stream-control/type.d.ts +1 -1
- package/lib/room-control/stt-control/de-compress-gzip.js +0 -10
- package/lib/room-control/stt-control/index.js +95 -98
- package/lib/room-control/stt-control/type.d.ts +1 -1
- package/lib/room-control/user-control/index.js +136 -143
- package/lib/room-control/waitingroom-control/index.js +9 -14
- package/lib/room-control/whiteboard-control/utils.js +2 -4
- package/lib/room-control/whiteboard-control-v1/board-subwindow.js +1 -2
- package/lib/room-control/whiteboard-control-v1/board-window.js +88 -99
- package/lib/room-control/whiteboard-control-v1/factory.js +4 -7
- package/lib/room-control/whiteboard-control-v1/index.js +28 -40
- package/lib/room-control/whiteboard-control-v1/mount-manager.js +2 -4
- package/lib/room-control/whiteboard-control-v1/utils.js +14 -17
- package/lib/room-control/whiteboard-control-v2/annotation-control/control.js +4 -6
- package/lib/room-control/whiteboard-control-v2/annotation-control/factory.js +5 -10
- package/lib/room-control/whiteboard-control-v2/base/index.js +34 -41
- package/lib/room-control/whiteboard-control-v2/base/main-window.js +24 -29
- package/lib/room-control/whiteboard-control-v2/utils.js +6 -7
- package/lib/room-control/whiteboard-control-v2/whiteboard-control/control.d.ts +0 -1
- package/lib/room-control/whiteboard-control-v2/whiteboard-control/control.js +23 -34
- package/lib/room-control/whiteboard-control-v2/whiteboard-control/factory.js +7 -14
- package/lib/room-router/index.js +47 -53
- package/lib/room-router/type.d.ts +2 -2
- package/lib/service/api.js +227 -250
- package/lib/utilities/collection.js +2 -3
- package/lib/utilities/error-helpers.js +27 -34
- package/lib/utilities/error.js +8 -9
- package/lib/utilities/join-helper.js +25 -32
- package/lib/utilities/logger.js +3 -6
- package/lib/utilities/parameters.js +4 -8
- package/lib/utilities/retry-helpers.js +0 -1
- package/lib/utilities/stream.js +11 -16
- package/lib/utilities/user.js +3 -4
- package/lib/utilities/validate-params.js +1 -2
- package/package.json +5 -6
package/lib/plugins/chatroom.js
CHANGED
|
@@ -1,10 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
require("core-js/modules/es.symbol.description.js");
|
|
4
3
|
require("core-js/modules/es.array.push.js");
|
|
5
4
|
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");
|
|
8
5
|
require("core-js/modules/esnext.map.delete-all.js");
|
|
9
6
|
require("core-js/modules/esnext.map.emplace.js");
|
|
10
7
|
require("core-js/modules/esnext.map.every.js");
|
|
@@ -25,12 +22,8 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
25
22
|
value: true
|
|
26
23
|
});
|
|
27
24
|
exports.FcrChatRoomControlImpl = void 0;
|
|
28
|
-
require("core-js/modules/es.error.cause.js");
|
|
29
|
-
require("core-js/modules/es.regexp.exec.js");
|
|
30
25
|
require("core-js/modules/esnext.iterator.constructor.js");
|
|
31
26
|
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"));
|
|
34
27
|
var _imports = require("../imports");
|
|
35
28
|
var _observable = require("agora-foundation/lib/utilities/observable");
|
|
36
29
|
var _easemobWebsdk = _interopRequireDefault(require("easemob-websdk"));
|
|
@@ -41,20 +34,44 @@ var _type2 = require("../chat-connection/type");
|
|
|
41
34
|
var _logger = require("../utilities/logger");
|
|
42
35
|
var _validateParams = _interopRequireDefault(require("../utilities/validate-params"));
|
|
43
36
|
var _schema = require("../schema");
|
|
44
|
-
|
|
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; }
|
|
37
|
+
let _initProto, _sendMessageDecs;
|
|
48
38
|
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)]; } }; }
|
|
49
39
|
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
|
|
50
40
|
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); }
|
|
51
41
|
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; }
|
|
52
42
|
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");
|
|
54
43
|
/**
|
|
55
44
|
* @internal
|
|
56
45
|
*/
|
|
57
46
|
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
|
+
_sceneObserver = {
|
|
56
|
+
onJoinSceneSuccess: () => this._handleJoinSceneSuccess(),
|
|
57
|
+
onJoinSceneFailure: () => this._handleJoinSceneFailure()
|
|
58
|
+
};
|
|
59
|
+
_chatConnectionObserver = {
|
|
60
|
+
onConnectionStateUpdated: async state => {
|
|
61
|
+
// im reconnect
|
|
62
|
+
this.logger.info(`onConnectionStateUpdated, chatConnectionState: ${state}, chatControlState: ${this.getConnectionState()}`);
|
|
63
|
+
if (state === _type2.FcrChatConnectionState.DISCONNECTED && this.getConnectionState() === _type.FcrChatRoomConnectionState.Connected) {
|
|
64
|
+
this._setConnectionState(_type.FcrChatRoomConnectionState.Disconnected);
|
|
65
|
+
} else if (state === _type2.FcrChatConnectionState.CONNECTED && this.getConnectionState() !== _type.FcrChatRoomConnectionState.Connected) {
|
|
66
|
+
this._removeEventListener();
|
|
67
|
+
this._addEventListener();
|
|
68
|
+
await this._joinChatRoom(state);
|
|
69
|
+
}
|
|
70
|
+
},
|
|
71
|
+
onConnectionLoginSuccess: () => {
|
|
72
|
+
this._addEventListener();
|
|
73
|
+
}
|
|
74
|
+
};
|
|
58
75
|
get conn() {
|
|
59
76
|
if (!this._chatConnection.getConnectionInstance()) {
|
|
60
77
|
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'));
|
|
@@ -68,206 +85,6 @@ class FcrChatRoomControlImpl {
|
|
|
68
85
|
return this._scene.getScenePropertiesByKeyPath('widgets.easemobIM.extra.chatRoomId');
|
|
69
86
|
}
|
|
70
87
|
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
|
-
});
|
|
271
88
|
this._scene = _scene;
|
|
272
89
|
this._chatConnection = _chatConnection;
|
|
273
90
|
this._roomCache = sharedCache.getRoomCache(_scene.sceneId);
|
|
@@ -306,14 +123,42 @@ class FcrChatRoomControlImpl {
|
|
|
306
123
|
}
|
|
307
124
|
});
|
|
308
125
|
}
|
|
126
|
+
_joinChatRoom = async state => {
|
|
127
|
+
this.logger.info(`joinChatRoom, chatConnectionState: ${state}, chatControlState: ${this.getConnectionState()}`);
|
|
128
|
+
if (state === _type2.FcrChatConnectionState.CONNECTED && this.getConnectionState() === _type.FcrChatRoomConnectionState.Disconnected && this.chatRoomId) {
|
|
129
|
+
this._setConnectionState(_type.FcrChatRoomConnectionState.Connecting);
|
|
130
|
+
this.logger.info(`start join chat room, room id: ${this.chatRoomId}, scene id: ${this._scene.sceneId}`);
|
|
131
|
+
let error = null;
|
|
132
|
+
[error] = await (0, _imports.to)((0, _imports.retryAttempt)(async () => {
|
|
133
|
+
await this.conn.joinChatRoom({
|
|
134
|
+
roomId: this.chatRoomId
|
|
135
|
+
});
|
|
136
|
+
}, [], {
|
|
137
|
+
retriesMax: 4
|
|
138
|
+
}).fail(async ({
|
|
139
|
+
error,
|
|
140
|
+
timeFn,
|
|
141
|
+
currentRetry
|
|
142
|
+
}) => {
|
|
143
|
+
this.logger.error(`retry to join chat room, ${error.message}, retry ${currentRetry} times`);
|
|
144
|
+
await timeFn();
|
|
145
|
+
return true;
|
|
146
|
+
}).exec());
|
|
147
|
+
if (error) {
|
|
148
|
+
this._setConnectionState(_type.FcrChatRoomConnectionState.Disconnected);
|
|
149
|
+
throw error;
|
|
150
|
+
}
|
|
151
|
+
this._setConnectionState(_type.FcrChatRoomConnectionState.Connected);
|
|
152
|
+
}
|
|
153
|
+
};
|
|
309
154
|
_removeEventListener() {
|
|
310
155
|
this._scene.removeObserver(this._sceneObserver);
|
|
311
|
-
this.conn.removeEventHandler(
|
|
156
|
+
this.conn.removeEventHandler(`chatroom${this._scene.sceneId}`);
|
|
312
157
|
}
|
|
313
158
|
_addEventListener() {
|
|
314
159
|
this._removeEventListener();
|
|
315
160
|
this._scene.addObserver(this._sceneObserver);
|
|
316
|
-
this.conn.addEventHandler(
|
|
161
|
+
this.conn.addEventHandler(`chatroom${this._scene.sceneId}`, {
|
|
317
162
|
onTextMessage: msg => {
|
|
318
163
|
if (msg.to !== this.chatRoomId) {
|
|
319
164
|
return;
|
|
@@ -328,9 +173,10 @@ class FcrChatRoomControlImpl {
|
|
|
328
173
|
}
|
|
329
174
|
// 这里的数据结构和 onTextMessage 不一样,实际上contentsType是img ,type是chatroom,
|
|
330
175
|
// 但是因为在onPictureMessage的回调中,所以这里直接用type: 'img',后续可以考虑优化
|
|
331
|
-
const message = this._convertAgoraChatMessageToFcrChatRoomReceiveMessage(
|
|
176
|
+
const message = this._convertAgoraChatMessageToFcrChatRoomReceiveMessage({
|
|
177
|
+
...msg,
|
|
332
178
|
type: 'img'
|
|
333
|
-
})
|
|
179
|
+
});
|
|
334
180
|
this._observable.notifyObservers('onImageMessageReceived', this._scene.sceneId, message);
|
|
335
181
|
};
|
|
336
182
|
|
|
@@ -358,25 +204,158 @@ class FcrChatRoomControlImpl {
|
|
|
358
204
|
// }
|
|
359
205
|
// };
|
|
360
206
|
}
|
|
207
|
+
_convertAgoraChatMessageToFcrChatRoomReceiveMessage = msg => {
|
|
208
|
+
// TODO: 没看到有 contentsType 字段
|
|
209
|
+
//@ts-ignore
|
|
210
|
+
switch (msg.type) {
|
|
211
|
+
case 'txt':
|
|
212
|
+
{
|
|
213
|
+
const message = {
|
|
214
|
+
id: msg.id,
|
|
215
|
+
//@ts-ignore
|
|
216
|
+
from: msg.ext.sender,
|
|
217
|
+
type: _type.FcrChatRoomMessageType.Text,
|
|
218
|
+
//@ts-ignore
|
|
219
|
+
timestamp: parseInt(msg.time),
|
|
220
|
+
//@ts-ignore
|
|
221
|
+
content: msg.msg,
|
|
222
|
+
isPrivate: msg.ext?.isPrivate,
|
|
223
|
+
properties: msg.ext?.properties
|
|
224
|
+
};
|
|
225
|
+
return message;
|
|
226
|
+
}
|
|
227
|
+
case 'img':
|
|
228
|
+
{
|
|
229
|
+
const message = {
|
|
230
|
+
id: msg.id,
|
|
231
|
+
from: msg.ext?.sender,
|
|
232
|
+
type: _type.FcrChatRoomMessageType.Image,
|
|
233
|
+
//@ts-ignore
|
|
234
|
+
timestamp: parseInt(msg.time),
|
|
235
|
+
url: msg.url || '',
|
|
236
|
+
isPrivate: msg.ext?.isPrivate,
|
|
237
|
+
properties: msg.ext?.properties
|
|
238
|
+
};
|
|
239
|
+
return message;
|
|
240
|
+
}
|
|
241
|
+
}
|
|
242
|
+
throw (0, _error.generateFcrCoreClientError)(_error.FcrErrorModuleCode.ROOM_CHATROOM, _error.FcrErrorCode.UNDEFINED_ERROR, 'unknown remote message type', new Error('unknown remote message type'));
|
|
243
|
+
};
|
|
244
|
+
_convertAgoraChatHistoryMessageToFcrChatRoomReceiveMessage = msg => {
|
|
245
|
+
// TODO: 没看到有 contentsType 字段
|
|
246
|
+
//@ts-ignore
|
|
247
|
+
switch (msg.contentsType) {
|
|
248
|
+
case 'TEXT':
|
|
249
|
+
{
|
|
250
|
+
const message = {
|
|
251
|
+
id: msg.id,
|
|
252
|
+
//@ts-ignore
|
|
253
|
+
from: msg.ext.sender,
|
|
254
|
+
type: _type.FcrChatRoomMessageType.Text,
|
|
255
|
+
//@ts-ignore
|
|
256
|
+
timestamp: parseInt(msg.time),
|
|
257
|
+
//@ts-ignore
|
|
258
|
+
content: msg.data,
|
|
259
|
+
//@ts-ignore
|
|
260
|
+
isPrivate: msg.ext.isPrivate,
|
|
261
|
+
//@ts-ignore
|
|
262
|
+
properties: msg.ext?.properties
|
|
263
|
+
};
|
|
264
|
+
return message;
|
|
265
|
+
}
|
|
266
|
+
case 'IMAGE':
|
|
267
|
+
{
|
|
268
|
+
const message = {
|
|
269
|
+
id: msg.id,
|
|
270
|
+
//@ts-ignore
|
|
271
|
+
from: msg.ext?.sender,
|
|
272
|
+
type: _type.FcrChatRoomMessageType.Image,
|
|
273
|
+
//@ts-ignore
|
|
274
|
+
timestamp: parseInt(msg.time),
|
|
275
|
+
//@ts-ignore
|
|
276
|
+
url: msg.url || '',
|
|
277
|
+
//@ts-ignore
|
|
278
|
+
isPrivate: msg.ext?.isPrivate,
|
|
279
|
+
//@ts-ignore
|
|
280
|
+
properties: msg.ext?.properties
|
|
281
|
+
};
|
|
282
|
+
return message;
|
|
283
|
+
}
|
|
284
|
+
}
|
|
285
|
+
throw (0, _error.generateFcrCoreClientError)(_error.FcrErrorModuleCode.ROOM_CHATROOM, _error.FcrErrorCode.UNDEFINED_ERROR, 'unknown remote message type', new Error('unknown remote message type'));
|
|
286
|
+
};
|
|
287
|
+
_convertFcrChatRoomSendBaseMessageToAgoraChatMessage = (msg, progress) => {
|
|
288
|
+
switch (msg.type) {
|
|
289
|
+
case _type.FcrChatRoomMessageType.Text:
|
|
290
|
+
{
|
|
291
|
+
const message = msg;
|
|
292
|
+
const isPrivate = !!message.to?.length;
|
|
293
|
+
const localUserId = this._scene.getLocalUser().getLocalUserId();
|
|
294
|
+
const localUserInfo = this._scene.getUser(localUserId);
|
|
295
|
+
return _easemobWebsdk.default.message.create({
|
|
296
|
+
to: this.chatRoomId,
|
|
297
|
+
msg: message.content,
|
|
298
|
+
type: 'txt',
|
|
299
|
+
chatType: 'chatRoom',
|
|
300
|
+
ext: {
|
|
301
|
+
sender: (0, _user.convertRteUserToFcrUser)(localUserInfo, this._roomCache),
|
|
302
|
+
roomUuid: this._scene.sceneId,
|
|
303
|
+
isPrivate,
|
|
304
|
+
properties: msg.properties
|
|
305
|
+
},
|
|
306
|
+
receiverList: message.to
|
|
307
|
+
});
|
|
308
|
+
}
|
|
309
|
+
case _type.FcrChatRoomMessageType.Image:
|
|
310
|
+
{
|
|
311
|
+
const imageMessage = msg;
|
|
312
|
+
const isPrivateImage = !!imageMessage.to?.length;
|
|
313
|
+
const localUser = this._scene.getUser(this._scene.getLocalUser().getLocalUserId());
|
|
314
|
+
return _easemobWebsdk.default.message.create({
|
|
315
|
+
to: this.chatRoomId,
|
|
316
|
+
type: 'img',
|
|
317
|
+
chatType: 'chatRoom',
|
|
318
|
+
url: imageMessage.file.filePath,
|
|
319
|
+
file: {
|
|
320
|
+
filename: imageMessage.file.fileName,
|
|
321
|
+
filetype: imageMessage.file.fileType,
|
|
322
|
+
data: imageMessage.file.data,
|
|
323
|
+
url: ''
|
|
324
|
+
},
|
|
325
|
+
ext: {
|
|
326
|
+
sender: (0, _user.convertRteUserToFcrUser)(localUser, this._roomCache),
|
|
327
|
+
roomUuid: this._scene.sceneId,
|
|
328
|
+
isPrivate: isPrivateImage,
|
|
329
|
+
properties: msg.properties
|
|
330
|
+
},
|
|
331
|
+
receiverList: imageMessage.to,
|
|
332
|
+
onFileUploadProgress: e => {
|
|
333
|
+
progress?.(Math.round(e.loaded / e.total * 100));
|
|
334
|
+
}
|
|
335
|
+
});
|
|
336
|
+
}
|
|
337
|
+
}
|
|
338
|
+
throw (0, _error.generateFcrCoreClientError)(_error.FcrErrorModuleCode.ROOM_CHATROOM, _error.FcrErrorCode.UNDEFINED_ERROR, 'unknown local message type', new Error('unknown local message type'));
|
|
339
|
+
};
|
|
361
340
|
async sendMessage(message, progress) {
|
|
362
|
-
var _message$to2;
|
|
363
341
|
const msg = this._convertFcrChatRoomSendBaseMessageToAgoraChatMessage(message, progress);
|
|
364
342
|
const sendMsgRes = await this.conn.send(msg);
|
|
365
343
|
const localUserInfo = this._scene.getUser(this._scene.getLocalUser().getLocalUserId());
|
|
366
|
-
const res =
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
344
|
+
const res = {
|
|
345
|
+
...(message.type === _type.FcrChatRoomMessageType.Text ? {
|
|
346
|
+
content: message.content
|
|
347
|
+
} :
|
|
348
|
+
// @ts-ignore
|
|
349
|
+
{
|
|
350
|
+
url: sendMsgRes.message.url
|
|
351
|
+
}),
|
|
373
352
|
from: (0, _user.convertRteUserToFcrUser)(localUserInfo, this._roomCache),
|
|
374
353
|
id: sendMsgRes.serverMsgId,
|
|
375
354
|
type: message.type,
|
|
376
355
|
properties: message.properties,
|
|
377
356
|
timestamp: Date.now(),
|
|
378
|
-
isPrivate: !!
|
|
379
|
-
}
|
|
357
|
+
isPrivate: !!message.to?.length
|
|
358
|
+
};
|
|
380
359
|
return res;
|
|
381
360
|
}
|
|
382
361
|
addObserver(observer) {
|
|
@@ -412,6 +391,13 @@ class FcrChatRoomControlImpl {
|
|
|
412
391
|
});
|
|
413
392
|
return ret;
|
|
414
393
|
}
|
|
394
|
+
_handleJoinSceneSuccess = () => {
|
|
395
|
+
this._joinSceneSuccess = true;
|
|
396
|
+
this._joinChatRoom(this._chatConnection.getConnectionState());
|
|
397
|
+
};
|
|
398
|
+
_handleJoinSceneFailure = () => {
|
|
399
|
+
this._joinSceneSuccess = false;
|
|
400
|
+
};
|
|
415
401
|
|
|
416
402
|
// TODO: 3.x
|
|
417
403
|
// async getAnnouncement(): Promise<string> {
|
|
@@ -465,6 +451,4 @@ class FcrChatRoomControlImpl {
|
|
|
465
451
|
// });
|
|
466
452
|
// }
|
|
467
453
|
}
|
|
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;
|
|
454
|
+
exports.FcrChatRoomControlImpl = FcrChatRoomControlImpl;
|
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
require("core-js/modules/es.symbol.description.js");
|
|
4
|
-
require("core-js/modules/es.error.cause.js");
|
|
5
3
|
require("core-js/modules/es.array.push.js");
|
|
6
4
|
require("core-js/modules/esnext.function.metadata.js");
|
|
7
5
|
require("core-js/modules/esnext.map.delete-all.js");
|
|
@@ -19,16 +17,12 @@ require("core-js/modules/esnext.map.reduce.js");
|
|
|
19
17
|
require("core-js/modules/esnext.map.some.js");
|
|
20
18
|
require("core-js/modules/esnext.map.update.js");
|
|
21
19
|
require("core-js/modules/esnext.symbol.metadata.js");
|
|
22
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
23
20
|
Object.defineProperty(exports, "__esModule", {
|
|
24
21
|
value: true
|
|
25
22
|
});
|
|
26
23
|
exports.FcrAbilityControlImpl = void 0;
|
|
27
|
-
require("core-js/modules/web.dom-collections.iterator.js");
|
|
28
|
-
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
29
24
|
var _imports = require("../../imports");
|
|
30
25
|
var _logger = require("../../utilities/logger");
|
|
31
|
-
var _FcrAbilityControlImpl;
|
|
32
26
|
let _initProto;
|
|
33
27
|
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)]; } }; }
|
|
34
28
|
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
|
|
@@ -40,15 +34,18 @@ function _checkInRHS(e) { if (Object(e) !== e) throw TypeError("right-hand side
|
|
|
40
34
|
* @internal
|
|
41
35
|
*/
|
|
42
36
|
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
|
+
}));
|
|
43
44
|
constructor(_scene) {
|
|
44
|
-
//@internal
|
|
45
|
-
(0, _defineProperty2.default)(this, "logger", (_initProto(this), (0, _logger.createLogger)({
|
|
46
|
-
prefix: 'FcrAbilityControlImpl'
|
|
47
|
-
})));
|
|
48
45
|
this._scene = _scene;
|
|
49
46
|
}
|
|
50
47
|
getPlatformAbility(ability) {
|
|
51
|
-
const platforms = this._scene.getScenePropertiesByKeyPath(
|
|
48
|
+
const platforms = this._scene.getScenePropertiesByKeyPath(`setting.ability.${ability}`);
|
|
52
49
|
if (!Array.isArray(platforms)) {
|
|
53
50
|
return [];
|
|
54
51
|
}
|
|
@@ -64,6 +61,4 @@ class FcrAbilityControlImpl {
|
|
|
64
61
|
return platforms.includes(platform);
|
|
65
62
|
}
|
|
66
63
|
}
|
|
67
|
-
exports.FcrAbilityControlImpl = FcrAbilityControlImpl;
|
|
68
|
-
_FcrAbilityControlImpl = FcrAbilityControlImpl;
|
|
69
|
-
[_initProto] = _applyDecs(_FcrAbilityControlImpl, [[_imports.trace, 2, "isPlatformAbilitySupported"]], []).e;
|
|
64
|
+
exports.FcrAbilityControlImpl = FcrAbilityControlImpl;
|