fcr-core 3.10.1 → 3.10.5
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/engine/index.js +102 -108
- package/lib/imports.js +1 -0
- package/lib/media-control/desktop.js +22 -13
- package/lib/media-control/mobile.js +27 -19
- package/lib/media-control/type.d.ts +3 -3
- package/lib/monitor-control/index.js +17 -7
- package/lib/peer-session/index.js +120 -121
- package/lib/plugins/chat/chatroom.js +119 -96
- package/lib/plugins/chat/connector.js +69 -48
- package/lib/remote-control/index.js +194 -216
- package/lib/room-control/ability-control/index.js +20 -10
- package/lib/room-control/application-control/index.js +82 -75
- package/lib/room-control/group-control/index.js +31 -30
- package/lib/room-control/helpers/board-init-info-helper.js +16 -10
- package/lib/room-control/helpers/validation-helper.js +1 -1
- package/lib/room-control/index.js +70 -51
- package/lib/room-control/infinity-room-control/index.js +27 -19
- package/lib/room-control/interpreter-control/index.js +77 -65
- 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 +37 -25
- package/lib/room-control/privilege-control/helper.js +28 -13
- package/lib/room-control/privilege-control/index.js +36 -28
- package/lib/room-control/room-connector-control/index.js +52 -49
- package/lib/room-control/room-connector-control/type.d.ts +1 -1
- package/lib/room-control/room-control-factory.js +10 -12
- package/lib/room-control/room-session/index.js +77 -74
- package/lib/room-control/shared-cache.js +63 -56
- package/lib/room-control/sharing-control/index.js +65 -57
- package/lib/room-control/stream-control/index.js +197 -193
- package/lib/room-control/stt-control/de-compress-gzip.js +10 -0
- package/lib/room-control/stt-control/index.js +93 -86
- package/lib/room-control/user-control/index.js +162 -155
- package/lib/room-control/waitingroom-control/index.js +18 -9
- package/lib/room-control/whiteboard-control/utils.js +4 -2
- package/lib/room-control/whiteboard-control-v1/board-subwindow.js +2 -1
- package/lib/room-control/whiteboard-control-v1/board-window.js +120 -103
- package/lib/room-control/whiteboard-control-v1/factory.js +7 -4
- package/lib/room-control/whiteboard-control-v1/index.js +80 -67
- package/lib/room-control/whiteboard-control-v1/mount-manager.js +4 -2
- package/lib/room-control/whiteboard-control-v1/utils.js +17 -14
- package/lib/room-control/whiteboard-control-v2/annotation-control/control.js +14 -10
- package/lib/room-control/whiteboard-control-v2/annotation-control/factory.js +17 -8
- package/lib/room-control/whiteboard-control-v2/base/index.js +61 -53
- package/lib/room-control/whiteboard-control-v2/base/main-window.js +39 -30
- package/lib/room-control/whiteboard-control-v2/utils.js +10 -10
- package/lib/room-control/whiteboard-control-v2/whiteboard-control/control.js +45 -33
- package/lib/room-control/whiteboard-control-v2/whiteboard-control/factory.js +27 -11
- package/lib/room-control/widget-control/index.js +43 -33
- package/lib/room-router/index.js +66 -58
- package/lib/schema.d.ts +15 -15
- package/lib/service/api.js +446 -548
- package/lib/struct.js +5 -2
- package/lib/utilities/abortable-retry.js +3 -0
- package/lib/utilities/collection.js +15 -11
- package/lib/utilities/error-helpers.js +34 -27
- package/lib/utilities/error.js +4 -3
- package/lib/utilities/join-helper.js +37 -31
- package/lib/utilities/logger.js +8 -5
- package/lib/utilities/parameters.js +21 -10
- package/lib/utilities/retry-helpers.js +1 -0
- package/lib/utilities/stream.js +16 -11
- package/lib/utilities/user.js +4 -3
- package/lib/utilities/validate-params.js +1 -1
- package/lib/utilities/video-encoder-config.js +10 -5
- package/lib-es/engine/index.js +102 -108
- package/lib-es/media-control/desktop.js +22 -13
- package/lib-es/media-control/mobile.js +27 -19
- package/lib-es/monitor-control/index.js +16 -7
- package/lib-es/peer-session/index.js +120 -121
- package/lib-es/plugins/chat/chatroom.js +118 -95
- package/lib-es/plugins/chat/connector.js +67 -47
- package/lib-es/remote-control/index.js +194 -216
- package/lib-es/room-control/ability-control/index.js +19 -10
- package/lib-es/room-control/application-control/index.js +81 -75
- package/lib-es/room-control/group-control/index.js +31 -30
- package/lib-es/room-control/helpers/board-init-info-helper.js +15 -10
- package/lib-es/room-control/helpers/validation-helper.js +1 -1
- package/lib-es/room-control/index.js +69 -51
- package/lib-es/room-control/infinity-room-control/index.js +26 -19
- package/lib-es/room-control/interpreter-control/index.js +77 -65
- package/lib-es/room-control/interpreter-control/room.js +5 -4
- package/lib-es/room-control/join-before-host-waitingroom-control/index.js +5 -4
- package/lib-es/room-control/mainroom-control/index.js +37 -25
- package/lib-es/room-control/privilege-control/helper.js +27 -13
- package/lib-es/room-control/privilege-control/index.js +36 -28
- package/lib-es/room-control/room-connector-control/index.js +52 -49
- package/lib-es/room-control/room-control-factory.js +10 -12
- package/lib-es/room-control/room-session/index.js +77 -74
- package/lib-es/room-control/shared-cache.js +62 -56
- package/lib-es/room-control/sharing-control/index.js +64 -57
- package/lib-es/room-control/stream-control/index.js +197 -193
- package/lib-es/room-control/stt-control/de-compress-gzip.js +10 -0
- package/lib-es/room-control/stt-control/index.js +93 -86
- package/lib-es/room-control/user-control/index.js +162 -155
- package/lib-es/room-control/waitingroom-control/index.js +18 -9
- package/lib-es/room-control/whiteboard-control/utils.js +4 -2
- package/lib-es/room-control/whiteboard-control-v1/board-subwindow.js +2 -1
- package/lib-es/room-control/whiteboard-control-v1/board-window.js +120 -103
- package/lib-es/room-control/whiteboard-control-v1/factory.js +6 -4
- package/lib-es/room-control/whiteboard-control-v1/index.js +80 -67
- package/lib-es/room-control/whiteboard-control-v1/mount-manager.js +3 -2
- package/lib-es/room-control/whiteboard-control-v1/utils.js +17 -14
- package/lib-es/room-control/whiteboard-control-v2/annotation-control/control.js +13 -10
- package/lib-es/room-control/whiteboard-control-v2/annotation-control/factory.js +16 -8
- package/lib-es/room-control/whiteboard-control-v2/base/index.js +60 -53
- package/lib-es/room-control/whiteboard-control-v2/base/main-window.js +39 -30
- package/lib-es/room-control/whiteboard-control-v2/utils.js +10 -10
- package/lib-es/room-control/whiteboard-control-v2/whiteboard-control/control.js +45 -33
- package/lib-es/room-control/whiteboard-control-v2/whiteboard-control/factory.js +26 -11
- package/lib-es/room-control/widget-control/index.js +42 -33
- package/lib-es/room-router/index.js +66 -58
- package/lib-es/service/api.js +445 -548
- package/lib-es/struct.js +4 -2
- package/lib-es/utilities/abortable-retry.js +3 -0
- package/lib-es/utilities/collection.js +14 -11
- package/lib-es/utilities/error-helpers.js +33 -26
- package/lib-es/utilities/error.js +4 -3
- package/lib-es/utilities/join-helper.js +36 -29
- package/lib-es/utilities/logger.js +7 -5
- package/lib-es/utilities/parameters.js +21 -10
- package/lib-es/utilities/retry-helpers.js +1 -0
- package/lib-es/utilities/stream.js +15 -11
- package/lib-es/utilities/user.js +4 -3
- package/lib-es/utilities/validate-params.js +1 -1
- package/lib-es/utilities/video-encoder-config.js +10 -5
- package/package.json +4 -4
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import "core-js/modules/es.symbol.description.js";
|
|
1
2
|
import "core-js/modules/es.array.push.js";
|
|
2
3
|
import "core-js/modules/esnext.function.metadata.js";
|
|
3
4
|
import "core-js/modules/esnext.map.delete-all.js";
|
|
@@ -15,8 +16,14 @@ import "core-js/modules/esnext.map.reduce.js";
|
|
|
15
16
|
import "core-js/modules/esnext.map.some.js";
|
|
16
17
|
import "core-js/modules/esnext.map.update.js";
|
|
17
18
|
import "core-js/modules/esnext.symbol.metadata.js";
|
|
19
|
+
import "core-js/modules/web.dom-collections.iterator.js";
|
|
20
|
+
import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
21
|
+
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
22
|
+
var _FcrBaseWhiteboardControlImpl;
|
|
18
23
|
let _initProto;
|
|
24
|
+
import "core-js/modules/es.error.cause.js";
|
|
19
25
|
import "core-js/modules/es.json.stringify.js";
|
|
26
|
+
import "core-js/modules/es.regexp.exec.js";
|
|
20
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)]; } }; }
|
|
21
28
|
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
|
|
22
29
|
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); }
|
|
@@ -37,34 +44,31 @@ import { FcrBoardMainWindowImpl } from './main-window';
|
|
|
37
44
|
|
|
38
45
|
const WHITEBOARD_ROOM_JOIN_TIMEOUT = 20000;
|
|
39
46
|
export class FcrBaseWhiteboardControlImpl {
|
|
40
|
-
static {
|
|
41
|
-
[_initProto] = _applyDecs(this, [[trace, 2, "open"], [trace, 2, "close"], [trace, 2, "release"], [trace, 2, "getConnectionState"], [trace, 2, "getMainWindow"]], []).e;
|
|
42
|
-
}
|
|
43
|
-
logger = (_initProto(this), createLogger({
|
|
44
|
-
prefix: 'FcrBaseWhiteboardControl'
|
|
45
|
-
}));
|
|
46
|
-
observable = new AgoraObservable();
|
|
47
|
-
boardView = null;
|
|
48
|
-
boardRoom = null;
|
|
49
|
-
whiteboard = null;
|
|
50
|
-
connectState = FcrConnectionState.DISCONNECTED;
|
|
51
|
-
boardRoomConfig = null;
|
|
52
|
-
_waitPromise = null;
|
|
53
|
-
_waitPromiseResolve = null;
|
|
54
|
-
_waitPromiseReject = null;
|
|
55
|
-
_openAbortController = null;
|
|
56
|
-
_openState = {
|
|
57
|
-
isOpen: false,
|
|
58
|
-
isNeedLaunch: undefined
|
|
59
|
-
};
|
|
60
47
|
constructor(rtmClient, config, boardRoomConfigFetcher, api) {
|
|
48
|
+
_defineProperty(this, "logger", (_initProto(this), createLogger({
|
|
49
|
+
prefix: 'FcrBaseWhiteboardControl'
|
|
50
|
+
})));
|
|
51
|
+
_defineProperty(this, "observable", new AgoraObservable());
|
|
52
|
+
_defineProperty(this, "boardView", null);
|
|
53
|
+
_defineProperty(this, "boardRoom", null);
|
|
54
|
+
_defineProperty(this, "whiteboard", null);
|
|
55
|
+
_defineProperty(this, "connectState", FcrConnectionState.DISCONNECTED);
|
|
56
|
+
_defineProperty(this, "boardRoomConfig", null);
|
|
57
|
+
_defineProperty(this, "_waitPromise", null);
|
|
58
|
+
_defineProperty(this, "_waitPromiseResolve", null);
|
|
59
|
+
_defineProperty(this, "_waitPromiseReject", null);
|
|
60
|
+
_defineProperty(this, "_openAbortController", null);
|
|
61
|
+
_defineProperty(this, "_openState", {
|
|
62
|
+
isOpen: false,
|
|
63
|
+
isNeedLaunch: undefined
|
|
64
|
+
});
|
|
61
65
|
this.rtmClient = rtmClient;
|
|
62
66
|
this.config = config;
|
|
63
67
|
this.api = api;
|
|
64
68
|
this.boardRoomConfigFetcherTask = AgoraScheduler.shared.addPollingTask(async () => {
|
|
65
69
|
const boardRoomConfig = await boardRoomConfigFetcher();
|
|
66
70
|
this.boardRoomConfig = boardRoomConfig;
|
|
67
|
-
this.logger.info(
|
|
71
|
+
this.logger.info("fetch board room config success, config: ".concat(jsonstring(boardRoomConfig)));
|
|
68
72
|
this.boardRoomConfigFetcherTask.stop();
|
|
69
73
|
if (this._openState.isOpen) {
|
|
70
74
|
this.connect(this._openState.isNeedLaunch);
|
|
@@ -149,7 +153,7 @@ export class FcrBaseWhiteboardControlImpl {
|
|
|
149
153
|
}
|
|
150
154
|
const oldState = this.connectState;
|
|
151
155
|
this.connectState = state;
|
|
152
|
-
this.logger.info(
|
|
156
|
+
this.logger.info("Connection state updated: ".concat(FcrConnectionState[oldState], " -> ").concat(FcrConnectionState[state]));
|
|
153
157
|
this.observable.notifyObservers('onConnectionStateUpdated', state);
|
|
154
158
|
}
|
|
155
159
|
async connect(isNeedLaunch) {
|
|
@@ -164,18 +168,15 @@ export class FcrBaseWhiteboardControlImpl {
|
|
|
164
168
|
abortController.signal.addEventListener('abort', () => {
|
|
165
169
|
reject(new Error('join board aborted'));
|
|
166
170
|
});
|
|
167
|
-
const
|
|
168
|
-
userId,
|
|
169
|
-
userName,
|
|
170
|
-
ipList
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
boardToken
|
|
177
|
-
// boardPerformance = false,
|
|
178
|
-
} = this.boardRoomConfig || {};
|
|
171
|
+
const _this$config = this.config,
|
|
172
|
+
userId = _this$config.userId,
|
|
173
|
+
userName = _this$config.userName,
|
|
174
|
+
ipList = _this$config.ipList;
|
|
175
|
+
const _ref = this.boardRoomConfig || {},
|
|
176
|
+
boardAppId = _ref.boardAppId,
|
|
177
|
+
boardId = _ref.boardId,
|
|
178
|
+
boardRegion = _ref.boardRegion,
|
|
179
|
+
boardToken = _ref.boardToken;
|
|
179
180
|
if (!boardAppId) {
|
|
180
181
|
throw generateFcrCoreClientError(ErrorModuleCode.FCR_ROOM_WHITEBOARD, DetailErrorCode.UNDEFINED_ERROR, 'boardAppId is required');
|
|
181
182
|
}
|
|
@@ -189,21 +190,21 @@ export class FcrBaseWhiteboardControlImpl {
|
|
|
189
190
|
let width = whiteboardOption.width;
|
|
190
191
|
let height = whiteboardOption.height;
|
|
191
192
|
if (!width) {
|
|
192
|
-
this.logger.warn(
|
|
193
|
+
this.logger.warn("board width is a invalid vlaue: ".concat(width, ", using default value 800"));
|
|
193
194
|
whiteboardOption.width = 800;
|
|
194
195
|
}
|
|
195
196
|
if (!height) {
|
|
196
|
-
this.logger.warn(
|
|
197
|
+
this.logger.warn("board height is a invalid value: ".concat(height, ", using default value 600"));
|
|
197
198
|
whiteboardOption.height = 600;
|
|
198
199
|
}
|
|
199
|
-
this.logger.info(
|
|
200
|
+
this.logger.info("open board with boardId: ".concat(boardId, ", boardToken: ").concat(boardToken, ", region: ").concat(boardRegion, ", appIdentifier: ").concat(boardAppId, " whiteboardOption: ").concat(jsonstring(whiteboardOption)));
|
|
200
201
|
let endpoint = undefined;
|
|
201
202
|
if (ipList !== undefined) {
|
|
202
203
|
if (Array.isArray(ipList) && ipList[0]) {
|
|
203
|
-
this.logger.info(
|
|
204
|
+
this.logger.info("use ipList from config: ".concat(jsonstring(ipList)));
|
|
204
205
|
endpoint = ipList[0];
|
|
205
206
|
} else {
|
|
206
|
-
this.logger.error(
|
|
207
|
+
this.logger.error("ipList in config is empty or invalid: ".concat(jsonstring(ipList), ", ignore ipList config"));
|
|
207
208
|
}
|
|
208
209
|
}
|
|
209
210
|
const rtmProvider = new RTMProvider_2_2(this.rtmClient);
|
|
@@ -222,14 +223,14 @@ export class FcrBaseWhiteboardControlImpl {
|
|
|
222
223
|
// 第一个开启白板的人需要调用 launch 方法, 其他人监听 launch 事件获取白板实例
|
|
223
224
|
if (isNeedLaunch) {
|
|
224
225
|
getWhiteboard = () => {
|
|
225
|
-
this.logger.info(
|
|
226
|
+
this.logger.info("ApplicationManager.launchApplication calling, appId: ".concat(appId, ", option: ").concat(jsonstring(whiteboardOption)));
|
|
226
227
|
return wbRoom.applicationManager.launchApplication(WhiteboardApplication, whiteboardOption, appId);
|
|
227
228
|
};
|
|
228
229
|
} else {
|
|
229
230
|
const launchPromise = new Promise((launchPromseResolve, launchPromseReject) => {
|
|
230
231
|
this.logger.info('ApplicationManager.once launch event listening');
|
|
231
232
|
wbRoom.applicationManager.once('launch', (appId, app) => {
|
|
232
|
-
this.logger.info(
|
|
233
|
+
this.logger.info("ApplicationManager.launch event received, appId: ".concat(appId));
|
|
233
234
|
launchPromseResolve(app);
|
|
234
235
|
});
|
|
235
236
|
});
|
|
@@ -237,7 +238,7 @@ export class FcrBaseWhiteboardControlImpl {
|
|
|
237
238
|
return launchPromise;
|
|
238
239
|
};
|
|
239
240
|
}
|
|
240
|
-
|
|
241
|
+
var _await$to = await to(retryAttempt(async () => {
|
|
241
242
|
const joinRoomParams = {
|
|
242
243
|
userId,
|
|
243
244
|
nickName: userName || userId,
|
|
@@ -250,7 +251,7 @@ export class FcrBaseWhiteboardControlImpl {
|
|
|
250
251
|
writable: true
|
|
251
252
|
// verboseLog: true,
|
|
252
253
|
};
|
|
253
|
-
this.logger.info(
|
|
254
|
+
this.logger.info("Room.joinRoom calling, params: ".concat(jsonstring(joinRoomParams), ", timeout: ").concat(WHITEBOARD_ROOM_JOIN_TIMEOUT));
|
|
254
255
|
|
|
255
256
|
// 20 秒超时
|
|
256
257
|
await wbRoom.joinRoom(joinRoomParams, WHITEBOARD_ROOM_JOIN_TIMEOUT);
|
|
@@ -259,28 +260,29 @@ export class FcrBaseWhiteboardControlImpl {
|
|
|
259
260
|
if (isNeedLaunch) {
|
|
260
261
|
// 在同一个房间内只有第一次调用 launchApplication 时传入的宽高参数会生效, 后续的调用不会生效, 所以需要在这里更新宽高
|
|
261
262
|
// 只有 launch 的用户需要更新宽、高, 白板会自动同步给后加入的用户
|
|
262
|
-
this.logger.info(
|
|
263
|
+
this.logger.info("Whiteboard.updateViewport calling, width: ".concat(width, ", height: ").concat(height));
|
|
263
264
|
whiteboard.updateViewport(width, height);
|
|
264
265
|
}
|
|
265
266
|
}, [], {
|
|
266
267
|
retriesMax: 0
|
|
267
|
-
}).fail(async
|
|
268
|
-
error,
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
}) => {
|
|
268
|
+
}).fail(async _ref2 => {
|
|
269
|
+
let error = _ref2.error,
|
|
270
|
+
timeFn = _ref2.timeFn,
|
|
271
|
+
currentRetry = _ref2.currentRetry;
|
|
272
272
|
if (abortController.signal.aborted) {
|
|
273
273
|
throw new Error('join board aborted');
|
|
274
274
|
}
|
|
275
|
-
this.logger.error(
|
|
275
|
+
this.logger.error("failed to join board, error: ".concat(error.message, ", current retry: ").concat(currentRetry), error);
|
|
276
276
|
await timeFn();
|
|
277
277
|
return true;
|
|
278
278
|
}).exec());
|
|
279
|
+
var _await$to2 = _slicedToArray(_await$to, 1);
|
|
280
|
+
error = _await$to2[0];
|
|
279
281
|
if (abortController.signal.aborted) {
|
|
280
282
|
throw new Error('join board aborted');
|
|
281
283
|
}
|
|
282
284
|
if (error) {
|
|
283
|
-
this.logger.error(
|
|
285
|
+
this.logger.error("join board failed, ".concat(error.message, "-").concat(JSON.stringify(error)));
|
|
284
286
|
throw error;
|
|
285
287
|
}
|
|
286
288
|
this.logger.info('Whiteboard camera settings: enableCameraByMouse=false, enableCameraByTouch=false');
|
|
@@ -308,7 +310,7 @@ export class FcrBaseWhiteboardControlImpl {
|
|
|
308
310
|
this._clearWaitPromise();
|
|
309
311
|
}
|
|
310
312
|
} catch (e) {
|
|
311
|
-
this.logger.error(
|
|
313
|
+
this.logger.error("join board failed");
|
|
312
314
|
this.updateConnectionState(FcrConnectionState.DISCONNECTED);
|
|
313
315
|
reject(e);
|
|
314
316
|
if (this._waitPromiseReject) {
|
|
@@ -347,4 +349,9 @@ export class FcrBaseWhiteboardControlImpl {
|
|
|
347
349
|
this._waitPromiseReject = null;
|
|
348
350
|
this._waitPromise = null;
|
|
349
351
|
}
|
|
350
|
-
}
|
|
352
|
+
}
|
|
353
|
+
_FcrBaseWhiteboardControlImpl = FcrBaseWhiteboardControlImpl;
|
|
354
|
+
var _applyDecs$e = _applyDecs(_FcrBaseWhiteboardControlImpl, [[trace, 2, "open"], [trace, 2, "close"], [trace, 2, "release"], [trace, 2, "getConnectionState"], [trace, 2, "getMainWindow"]], []).e;
|
|
355
|
+
var _applyDecs$e2 = _slicedToArray(_applyDecs$e, 1);
|
|
356
|
+
_initProto = _applyDecs$e2[0];
|
|
357
|
+
_applyDecs$e;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import "core-js/modules/es.symbol.description.js";
|
|
1
2
|
import "core-js/modules/es.array.push.js";
|
|
2
3
|
import "core-js/modules/esnext.function.metadata.js";
|
|
3
4
|
import "core-js/modules/esnext.map.delete-all.js";
|
|
@@ -15,7 +16,12 @@ import "core-js/modules/esnext.map.reduce.js";
|
|
|
15
16
|
import "core-js/modules/esnext.map.some.js";
|
|
16
17
|
import "core-js/modules/esnext.map.update.js";
|
|
17
18
|
import "core-js/modules/esnext.symbol.metadata.js";
|
|
18
|
-
|
|
19
|
+
import "core-js/modules/web.dom-collections.iterator.js";
|
|
20
|
+
import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
21
|
+
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
22
|
+
var _FcrBoardMainWindowImpl;
|
|
23
|
+
let _initProto, _setBackgroundColorDecs, _setToolTypeDecs, _setStrokeWidthDecs, _setStrokeColorDecs, _setTextColorDecs, _setTextSizeDecs, _insertImageDecs, _setContainerSizeRatioDecs, _setBoardTransparentDecs, _updateWindowSizeDecs, _setAutoCancelDrawDecs, _handleApplicationLaunchDecs, _handleApplicationTerminalDecs, _enableAutoCancelDecs, _ref;
|
|
24
|
+
import "core-js/modules/es.error.cause.js";
|
|
19
25
|
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)]; } }; }
|
|
20
26
|
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
|
|
21
27
|
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); }
|
|
@@ -32,19 +38,17 @@ import { bound } from 'agora-foundation/lib/decorator';
|
|
|
32
38
|
import { FcrReturnCode } from '../../../type';
|
|
33
39
|
import { handleRequestError } from '../../../utilities/error';
|
|
34
40
|
import { ErrorModuleCode } from '../../../imports';
|
|
41
|
+
_ref = (_setBackgroundColorDecs = [trace(['color']), validateParams(stringSchema)], _setToolTypeDecs = [trace(['type']), validateParams(fcrBoardToolTypeSchema)], _setStrokeWidthDecs = [trace(['strokeWidth']), validateParams(numberSchema)], _setStrokeColorDecs = [trace(['color']), validateParams(z.union([colorSchema, stringSchema]))], _setTextColorDecs = [trace(['color']), validateParams(colorSchema)], _setTextSizeDecs = [trace(['textSize']), validateParams(numberSchema)], _insertImageDecs = [trace(['resourceUrl', 'x', 'y', 'width', 'height']), validateParams(stringSchema, numberSchema, numberSchema, numberSchema, numberSchema)], _setContainerSizeRatioDecs = [trace(['ratio']), validateParams(numberSchema)], _setBoardTransparentDecs = [trace(['isTransparent']), validateParams(booleanSchema)], _updateWindowSizeDecs = [trace(['size']), validateParams(fcrSizeSchema)], _setAutoCancelDrawDecs = [trace(['enable']), validateParams(booleanSchema)], _handleApplicationLaunchDecs = [bound, trace(['appId', 'app'])], _handleApplicationTerminalDecs = [bound, trace(['appId', 'app'])], _enableAutoCancelDecs = trace(['enable']), "logger");
|
|
35
42
|
export class FcrBoardMainWindowImpl {
|
|
36
|
-
static {
|
|
37
|
-
[_initProto] = _applyDecs(this, [[trace, 2, "addPage"], [trace, 2, "removePage"], [trace, 2, "undo"], [trace, 2, "redo"], [trace, 2, "clean"], [trace, 2, "getSnapshotImage"], [_setBackgroundColorDecs, 2, "setBackgroundColor"], [trace, 2, "getPageInfo"], [trace, 2, "prevPage"], [trace, 2, "nextPage"], [_setToolTypeDecs, 2, "setToolType"], [_setStrokeWidthDecs, 2, "setStrokeWidth"], [_setStrokeColorDecs, 2, "setStrokeColor"], [_setTextColorDecs, 2, "setTextColor"], [_setTextSizeDecs, 2, "setTextSize"], [_insertImageDecs, 2, "insertImage"], [trace, 2, "getContentView"], [_setContainerSizeRatioDecs, 2, "setContainerSizeRatio"], [_setBoardTransparentDecs, 2, "setBoardTransparent"], [_updateWindowSizeDecs, 2, "updateWindowSize"], [_setAutoCancelDrawDecs, 2, "setAutoCancelDraw"], [trace, 2, "getWritable"], [_handleApplicationLaunchDecs, 2, "_handleApplicationLaunch"], [_handleApplicationTerminalDecs, 2, "_handleApplicationTerminal"], [_enableAutoCancelDecs, 2, "_enableAutoCancel"]], []).e;
|
|
38
|
-
}
|
|
39
|
-
[(_setBackgroundColorDecs = [trace(['color']), validateParams(stringSchema)], _setToolTypeDecs = [trace(['type']), validateParams(fcrBoardToolTypeSchema)], _setStrokeWidthDecs = [trace(['strokeWidth']), validateParams(numberSchema)], _setStrokeColorDecs = [trace(['color']), validateParams(z.union([colorSchema, stringSchema]))], _setTextColorDecs = [trace(['color']), validateParams(colorSchema)], _setTextSizeDecs = [trace(['textSize']), validateParams(numberSchema)], _insertImageDecs = [trace(['resourceUrl', 'x', 'y', 'width', 'height']), validateParams(stringSchema, numberSchema, numberSchema, numberSchema, numberSchema)], _setContainerSizeRatioDecs = [trace(['ratio']), validateParams(numberSchema)], _setBoardTransparentDecs = [trace(['isTransparent']), validateParams(booleanSchema)], _updateWindowSizeDecs = [trace(['size']), validateParams(fcrSizeSchema)], _setAutoCancelDrawDecs = [trace(['enable']), validateParams(booleanSchema)], _handleApplicationLaunchDecs = [bound, trace(['appId', 'app'])], _handleApplicationTerminalDecs = [bound, trace(['appId', 'app'])], _enableAutoCancelDecs = trace(['enable']), "logger")] = (_initProto(this), createLogger({
|
|
40
|
-
prefix: 'FcrBoardMainWindowImpl'
|
|
41
|
-
}));
|
|
42
|
-
_observable = new AgoraObservable();
|
|
43
|
-
_currentPage = 0;
|
|
44
|
-
_background = 'rgba(0, 0, 0, 0)';
|
|
45
|
-
_isAutoCancelEnabled = false;
|
|
46
|
-
_isWritable = false;
|
|
47
43
|
constructor(whiteboard, boardRoom, appId, _roomId, _userId, _api) {
|
|
44
|
+
_defineProperty(this, _ref, (_initProto(this), createLogger({
|
|
45
|
+
prefix: 'FcrBoardMainWindowImpl'
|
|
46
|
+
})));
|
|
47
|
+
_defineProperty(this, "_observable", new AgoraObservable());
|
|
48
|
+
_defineProperty(this, "_currentPage", 0);
|
|
49
|
+
_defineProperty(this, "_background", 'rgba(0, 0, 0, 0)');
|
|
50
|
+
_defineProperty(this, "_isAutoCancelEnabled", false);
|
|
51
|
+
_defineProperty(this, "_isWritable", false);
|
|
48
52
|
this._roomId = _roomId;
|
|
49
53
|
this._userId = _userId;
|
|
50
54
|
this._api = _api;
|
|
@@ -52,8 +56,8 @@ export class FcrBoardMainWindowImpl {
|
|
|
52
56
|
this._boardView = document.createElement('div');
|
|
53
57
|
this._boardView.classList.add('fcr-whiteboard-window-view');
|
|
54
58
|
this._boardView.appendChild(whiteboard.view);
|
|
55
|
-
this._boardView.style.height =
|
|
56
|
-
this._boardView.style.width =
|
|
59
|
+
this._boardView.style.height = "100%";
|
|
60
|
+
this._boardView.style.width = "100%";
|
|
57
61
|
this._boardView.setAttribute('data-app-id', appId);
|
|
58
62
|
this._whiteboard = whiteboard;
|
|
59
63
|
this._boardRoom = boardRoom;
|
|
@@ -63,17 +67,17 @@ export class FcrBoardMainWindowImpl {
|
|
|
63
67
|
boardRoom.applicationManager.on('terminal', this._handleApplicationTerminal);
|
|
64
68
|
|
|
65
69
|
// @ts-ignore
|
|
66
|
-
this.logger.info(
|
|
70
|
+
this.logger.info("initialized, room: ".concat(boardRoom.roomId));
|
|
67
71
|
}
|
|
68
72
|
internalSetWritable(isWritable) {
|
|
69
|
-
this.logger.info(
|
|
73
|
+
this.logger.info("internalSetWritable called, isWritable: ".concat(isWritable, ", previous state: ").concat(this._isWritable));
|
|
70
74
|
this._boardRoom.setWritable(isWritable);
|
|
71
75
|
this._isWritable = isWritable;
|
|
72
76
|
this._observable.notifyObservers('onWritable', isWritable);
|
|
73
|
-
this.logger.info(
|
|
77
|
+
this.logger.info("Writable state updated to ".concat(isWritable));
|
|
74
78
|
}
|
|
75
79
|
async setWritable(isWritable) {
|
|
76
|
-
this.logger.info(
|
|
80
|
+
this.logger.info("setWritable called, isWritable: ".concat(isWritable, ", current state: ").concat(this._isWritable));
|
|
77
81
|
if (!this._api) {
|
|
78
82
|
// api deops not exist in sub process, directly set writable state
|
|
79
83
|
this.internalSetWritable(isWritable);
|
|
@@ -83,8 +87,8 @@ export class FcrBoardMainWindowImpl {
|
|
|
83
87
|
roomId: this._roomId,
|
|
84
88
|
userId: this._userId,
|
|
85
89
|
state: isWritable ? 1 : 0
|
|
86
|
-
}), ErrorModuleCode.FCR_ROOM_WHITEBOARD,
|
|
87
|
-
this.logger.info(
|
|
90
|
+
}), ErrorModuleCode.FCR_ROOM_WHITEBOARD, "set whiteboard write permission to ".concat(isWritable, " failed"));
|
|
91
|
+
this.logger.info("Set writable to ".concat(isWritable, " successfully"));
|
|
88
92
|
this.internalSetWritable(isWritable);
|
|
89
93
|
return FcrReturnCode.SUCCESS;
|
|
90
94
|
}
|
|
@@ -138,7 +142,7 @@ export class FcrBoardMainWindowImpl {
|
|
|
138
142
|
}
|
|
139
143
|
async setBackgroundColor(color) {
|
|
140
144
|
this._background = color;
|
|
141
|
-
this.logger.info(
|
|
145
|
+
this.logger.info("set canvas background color: ".concat(this._background));
|
|
142
146
|
this._whiteboard.setCanvasBackgroundColor(color);
|
|
143
147
|
return FcrReturnCode.SUCCESS;
|
|
144
148
|
}
|
|
@@ -174,7 +178,7 @@ export class FcrBoardMainWindowImpl {
|
|
|
174
178
|
return FcrReturnCode.SUCCESS;
|
|
175
179
|
}
|
|
176
180
|
async setStrokeColor(color) {
|
|
177
|
-
const c = typeof color === 'string' ? color :
|
|
181
|
+
const c = typeof color === 'string' ? color : "rgb(".concat(color.r, ",").concat(color.g, ",").concat(color.b, ")");
|
|
178
182
|
if (this._whiteboard) {
|
|
179
183
|
this._whiteboard.strokeColor = c;
|
|
180
184
|
} else {
|
|
@@ -183,7 +187,7 @@ export class FcrBoardMainWindowImpl {
|
|
|
183
187
|
return FcrReturnCode.SUCCESS;
|
|
184
188
|
}
|
|
185
189
|
async setTextColor(color) {
|
|
186
|
-
const c = typeof color === 'string' ? color :
|
|
190
|
+
const c = typeof color === 'string' ? color : "rgb(".concat(color.r, ",").concat(color.g, ",").concat(color.b, ")");
|
|
187
191
|
if (this._whiteboard) {
|
|
188
192
|
this._whiteboard.fillColor = c;
|
|
189
193
|
} else {
|
|
@@ -251,7 +255,7 @@ export class FcrBoardMainWindowImpl {
|
|
|
251
255
|
this._whiteboard = app;
|
|
252
256
|
this._setBoardViewStyle(app.view);
|
|
253
257
|
if (this._background) {
|
|
254
|
-
this.logger.info(
|
|
258
|
+
this.logger.info("set canvas background color: ".concat(this._background));
|
|
255
259
|
this._whiteboard.setCanvasBackgroundColor(this._background);
|
|
256
260
|
}
|
|
257
261
|
this._enableAutoCancel(this._isAutoCancelEnabled);
|
|
@@ -266,19 +270,19 @@ export class FcrBoardMainWindowImpl {
|
|
|
266
270
|
_handleApplicationTerminal(appId, app) {
|
|
267
271
|
try {
|
|
268
272
|
if (this._boardView.contains(app.view)) {
|
|
269
|
-
this.logger.info(
|
|
273
|
+
this.logger.info("remove application view: ".concat(appId));
|
|
270
274
|
this._boardView.removeChild(app.view);
|
|
271
275
|
} else {
|
|
272
|
-
this.logger.warn(
|
|
276
|
+
this.logger.warn("application view not found in board view: ".concat(appId));
|
|
273
277
|
}
|
|
274
278
|
} catch (e) {
|
|
275
|
-
this.logger.error(
|
|
279
|
+
this.logger.error("failed to handle terminal: ".concat(appId), e);
|
|
276
280
|
}
|
|
277
281
|
return FcrReturnCode.SUCCESS;
|
|
278
282
|
}
|
|
279
283
|
_setBoardViewStyle(view) {
|
|
280
|
-
view.style.height =
|
|
281
|
-
view.style.width =
|
|
284
|
+
view.style.height = "100%";
|
|
285
|
+
view.style.width = "100%";
|
|
282
286
|
view.style.backgroundColor = 'rgba(0, 0, 0, 0)';
|
|
283
287
|
}
|
|
284
288
|
_enableAutoCancel(enable) {
|
|
@@ -291,4 +295,9 @@ export class FcrBoardMainWindowImpl {
|
|
|
291
295
|
_addLogObserver() {
|
|
292
296
|
this.addObserver(generateLogObserver(this.logger, [['onWritable', ['isWritable']], ['onPageInfoUpdated', ['info']], ['onUndoStateUpdated', ['enable']], ['onRedoStateUpdated', ['enable']]]));
|
|
293
297
|
}
|
|
294
|
-
}
|
|
298
|
+
}
|
|
299
|
+
_FcrBoardMainWindowImpl = FcrBoardMainWindowImpl;
|
|
300
|
+
var _applyDecs$e = _applyDecs(_FcrBoardMainWindowImpl, [[trace, 2, "addPage"], [trace, 2, "removePage"], [trace, 2, "undo"], [trace, 2, "redo"], [trace, 2, "clean"], [trace, 2, "getSnapshotImage"], [_setBackgroundColorDecs, 2, "setBackgroundColor"], [trace, 2, "getPageInfo"], [trace, 2, "prevPage"], [trace, 2, "nextPage"], [_setToolTypeDecs, 2, "setToolType"], [_setStrokeWidthDecs, 2, "setStrokeWidth"], [_setStrokeColorDecs, 2, "setStrokeColor"], [_setTextColorDecs, 2, "setTextColor"], [_setTextSizeDecs, 2, "setTextSize"], [_insertImageDecs, 2, "insertImage"], [trace, 2, "getContentView"], [_setContainerSizeRatioDecs, 2, "setContainerSizeRatio"], [_setBoardTransparentDecs, 2, "setBoardTransparent"], [_updateWindowSizeDecs, 2, "updateWindowSize"], [_setAutoCancelDrawDecs, 2, "setAutoCancelDraw"], [trace, 2, "getWritable"], [_handleApplicationLaunchDecs, 2, "_handleApplicationLaunch"], [_handleApplicationTerminalDecs, 2, "_handleApplicationTerminal"], [_enableAutoCancelDecs, 2, "_enableAutoCancel"]], []).e;
|
|
301
|
+
var _applyDecs$e2 = _slicedToArray(_applyDecs$e, 1);
|
|
302
|
+
_initProto = _applyDecs$e2[0];
|
|
303
|
+
_applyDecs$e;
|
|
@@ -40,11 +40,11 @@ export const getAnnotationConfigFromRoomProperties = (properties, logger) => {
|
|
|
40
40
|
let width = get(properties, 'widgets.annotation.size.width');
|
|
41
41
|
let height = get(properties, 'widgets.annotation.size.height');
|
|
42
42
|
if (typeof width !== 'number') {
|
|
43
|
-
logger.warn(
|
|
43
|
+
logger.warn("got invalid width for annotation board, width: ".concat(width));
|
|
44
44
|
width = 0;
|
|
45
45
|
}
|
|
46
46
|
if (typeof height !== 'number') {
|
|
47
|
-
logger.warn(
|
|
47
|
+
logger.warn("got invalid height for annotation board, height: ".concat(height));
|
|
48
48
|
height = 0;
|
|
49
49
|
}
|
|
50
50
|
const boardWidthVal = width;
|
|
@@ -52,21 +52,20 @@ export const getAnnotationConfigFromRoomProperties = (properties, logger) => {
|
|
|
52
52
|
let boardWidth = 0;
|
|
53
53
|
let boardHeight = 0;
|
|
54
54
|
if (boardWidthVal !== 0 && boardHeightVal !== 0) {
|
|
55
|
-
(
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
} = resizeToMax(boardWidthVal, boardHeightVal, FCR_ANNOTATION_SCALE_BASE));
|
|
55
|
+
var _resizeToMax = resizeToMax(boardWidthVal, boardHeightVal, FCR_ANNOTATION_SCALE_BASE);
|
|
56
|
+
boardWidth = _resizeToMax.width;
|
|
57
|
+
boardHeight = _resizeToMax.height;
|
|
59
58
|
} else {
|
|
60
|
-
logger.warn(
|
|
59
|
+
logger.warn("got invalid width or height for annotation board, skip resizing, width: ".concat(boardWidthVal, ", height: ").concat(boardHeightVal));
|
|
61
60
|
}
|
|
62
|
-
logger.info(
|
|
61
|
+
logger.info("got board config info, ".concat(jsonstring({
|
|
63
62
|
boardAppId,
|
|
64
63
|
boardId,
|
|
65
64
|
boardToken,
|
|
66
65
|
boardRegion,
|
|
67
66
|
boardWidth,
|
|
68
67
|
boardHeight
|
|
69
|
-
})
|
|
68
|
+
})));
|
|
70
69
|
return {
|
|
71
70
|
size: {
|
|
72
71
|
width: boardWidth,
|
|
@@ -80,7 +79,8 @@ export const getAnnotationConfigFromRoomProperties = (properties, logger) => {
|
|
|
80
79
|
}
|
|
81
80
|
};
|
|
82
81
|
};
|
|
83
|
-
export const resizeToMax = (w, h
|
|
82
|
+
export const resizeToMax = function (w, h) {
|
|
83
|
+
let scaleBase = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : FCR_ANNOTATION_SCALE_BASE;
|
|
84
84
|
const scale = scaleBase / Math.max(w, h);
|
|
85
85
|
return {
|
|
86
86
|
width: Math.round(w * scale),
|
|
@@ -1,5 +1,10 @@
|
|
|
1
|
+
import "core-js/modules/es.symbol.description.js";
|
|
2
|
+
import "core-js/modules/es.error.cause.js";
|
|
1
3
|
import "core-js/modules/es.array.push.js";
|
|
2
4
|
import "core-js/modules/esnext.function.metadata.js";
|
|
5
|
+
import "core-js/modules/esnext.iterator.constructor.js";
|
|
6
|
+
import "core-js/modules/esnext.iterator.filter.js";
|
|
7
|
+
import "core-js/modules/esnext.iterator.for-each.js";
|
|
3
8
|
import "core-js/modules/esnext.map.delete-all.js";
|
|
4
9
|
import "core-js/modules/esnext.map.emplace.js";
|
|
5
10
|
import "core-js/modules/esnext.map.every.js";
|
|
@@ -15,7 +20,13 @@ import "core-js/modules/esnext.map.reduce.js";
|
|
|
15
20
|
import "core-js/modules/esnext.map.some.js";
|
|
16
21
|
import "core-js/modules/esnext.map.update.js";
|
|
17
22
|
import "core-js/modules/esnext.symbol.metadata.js";
|
|
18
|
-
|
|
23
|
+
import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
24
|
+
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
25
|
+
var _FcrWhiteboardControlImpl, _FcrStandaloneWhiteboardControlImpl;
|
|
26
|
+
let _initProto, _setBackgroundColorDecs, _ref, _initProto2;
|
|
27
|
+
import "core-js/modules/web.dom-collections.iterator.js";
|
|
28
|
+
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; }
|
|
29
|
+
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) { _defineProperty(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; }
|
|
19
30
|
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)]; } }; }
|
|
20
31
|
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
|
|
21
32
|
function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
@@ -35,27 +46,25 @@ import { FcrBoardPropertiesState } from '../../whiteboard-control/type';
|
|
|
35
46
|
import { FcrBaseWhiteboardControlImpl } from '../base';
|
|
36
47
|
import { WHITEBOARD_APP_ID } from '../constant';
|
|
37
48
|
import { WHITEBOARD_HEIGHT, WHITEBOARD_WIDTH } from '../utils';
|
|
49
|
+
_ref = (_setBackgroundColorDecs = [trace(['backgroundColor']), validateParams(stringSchema)], "logger");
|
|
38
50
|
export class FcrWhiteboardControlImpl extends FcrBaseWhiteboardControlImpl {
|
|
39
|
-
static {
|
|
40
|
-
[_initProto] = _applyDecs(this, [[trace, 2, "open"], [trace, 2, "close"], [trace, 2, "release"], [trace, 2, "active"], [trace, 2, "inactive"], [_setBackgroundColorDecs, 2, "setBackgroundColor"], [trace, 2, "getBackgroundColor"], [trace, 2, "getActivity"], [trace, 2, "getOwnerId"], [bound, 2, "_onScenePropertiesUpdated"]], [], 0, void 0, FcrBaseWhiteboardControlImpl).e;
|
|
41
|
-
}
|
|
42
|
-
[(_setBackgroundColorDecs = [trace(['backgroundColor']), validateParams(stringSchema)], "logger")] = (_initProto(this), createLogger({
|
|
43
|
-
prefix: 'FcrWhiteboardControlImpl'
|
|
44
|
-
}));
|
|
45
|
-
_backgroundColor = '#ffffff';
|
|
46
|
-
_isActive = false;
|
|
47
|
-
_ownerId = null;
|
|
48
|
-
_preloadLock = false;
|
|
49
|
-
_notifyObservers = {
|
|
50
|
-
onScenePropertiesUpdated: this._onScenePropertiesUpdated
|
|
51
|
-
};
|
|
52
51
|
constructor(rtmClient, config, sharedCache, boardRoomConfigFetcher, _scene, _api) {
|
|
53
52
|
super(rtmClient, config, boardRoomConfigFetcher, _api);
|
|
53
|
+
_defineProperty(this, _ref, (_initProto(this), createLogger({
|
|
54
|
+
prefix: 'FcrWhiteboardControlImpl'
|
|
55
|
+
})));
|
|
56
|
+
_defineProperty(this, "_backgroundColor", '#ffffff');
|
|
57
|
+
_defineProperty(this, "_isActive", false);
|
|
58
|
+
_defineProperty(this, "_ownerId", null);
|
|
59
|
+
_defineProperty(this, "_preloadLock", false);
|
|
60
|
+
_defineProperty(this, "_notifyObservers", {
|
|
61
|
+
onScenePropertiesUpdated: this._onScenePropertiesUpdated
|
|
62
|
+
});
|
|
54
63
|
this._scene = _scene;
|
|
55
64
|
this._api = _api;
|
|
56
65
|
this._roomCache = sharedCache.getRoomCache(config.roomId);
|
|
57
66
|
this._scene.addObserver(this._notifyObservers);
|
|
58
|
-
this.logger.info(
|
|
67
|
+
this.logger.info("Whitebaord Version: forge-whiteboard@".concat(getDependenciesInfo('@netless/forge-whiteboard'), ", forge-room@").concat(getDependenciesInfo('@netless/forge-room'), ", forge-room@").concat(getDependenciesInfo('@netless/forge-rtm')));
|
|
59
68
|
this._isActive = this._scene.getScenePropertiesByKeyPath('widgets.netlessBoard').state === 1;
|
|
60
69
|
const backgroundColor = this._scene.getScenePropertiesByKeyPath('widgets.netlessBoard.extra.backgroundColor');
|
|
61
70
|
if (backgroundColor) {
|
|
@@ -106,10 +115,9 @@ export class FcrWhiteboardControlImpl extends FcrBaseWhiteboardControlImpl {
|
|
|
106
115
|
return handleRequestError(() => this._api.toggleWhiteboardActivityState(this.config.roomId, FcrSharePermissionState.OFF), ErrorModuleCode.FCR_ROOM_WHITEBOARD, 'inactive failed');
|
|
107
116
|
}
|
|
108
117
|
getBoardActiveInfo() {
|
|
109
|
-
const
|
|
110
|
-
state,
|
|
111
|
-
ownerUserUuid
|
|
112
|
-
} = this._scene.getScenePropertiesByKeyPath('widgets.netlessBoard');
|
|
118
|
+
const _ref2 = this._scene.getScenePropertiesByKeyPath('widgets.netlessBoard'),
|
|
119
|
+
state = _ref2.state,
|
|
120
|
+
ownerUserId = _ref2.ownerUserUuid;
|
|
113
121
|
if (state === FcrBoardPropertiesState.ACTIVE) {
|
|
114
122
|
return {
|
|
115
123
|
isActive: true,
|
|
@@ -149,11 +157,12 @@ export class FcrWhiteboardControlImpl extends FcrBaseWhiteboardControlImpl {
|
|
|
149
157
|
const operatorUser = convertRteUserToFcrUser(event.operatorUser, this._roomCache);
|
|
150
158
|
const getByKeyPath = value => this._scene.getScenePropertiesByKeyPath(value);
|
|
151
159
|
if (event.cause && event.cause.cmd === 10) {
|
|
160
|
+
var _getByKeyPath;
|
|
152
161
|
const causeData = event.cause.data;
|
|
153
|
-
if (causeData
|
|
162
|
+
if (causeData !== null && causeData !== void 0 && causeData.widgetUuid && causeData.widgetUuid !== 'netlessBoard') {
|
|
154
163
|
return;
|
|
155
164
|
}
|
|
156
|
-
const state = getByKeyPath('widgets.netlessBoard.state')
|
|
165
|
+
const state = (_getByKeyPath = getByKeyPath('widgets.netlessBoard.state')) !== null && _getByKeyPath !== void 0 ? _getByKeyPath : FcrBoardPropertiesState.INACTIVE;
|
|
157
166
|
const backgroundColor = getByKeyPath('widgets.netlessBoard.extra.backgroundColor');
|
|
158
167
|
const widgetCauseReason = get(event.cause.data, 'widgetCause.data.reason');
|
|
159
168
|
const widgetCauseCmd = get(event.cause.data, 'widgetCause.cmd');
|
|
@@ -181,22 +190,21 @@ export class FcrWhiteboardControlImpl extends FcrBaseWhiteboardControlImpl {
|
|
|
181
190
|
}
|
|
182
191
|
}
|
|
183
192
|
getWhiteboardOption() {
|
|
184
|
-
return {
|
|
185
|
-
...super.getWhiteboardOption(),
|
|
193
|
+
return _objectSpread(_objectSpread({}, super.getWhiteboardOption()), {}, {
|
|
186
194
|
width: WHITEBOARD_WIDTH,
|
|
187
195
|
height: WHITEBOARD_HEIGHT
|
|
188
|
-
};
|
|
196
|
+
});
|
|
189
197
|
}
|
|
190
198
|
addLogObserver() {
|
|
191
199
|
this.addObserver(generateLogObserver(this.logger, [['onConnectionStateUpdated', ['state']], ['onActive', ['ownerId', 'operatorUser']], ['onInactive', ['reason', 'operatorUser']], ['onBackgroundColorUpdated', ['color', 'operatorUser']]]));
|
|
192
200
|
}
|
|
193
201
|
}
|
|
202
|
+
_FcrWhiteboardControlImpl = FcrWhiteboardControlImpl;
|
|
203
|
+
var _applyDecs$e = _slicedToArray(_applyDecs(_FcrWhiteboardControlImpl, [[trace, 2, "open"], [trace, 2, "close"], [trace, 2, "release"], [trace, 2, "active"], [trace, 2, "inactive"], [_setBackgroundColorDecs, 2, "setBackgroundColor"], [trace, 2, "getBackgroundColor"], [trace, 2, "getActivity"], [trace, 2, "getOwnerId"], [bound, 2, "_onScenePropertiesUpdated"]], [], 0, void 0, FcrBaseWhiteboardControlImpl).e, 1);
|
|
204
|
+
_initProto = _applyDecs$e[0];
|
|
194
205
|
export class FcrStandaloneWhiteboardControlImpl extends FcrBaseWhiteboardControlImpl {
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
}
|
|
198
|
-
constructor(...args) {
|
|
199
|
-
super(...args);
|
|
206
|
+
constructor() {
|
|
207
|
+
super(...arguments);
|
|
200
208
|
_initProto2(this);
|
|
201
209
|
}
|
|
202
210
|
async open() {
|
|
@@ -209,10 +217,14 @@ export class FcrStandaloneWhiteboardControlImpl extends FcrBaseWhiteboardControl
|
|
|
209
217
|
return WHITEBOARD_APP_ID;
|
|
210
218
|
}
|
|
211
219
|
getWhiteboardOption() {
|
|
212
|
-
return {
|
|
213
|
-
...super.getWhiteboardOption(),
|
|
220
|
+
return _objectSpread(_objectSpread({}, super.getWhiteboardOption()), {}, {
|
|
214
221
|
width: WHITEBOARD_WIDTH,
|
|
215
222
|
height: WHITEBOARD_HEIGHT
|
|
216
|
-
};
|
|
223
|
+
});
|
|
217
224
|
}
|
|
218
|
-
}
|
|
225
|
+
}
|
|
226
|
+
_FcrStandaloneWhiteboardControlImpl = FcrStandaloneWhiteboardControlImpl;
|
|
227
|
+
var _applyDecs$e2 = _applyDecs(_FcrStandaloneWhiteboardControlImpl, [[trace, 2, "open"], [trace, 2, "release"]], [], 0, void 0, FcrBaseWhiteboardControlImpl).e;
|
|
228
|
+
var _applyDecs$e3 = _slicedToArray(_applyDecs$e2, 1);
|
|
229
|
+
_initProto2 = _applyDecs$e3[0];
|
|
230
|
+
_applyDecs$e2;
|