fcr-core 3.7.9-alpha → 3.8.0-alpha
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/chat-connection/index.d.ts +1 -1
- package/lib/chat-connection/index.js +41 -26
- package/lib/engine/index.js +72 -78
- package/lib/imports.d.ts +7 -2
- package/lib/imports.js +26 -4
- package/lib/index.d.ts +2 -2
- package/lib/index.js +12 -0
- package/lib/media-control/desktop.js +22 -17
- package/lib/media-control/mobile.js +38 -33
- package/lib/media-control/type.d.ts +8 -0
- package/lib/monitor-control/index.js +10 -5
- package/lib/peer-session/index.js +48 -39
- package/lib/plugins/chatroom.js +237 -205
- package/lib/room-control/ability-control/index.js +14 -9
- package/lib/room-control/ability-control/type.d.ts +4 -1
- package/lib/room-control/ability-control/type.js +3 -0
- package/lib/room-control/group-control/index.js +21 -16
- package/lib/room-control/helpers/constants.d.ts +4 -0
- package/lib/room-control/helpers/constants.js +5 -1
- package/lib/room-control/helpers/validation-helper.js +1 -1
- package/lib/room-control/index.js +66 -38
- package/lib/room-control/interpreter-control/index.js +49 -38
- package/lib/room-control/interpreter-control/room.js +6 -4
- package/lib/room-control/join-before-host-waitingroom-control/index.js +6 -4
- package/lib/room-control/mainroom-control/index.js +90 -17
- package/lib/room-control/privilege-control/helper.js +8 -5
- package/lib/room-control/privilege-control/index.js +66 -19
- package/lib/room-control/privilege-control/type.d.ts +57 -10
- package/lib/room-control/privilege-control/type.js +17 -0
- package/lib/room-control/room-connector-control/index.js +28 -19
- package/lib/room-control/room-control-factory.js +3 -2
- package/lib/room-control/room-session/index.js +68 -49
- package/lib/room-control/room-session/type.d.ts +2 -2
- package/lib/room-control/shared-cache.js +36 -29
- package/lib/room-control/sharing-control/index.d.ts +5 -5
- package/lib/room-control/sharing-control/index.js +81 -43
- package/lib/room-control/sharing-control/type.d.ts +9 -5
- package/lib/room-control/sharing-control/type.js +6 -1
- package/lib/room-control/stream-control/index.d.ts +8 -1
- package/lib/room-control/stream-control/index.js +310 -199
- package/lib/room-control/stream-control/type.d.ts +6 -0
- package/lib/room-control/stt-control/de-compress-gzip.d.ts +1 -0
- package/lib/room-control/stt-control/de-compress-gzip.js +49 -0
- package/lib/room-control/stt-control/index.d.ts +1 -0
- package/lib/room-control/stt-control/index.js +353 -0
- package/lib/room-control/stt-control/type.d.ts +142 -0
- package/lib/room-control/stt-control/type.js +16 -0
- package/lib/room-control/type.d.ts +15 -0
- package/lib/room-control/type.js +13 -1
- package/lib/room-control/user-control/index.js +143 -136
- package/lib/room-control/waitingroom-control/index.js +14 -9
- package/lib/room-control/whiteboard-control/enum.d.ts +15 -0
- package/lib/room-control/whiteboard-control/{types.js → enum.js} +12 -1
- package/lib/room-control/whiteboard-control/type.d.ts +38 -0
- package/lib/room-control/whiteboard-control/type.js +15 -0
- package/lib/room-control/whiteboard-control/utils.d.ts +3 -0
- package/lib/room-control/whiteboard-control/utils.js +23 -0
- package/lib/room-control/whiteboard-control-v1/board-subwindow.d.ts +6 -0
- package/lib/room-control/whiteboard-control-v1/board-subwindow.js +26 -0
- package/lib/room-control/whiteboard-control-v1/board-window.d.ts +58 -0
- package/lib/room-control/whiteboard-control-v1/board-window.js +571 -0
- package/lib/room-control/{whiteboard-control/enums.d.ts → whiteboard-control-v1/enum.d.ts} +3 -17
- package/lib/room-control/{whiteboard-control/enums.js → whiteboard-control-v1/enum.js} +3 -20
- package/lib/room-control/whiteboard-control-v1/factory.d.ts +9 -0
- package/lib/room-control/whiteboard-control-v1/factory.js +22 -0
- package/lib/room-control/whiteboard-control-v1/index.d.ts +1 -0
- package/lib/room-control/whiteboard-control-v1/index.js +440 -0
- package/lib/room-control/whiteboard-control-v1/mount-manager.d.ts +4 -0
- package/lib/room-control/whiteboard-control-v1/mount-manager.js +15 -0
- package/lib/room-control/whiteboard-control-v1/type.d.ts +300 -0
- package/lib/room-control/whiteboard-control-v1/type.js +13 -0
- package/lib/room-control/whiteboard-control-v1/utils.d.ts +53 -0
- package/lib/room-control/whiteboard-control-v1/utils.js +290 -0
- package/lib/room-control/whiteboard-control-v2/annotation-control/control.d.ts +17 -31
- package/lib/room-control/whiteboard-control-v2/annotation-control/control.js +42 -228
- package/lib/room-control/whiteboard-control-v2/annotation-control/factory.d.ts +10 -0
- package/lib/room-control/whiteboard-control-v2/annotation-control/factory.js +48 -0
- package/lib/room-control/whiteboard-control-v2/annotation-control/type.d.ts +11 -19
- package/lib/room-control/whiteboard-control-v2/annotation-control/type.js +1 -3
- package/lib/room-control/whiteboard-control-v2/base/index.d.ts +42 -0
- package/lib/room-control/whiteboard-control-v2/base/index.js +317 -0
- package/lib/room-control/whiteboard-control-v2/{main-window.d.ts → base/main-window.d.ts} +6 -4
- package/lib/room-control/whiteboard-control-v2/{main-window.js → base/main-window.js} +54 -36
- package/lib/room-control/whiteboard-control-v2/constant.d.ts +6 -0
- package/lib/room-control/whiteboard-control-v2/constant.js +15 -0
- package/lib/room-control/whiteboard-control-v2/enum.d.ts +26 -0
- package/lib/room-control/whiteboard-control-v2/enum.js +34 -0
- package/lib/room-control/{whiteboard-control/types.d.ts → whiteboard-control-v2/type.d.ts} +51 -165
- package/lib/room-control/whiteboard-control-v2/type.js +5 -0
- package/lib/room-control/whiteboard-control-v2/utils.d.ts +5 -4
- package/lib/room-control/whiteboard-control-v2/utils.js +29 -27
- package/lib/room-control/whiteboard-control-v2/whiteboard-control/control.d.ts +34 -33
- package/lib/room-control/whiteboard-control-v2/whiteboard-control/control.js +131 -187
- package/lib/room-control/whiteboard-control-v2/whiteboard-control/factory.d.ts +11 -0
- package/lib/room-control/whiteboard-control-v2/{annotation-control/index.js → whiteboard-control/factory.js} +40 -38
- package/lib/room-control/whiteboard-control-v2/whiteboard-control/type.d.ts +18 -30
- package/lib/room-control/whiteboard-control-v2/whiteboard-control/type.js +1 -9
- package/lib/room-router/index.js +56 -42
- package/lib/schema.d.ts +23 -9
- package/lib/schema.js +10 -4
- package/lib/service/api.d.ts +75 -19
- package/lib/service/api.js +401 -208
- package/lib/type.d.ts +15 -2
- package/lib/type.js +13 -0
- package/lib/utilities/collection.js +3 -2
- package/lib/utilities/error-helpers.d.ts +2 -1
- package/lib/utilities/error-helpers.js +35 -27
- package/lib/utilities/error.d.ts +1 -0
- package/lib/utilities/error.js +10 -8
- package/lib/utilities/join-helper.js +32 -25
- package/lib/utilities/logger.d.ts +2 -2
- package/lib/utilities/logger.js +6 -3
- package/lib/utilities/parameters.js +8 -4
- package/lib/utilities/retry-helpers.js +1 -0
- package/lib/utilities/shared-storage.d.ts +3 -1
- package/lib/utilities/shared-storage.js +10 -1
- package/lib/utilities/storage.js +1 -0
- package/lib/utilities/stream.js +16 -11
- package/lib/utilities/user.js +4 -3
- package/lib/utilities/validate-params.js +2 -1
- package/package.json +11 -5
- package/lib/room-control/whiteboard-control-v2/annotation-control/index.d.ts +0 -19
- package/lib/room-control/whiteboard-control-v2/annotation-control/privilege-control.d.ts +0 -36
- package/lib/room-control/whiteboard-control-v2/annotation-control/privilege-control.js +0 -252
- package/lib/room-control/whiteboard-control-v2/index.d.ts +0 -38
- package/lib/room-control/whiteboard-control-v2/index.js +0 -274
- package/lib/room-control/whiteboard-control-v2/whiteboard-control/index.d.ts +0 -17
- package/lib/room-control/whiteboard-control-v2/whiteboard-control/index.js +0 -30
- package/lib/room-control/whiteboard-control-v2/whiteboard-control/privilege-control.d.ts +0 -36
- package/lib/room-control/whiteboard-control-v2/whiteboard-control/privilege-control.js +0 -240
|
@@ -1,7 +1,12 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
+
require("core-js/modules/es.symbol.description.js");
|
|
4
|
+
require("core-js/modules/es.error.cause.js");
|
|
3
5
|
require("core-js/modules/es.array.push.js");
|
|
4
6
|
require("core-js/modules/esnext.function.metadata.js");
|
|
7
|
+
require("core-js/modules/esnext.iterator.constructor.js");
|
|
8
|
+
require("core-js/modules/esnext.iterator.filter.js");
|
|
9
|
+
require("core-js/modules/esnext.iterator.for-each.js");
|
|
5
10
|
require("core-js/modules/esnext.map.delete-all.js");
|
|
6
11
|
require("core-js/modules/esnext.map.emplace.js");
|
|
7
12
|
require("core-js/modules/esnext.map.every.js");
|
|
@@ -17,217 +22,156 @@ require("core-js/modules/esnext.map.reduce.js");
|
|
|
17
22
|
require("core-js/modules/esnext.map.some.js");
|
|
18
23
|
require("core-js/modules/esnext.map.update.js");
|
|
19
24
|
require("core-js/modules/esnext.symbol.metadata.js");
|
|
25
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
20
26
|
Object.defineProperty(exports, "__esModule", {
|
|
21
27
|
value: true
|
|
22
28
|
});
|
|
23
|
-
exports.FcrWhiteboardControlImpl = void 0;
|
|
24
|
-
|
|
25
|
-
var
|
|
26
|
-
var
|
|
27
|
-
var
|
|
28
|
-
var _forgeRtm = require("@netless/forge-rtm");
|
|
29
|
-
var _forgeRoom = require("@netless/forge-room");
|
|
30
|
-
var _forgeWhiteboard = require("@netless/forge-whiteboard");
|
|
31
|
-
var _mainWindow = require("../main-window");
|
|
29
|
+
exports.FcrWhiteboardControlImpl = exports.FcrStandaloneWhiteboardControlImpl = void 0;
|
|
30
|
+
require("core-js/modules/web.dom-collections.iterator.js");
|
|
31
|
+
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
32
|
+
var _imports = require("../../../imports");
|
|
33
|
+
var _user = require("../../../utilities/user");
|
|
32
34
|
var _error = require("../../../utilities/error");
|
|
35
|
+
var _schema = require("../../../schema");
|
|
36
|
+
var _packageInfo = require("../../../utilities/package-info");
|
|
37
|
+
var _validateParams = _interopRequireDefault(require("../../../utilities/validate-params"));
|
|
38
|
+
var _base = require("../base");
|
|
39
|
+
var _constant = require("../constant");
|
|
40
|
+
var _type = require("../../whiteboard-control/type");
|
|
41
|
+
var _type2 = require("../../sharing-control/type");
|
|
33
42
|
var _logger = require("../../../utilities/logger");
|
|
34
|
-
|
|
43
|
+
var _utils = require("../utils");
|
|
44
|
+
var _ref, _FcrWhiteboardControlImpl;
|
|
45
|
+
let _initProto, _setBackgroundColorDecs, _ref2;
|
|
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; }
|
|
35
48
|
function _applyDecs(e, t, r, n, o, a) { function i(e, t, r) { return function (n, o) { return r && r(n), e[t].call(n, o); }; } function c(e, t) { for (var r = 0; r < e.length; r++) e[r].call(t); return t; } function s(e, t, r, n) { if ("function" != typeof e && (n || void 0 !== e)) throw new TypeError(t + " must " + (r || "be") + " a function" + (n ? "" : " or undefined")); return e; } function applyDec(e, t, r, n, o, a, c, u, l, f, p, d, h) { function m(e) { if (!h(e)) throw new TypeError("Attempted to access private element on non-instance"); } var y, v = t[0], g = t[3], b = !u; if (!b) { r || Array.isArray(v) || (v = [v]); var w = {}, S = [], A = 3 === o ? "get" : 4 === o || d ? "set" : "value"; f ? (p || d ? w = { get: _setFunctionName(function () { return g(this); }, n, "get"), set: function (e) { t[4](this, e); } } : w[A] = g, p || _setFunctionName(w[A], n, 2 === o ? "" : A)) : p || (w = Object.getOwnPropertyDescriptor(e, n)); } for (var P = e, j = v.length - 1; j >= 0; j -= r ? 2 : 1) { var D = v[j], E = r ? v[j - 1] : void 0, I = {}, O = { kind: ["field", "accessor", "method", "getter", "setter", "class"][o], name: n, metadata: a, addInitializer: function (e, t) { if (e.v) throw Error("attempted to call addInitializer after decoration was finished"); s(t, "An initializer", "be", !0), c.push(t); }.bind(null, I) }; try { if (b) (y = s(D.call(E, P, O), "class decorators", "return")) && (P = y);else { var k, F; O.static = l, O.private = f, f ? 2 === o ? k = function (e) { return m(e), w.value; } : (o < 4 && (k = i(w, "get", m)), 3 !== o && (F = i(w, "set", m))) : (k = function (e) { return e[n]; }, (o < 2 || 4 === o) && (F = function (e, t) { e[n] = t; })); var N = O.access = { has: f ? h.bind() : function (e) { return n in e; } }; if (k && (N.get = k), F && (N.set = F), P = D.call(E, d ? { get: w.get, set: w.set } : w[A], O), d) { if ("object" == typeof P && P) (y = s(P.get, "accessor.get")) && (w.get = y), (y = s(P.set, "accessor.set")) && (w.set = y), (y = s(P.init, "accessor.init")) && S.push(y);else if (void 0 !== P) throw new TypeError("accessor decorators must return an object with get, set, or init properties or void 0"); } else s(P, (p ? "field" : "method") + " decorators", "return") && (p ? S.push(P) : w[A] = P); } } finally { I.v = !0; } } return (p || d) && u.push(function (e, t) { for (var r = S.length - 1; r >= 0; r--) t = S[r].call(e, t); return t; }), p || b || (f ? d ? u.push(i(w, "get"), i(w, "set")) : u.push(2 === o ? w[A] : i.call.bind(w[A])) : Object.defineProperty(e, n, w)), P; } function u(e, t) { return Object.defineProperty(e, Symbol.metadata || Symbol.for("Symbol.metadata"), { configurable: !0, enumerable: !0, value: t }); } if (arguments.length >= 6) var l = a[Symbol.metadata || Symbol.for("Symbol.metadata")]; var f = Object.create(null == l ? null : l), p = function (e, t, r, n) { var o, a, i = [], s = function (t) { return _checkInRHS(t) === e; }, u = new Map(); function l(e) { e && i.push(c.bind(null, e)); } for (var f = 0; f < t.length; f++) { var p = t[f]; if (Array.isArray(p)) { var d = p[1], h = p[2], m = p.length > 3, y = 16 & d, v = !!(8 & d), g = 0 == (d &= 7), b = h + "/" + v; if (!g && !m) { var w = u.get(b); if (!0 === w || 3 === w && 4 !== d || 4 === w && 3 !== d) throw Error("Attempted to decorate a public method/accessor that has the same name as a previously decorated public method/accessor. This is not currently supported by the decorators plugin. Property name was: " + h); u.set(b, !(d > 2) || d); } applyDec(v ? e : e.prototype, p, y, m ? "#" + h : _toPropertyKey(h), d, n, v ? a = a || [] : o = o || [], i, v, m, g, 1 === d, v && m ? s : r); } } return l(o), l(a), i; }(e, t, o, f); return r.length || u(e, f), { e: p, get c() { var t = []; return r.length && [u(applyDec(e, [r], n, e.name, 5, f, t), f), c.bind(null, t, e)]; } }; }
|
|
36
49
|
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
|
|
37
50
|
function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
38
51
|
function _setFunctionName(e, t, n) { "symbol" == typeof t && (t = (t = t.description) ? "[" + t + "]" : ""); try { Object.defineProperty(e, "name", { configurable: !0, value: n ? n + " " + t : t }); } catch (e) {} return e; }
|
|
39
52
|
function _checkInRHS(e) { if (Object(e) !== e) throw TypeError("right-hand side of 'in' should be an object, got " + (null !== e ? typeof e : "null")); return e; }
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
this.
|
|
54
|
-
|
|
55
|
-
this.
|
|
56
|
-
this.
|
|
53
|
+
_ref2 = (_setBackgroundColorDecs = [_imports.trace, (0, _validateParams.default)(_schema.stringSchema)], "logger");
|
|
54
|
+
class FcrWhiteboardControlImpl extends (_ref = _base.FcrBaseWhiteboardControlImpl) {
|
|
55
|
+
constructor(rtmClient, config, hasOperationPrivilege, sharedCache, forgeInitConfigFetcher, _scene, _api) {
|
|
56
|
+
super(rtmClient, config, hasOperationPrivilege, forgeInitConfigFetcher);
|
|
57
|
+
(0, _defineProperty2.default)(this, _ref2, (_initProto(this), (0, _logger.createLogger)({
|
|
58
|
+
prefix: 'FcrWhiteboardControlImpl'
|
|
59
|
+
})));
|
|
60
|
+
(0, _defineProperty2.default)(this, "_backgroundColor", '#ffffff');
|
|
61
|
+
(0, _defineProperty2.default)(this, "_isActive", false);
|
|
62
|
+
(0, _defineProperty2.default)(this, "_ownerId", null);
|
|
63
|
+
(0, _defineProperty2.default)(this, "_notifyObservers", {
|
|
64
|
+
onScenePropertiesUpdated: this._onScenePropertiesUpdated
|
|
65
|
+
});
|
|
66
|
+
this._scene = _scene;
|
|
67
|
+
this._api = _api;
|
|
68
|
+
this._roomCache = sharedCache.getRoomCache(config.roomId);
|
|
69
|
+
this._scene.addObserver(this._notifyObservers);
|
|
70
|
+
this.logger.info("Whitebaord Version: forge-whiteboard@".concat((0, _packageInfo.getDependenciesInfo)('@netless/forge-whiteboard'), ", forge-room@").concat((0, _packageInfo.getDependenciesInfo)('@netless/forge-room'), ", forge-room@").concat((0, _packageInfo.getDependenciesInfo)('@netless/forge-rtm')));
|
|
71
|
+
this._isActive = this._scene.getScenePropertiesByKeyPath('widgets.netlessBoard').state === 1;
|
|
72
|
+
const backgroundColor = this._scene.getScenePropertiesByKeyPath('widgets.netlessBoard.extra.backgroundColor');
|
|
73
|
+
if (backgroundColor) {
|
|
74
|
+
this._backgroundColor = backgroundColor;
|
|
75
|
+
}
|
|
76
|
+
const ownerId = this._scene.getScenePropertiesByKeyPath('widgets.netlessBoard.ownerUserUuid');
|
|
77
|
+
if (ownerId) {
|
|
78
|
+
this._ownerId = ownerId;
|
|
79
|
+
}
|
|
80
|
+
this.logger.info("initialized, hasOperationPrivilege: ".concat(hasOperationPrivilege));
|
|
57
81
|
}
|
|
58
|
-
async
|
|
59
|
-
this.
|
|
60
|
-
this._boardConfig = config;
|
|
61
|
-
return await this._connect();
|
|
82
|
+
async active() {
|
|
83
|
+
return (0, _error.handleRequestError)(() => this._api.toggleWhiteboardActivityState(this.config.roomId, _type2.FcrSharePermissionState.ON), _error.FcrErrorModuleCode.ROOM_WHITEBOARD, 'active failed');
|
|
62
84
|
}
|
|
63
|
-
async
|
|
64
|
-
return
|
|
85
|
+
async inactive() {
|
|
86
|
+
return (0, _error.handleRequestError)(() => this._api.toggleWhiteboardActivityState(this.config.roomId, _type2.FcrSharePermissionState.OFF), _error.FcrErrorModuleCode.ROOM_WHITEBOARD, 'inactive failed');
|
|
65
87
|
}
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
}
|
|
82
|
-
} catch (error) {
|
|
83
|
-
this.logger.error('close board failed', error);
|
|
88
|
+
getBoardActiveInfo() {
|
|
89
|
+
const {
|
|
90
|
+
state,
|
|
91
|
+
ownerUserUuid: ownerUserId
|
|
92
|
+
} = this._scene.getScenePropertiesByKeyPath('widgets.netlessBoard');
|
|
93
|
+
if (state === _type.FcrBoardPropertiesState.ACTIVE) {
|
|
94
|
+
return {
|
|
95
|
+
isActive: true,
|
|
96
|
+
ownerUserId
|
|
97
|
+
};
|
|
98
|
+
} else {
|
|
99
|
+
return {
|
|
100
|
+
isActive: false,
|
|
101
|
+
ownerUserId: null
|
|
102
|
+
};
|
|
84
103
|
}
|
|
85
104
|
}
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
105
|
+
async setBackgroundColor(backgroundColor) {
|
|
106
|
+
await this._api.setBackgroundColor({
|
|
107
|
+
roomId: this.config.roomId,
|
|
108
|
+
backgroundColor
|
|
109
|
+
});
|
|
110
|
+
this._backgroundColor = backgroundColor;
|
|
111
|
+
if (this.boardView) {
|
|
112
|
+
this.boardView.setBackgroundColor(backgroundColor);
|
|
113
|
+
}
|
|
91
114
|
}
|
|
92
|
-
|
|
93
|
-
this.
|
|
115
|
+
getBackgroundColor() {
|
|
116
|
+
return this._backgroundColor;
|
|
94
117
|
}
|
|
95
|
-
|
|
96
|
-
this.
|
|
118
|
+
getActivity() {
|
|
119
|
+
return this._isActive;
|
|
97
120
|
}
|
|
98
|
-
|
|
99
|
-
this.
|
|
100
|
-
this.boardRoom?.leaveRoom();
|
|
101
|
-
this.boardRoom = undefined;
|
|
102
|
-
this._boardView = undefined;
|
|
103
|
-
this.whiteboard = undefined;
|
|
121
|
+
getOwnerId() {
|
|
122
|
+
return this._ownerId;
|
|
104
123
|
}
|
|
105
|
-
|
|
106
|
-
|
|
124
|
+
getApplicationId() {
|
|
125
|
+
return _constant.WHITEBOARD_APP_ID;
|
|
107
126
|
}
|
|
108
|
-
|
|
109
|
-
this.
|
|
127
|
+
_onScenePropertiesUpdated(sceneId, event) {
|
|
128
|
+
const operatorUser = (0, _user.convertRteUserToFcrUser)(event.operatorUser, this._roomCache);
|
|
129
|
+
const getByKeyPath = value => this._scene.getScenePropertiesByKeyPath(value);
|
|
130
|
+
if (event.cause && event.cause.cmd === 10) {
|
|
131
|
+
var _getByKeyPath;
|
|
132
|
+
const state = (_getByKeyPath = getByKeyPath('widgets.netlessBoard.state')) !== null && _getByKeyPath !== void 0 ? _getByKeyPath : _type.FcrBoardPropertiesState.INACTIVE;
|
|
133
|
+
const backgroundColor = getByKeyPath('widgets.netlessBoard.extra.backgroundColor');
|
|
134
|
+
const widgetCauseReason = (0, _imports.get)(event.cause.data, 'widgetCause.data.reason');
|
|
135
|
+
const widgetCauseCmd = (0, _imports.get)(event.cause.data, 'widgetCause.cmd');
|
|
136
|
+
if (state === _type.FcrBoardPropertiesState.ACTIVE) {
|
|
137
|
+
const ownerUserId = getByKeyPath('widgets.netlessBoard.ownerUserUuid');
|
|
138
|
+
this._ownerId = ownerUserId;
|
|
139
|
+
this._isActive = true;
|
|
140
|
+
this.observable.notifyObservers('onActive', ownerUserId, operatorUser);
|
|
141
|
+
}
|
|
142
|
+
if (state === _type.FcrBoardPropertiesState.INACTIVE) {
|
|
143
|
+
this._ownerId = null;
|
|
144
|
+
this._isActive = false;
|
|
145
|
+
this.observable.notifyObservers('onInactive', widgetCauseReason, operatorUser);
|
|
146
|
+
}
|
|
147
|
+
if (widgetCauseCmd === _type.FcrBoardPropertiesState.BACKGROUND_COLOR_UPDATED) {
|
|
148
|
+
this._backgroundColor = backgroundColor;
|
|
149
|
+
this.observable.notifyObservers('onBackgroundColorUpdated', backgroundColor, operatorUser);
|
|
150
|
+
}
|
|
151
|
+
}
|
|
110
152
|
}
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
153
|
+
getWhiteboardOption() {
|
|
154
|
+
return _objectSpread(_objectSpread({}, super.getWhiteboardOption()), {}, {
|
|
155
|
+
width: _utils.WHITEBOARD_WIDTH,
|
|
156
|
+
height: _utils.WHITEBOARD_HEIGHT
|
|
157
|
+
});
|
|
115
158
|
}
|
|
116
|
-
|
|
159
|
+
addLogObserver() {
|
|
117
160
|
this.addObserver((0, _logger.generateLogObserver)(this.logger, ['onConnectionStateUpdated', 'onActive', 'onInactive', 'onBackgroundColorUpdated']));
|
|
118
161
|
}
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
const {
|
|
132
|
-
userId,
|
|
133
|
-
nickName
|
|
134
|
-
} = this._config;
|
|
135
|
-
const width = 1920;
|
|
136
|
-
const height = 1080;
|
|
137
|
-
const {
|
|
138
|
-
boardAppId: appIdentifier,
|
|
139
|
-
boardId,
|
|
140
|
-
boardRegion: region,
|
|
141
|
-
boardToken: roomToken
|
|
142
|
-
} = this._boardConfig || {};
|
|
143
|
-
if (!appIdentifier) {
|
|
144
|
-
throw (0, _error.generateFcrCoreClientError)(_error.FcrErrorModuleCode.ROOM_WHITEBOARD, _error.FcrErrorCode.UNDEFINED_ERROR, 'board boardAppId is required', new Error('board boardAppId is required'));
|
|
145
|
-
}
|
|
146
|
-
if (!region) {
|
|
147
|
-
throw (0, _error.generateFcrCoreClientError)(_error.FcrErrorModuleCode.ROOM_WHITEBOARD, _error.FcrErrorCode.UNDEFINED_ERROR, 'board region is required', new Error('board region is required'));
|
|
148
|
-
}
|
|
149
|
-
if (!boardId) {
|
|
150
|
-
throw (0, _error.generateFcrCoreClientError)(_error.FcrErrorModuleCode.ROOM_WHITEBOARD, _error.FcrErrorCode.UNDEFINED_ERROR, 'boardId is required', new Error('boardId is required'));
|
|
151
|
-
}
|
|
152
|
-
if (!roomToken) {
|
|
153
|
-
throw (0, _error.generateFcrCoreClientError)(_error.FcrErrorModuleCode.ROOM_WHITEBOARD, _error.FcrErrorCode.UNDEFINED_ERROR, 'boardToken is required', new Error('boardToken is required'));
|
|
154
|
-
}
|
|
155
|
-
this.logger.info(`open annotation with boardId: ${boardId}, boardToken: ${roomToken}, region: ${region}`);
|
|
156
|
-
|
|
157
|
-
// @ts-ignore
|
|
158
|
-
const rtmProvider = new _forgeRtm.RTMProvider_2_2(this._rtmClient);
|
|
159
|
-
const wbRoom = new _forgeRoom.Room(boardId, rtmProvider);
|
|
160
|
-
wbRoom.applicationManager.registerApplication(_forgeWhiteboard.WhiteboardApplication);
|
|
161
|
-
try {
|
|
162
|
-
this.updateConnnectionState(_.FcrConnectionState.CONNECTING);
|
|
163
|
-
const retriesMax = 10;
|
|
164
|
-
let error = null;
|
|
165
|
-
let boardView = null;
|
|
166
|
-
let whiteboard = null;
|
|
167
|
-
let boardRoom = wbRoom;
|
|
168
|
-
[error] = await (0, _imports.to)((0, _imports.retryAttempt)(async () => {
|
|
169
|
-
const joinRoomParams = {
|
|
170
|
-
userId,
|
|
171
|
-
nickName,
|
|
172
|
-
roomToken,
|
|
173
|
-
sdkConfig: {
|
|
174
|
-
// @ts-ignore
|
|
175
|
-
region,
|
|
176
|
-
appIdentifier
|
|
177
|
-
// enableIFramePlugin: false,
|
|
178
|
-
// useMultiViews: true,
|
|
179
|
-
}
|
|
180
|
-
};
|
|
181
|
-
this.logger.info(`join params: ${(0, _imports.jsonstring)(joinRoomParams)}`);
|
|
182
|
-
await wbRoom.joinRoom(joinRoomParams);
|
|
183
|
-
boardRoom = wbRoom;
|
|
184
|
-
whiteboard = await wbRoom.applicationManager.launchApplication(_forgeWhiteboard.WhiteboardApplication, {
|
|
185
|
-
width,
|
|
186
|
-
height,
|
|
187
|
-
defaultToolbarStyle: {
|
|
188
|
-
tool: 'laser'
|
|
189
|
-
},
|
|
190
|
-
maxScaleRatio: 1
|
|
191
|
-
}, _type.WHITEBOARD_APP_ID);
|
|
192
|
-
}, [], {
|
|
193
|
-
retriesMax
|
|
194
|
-
}).fail(async ({
|
|
195
|
-
error,
|
|
196
|
-
timeFn,
|
|
197
|
-
currentRetry
|
|
198
|
-
}) => {
|
|
199
|
-
if (abortController.signal.aborted) {
|
|
200
|
-
throw new Error('join board aborted');
|
|
201
|
-
}
|
|
202
|
-
this.logger.info(`failed to join board, error: ${error.message}, current retry: ${currentRetry}`);
|
|
203
|
-
await timeFn();
|
|
204
|
-
return true;
|
|
205
|
-
}).exec());
|
|
206
|
-
if (abortController.signal.aborted) {
|
|
207
|
-
throw new Error('join board aborted');
|
|
208
|
-
}
|
|
209
|
-
if (error) {
|
|
210
|
-
this.logger.error(`join board failed, ${error.message}-${JSON.stringify(error)}`);
|
|
211
|
-
throw error;
|
|
212
|
-
}
|
|
213
|
-
whiteboard.enableCameraByMouse = false;
|
|
214
|
-
whiteboard.enableCameraByTouch = false;
|
|
215
|
-
whiteboard.setViewModeToMain();
|
|
216
|
-
boardView = new _mainWindow.FcrBoardMainWindowImpl(whiteboard, wbRoom);
|
|
217
|
-
boardView.setBackgroundColor('rgba(255, 255, 255, 1)');
|
|
218
|
-
this.whiteboard = whiteboard;
|
|
219
|
-
this._boardView = boardView;
|
|
220
|
-
this.boardRoom = boardRoom;
|
|
221
|
-
this.updateConnnectionState(_.FcrConnectionState.CONNECTED);
|
|
222
|
-
resolve(boardView);
|
|
223
|
-
} catch (e) {
|
|
224
|
-
this.logger.error(`join board failed`);
|
|
225
|
-
this.updateConnnectionState(_.FcrConnectionState.DISCONNECTED);
|
|
226
|
-
reject(e);
|
|
227
|
-
} finally {
|
|
228
|
-
this._openAbortController = null;
|
|
229
|
-
}
|
|
162
|
+
}
|
|
163
|
+
exports.FcrWhiteboardControlImpl = FcrWhiteboardControlImpl;
|
|
164
|
+
_FcrWhiteboardControlImpl = FcrWhiteboardControlImpl;
|
|
165
|
+
[_initProto] = _applyDecs(_FcrWhiteboardControlImpl, [[_imports.trace, 2, "active"], [_imports.trace, 2, "inactive"], [_setBackgroundColorDecs, 2, "setBackgroundColor"], [_imports.trace, 2, "getBackgroundColor"], [_imports.trace, 2, "getActivity"], [_imports.trace, 2, "getOwnerId"], [_imports.bound, 2, "_onScenePropertiesUpdated"]], [], 0, void 0, _ref).e;
|
|
166
|
+
class FcrStandaloneWhiteboardControlImpl extends _base.FcrBaseWhiteboardControlImpl {
|
|
167
|
+
getApplicationId() {
|
|
168
|
+
return _constant.WHITEBOARD_APP_ID;
|
|
169
|
+
}
|
|
170
|
+
getWhiteboardOption() {
|
|
171
|
+
return _objectSpread(_objectSpread({}, super.getWhiteboardOption()), {}, {
|
|
172
|
+
width: _utils.WHITEBOARD_WIDTH,
|
|
173
|
+
height: _utils.WHITEBOARD_HEIGHT
|
|
230
174
|
});
|
|
231
175
|
}
|
|
232
176
|
}
|
|
233
|
-
exports.
|
|
177
|
+
exports.FcrStandaloneWhiteboardControlImpl = FcrStandaloneWhiteboardControlImpl;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { FcrCoreServiceApi } from '../../../service/api';
|
|
2
|
+
import { FcrSharedCache } from '../../shared-cache';
|
|
3
|
+
import { FcrBoardConfig, FcrStandaloneWhiteboardControl, FcrWhiteboardControl, FcrWhiteboardControlFactory } from './type';
|
|
4
|
+
import type { RTMClient } from 'agora-rtm';
|
|
5
|
+
import { AgoraRteScene } from 'agora-rte-sdk';
|
|
6
|
+
export declare class FcrWhiteboardControlFactoryImpl implements FcrWhiteboardControlFactory {
|
|
7
|
+
protected logger: import("agora-foundation/lib/logger").Logger;
|
|
8
|
+
createForSubProcess(rtmClient: RTMClient, hasOperationPrivilege: boolean, boardConfig: FcrBoardConfig): FcrStandaloneWhiteboardControl;
|
|
9
|
+
createForMainProcess(rtmClient: RTMClient, hasOperationPrivilege: boolean, boardConfig: FcrBoardConfig, scene: AgoraRteScene, api: FcrCoreServiceApi, sharedCache: FcrSharedCache): FcrWhiteboardControl;
|
|
10
|
+
private _createForgeInitConfigFetcher;
|
|
11
|
+
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
+
require("core-js/modules/es.symbol.description.js");
|
|
3
4
|
require("core-js/modules/es.array.push.js");
|
|
4
5
|
require("core-js/modules/esnext.function.metadata.js");
|
|
5
6
|
require("core-js/modules/esnext.map.delete-all.js");
|
|
@@ -17,57 +18,58 @@ require("core-js/modules/esnext.map.reduce.js");
|
|
|
17
18
|
require("core-js/modules/esnext.map.some.js");
|
|
18
19
|
require("core-js/modules/esnext.map.update.js");
|
|
19
20
|
require("core-js/modules/esnext.symbol.metadata.js");
|
|
21
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
20
22
|
Object.defineProperty(exports, "__esModule", {
|
|
21
23
|
value: true
|
|
22
24
|
});
|
|
23
|
-
exports.
|
|
24
|
-
|
|
25
|
-
|
|
25
|
+
exports.FcrWhiteboardControlFactoryImpl = void 0;
|
|
26
|
+
require("core-js/modules/es.error.cause.js");
|
|
27
|
+
require("core-js/modules/web.dom-collections.iterator.js");
|
|
28
|
+
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
26
29
|
var _logger = require("../../../utilities/logger");
|
|
27
|
-
var
|
|
28
|
-
var
|
|
30
|
+
var _error = require("../../../utilities/error");
|
|
31
|
+
var _log = require("agora-foundation/lib/decorator/log");
|
|
32
|
+
var _base = require("../base");
|
|
33
|
+
var _control = require("./control");
|
|
34
|
+
var _sharedStorage = require("../../../utilities/shared-storage");
|
|
35
|
+
var _FcrWhiteboardControlFactoryImpl;
|
|
29
36
|
let _initProto;
|
|
30
37
|
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)]; } }; }
|
|
31
38
|
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
|
|
32
39
|
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); }
|
|
33
40
|
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; }
|
|
34
41
|
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; }
|
|
35
|
-
class
|
|
36
|
-
|
|
37
|
-
|
|
42
|
+
class FcrWhiteboardControlFactoryImpl {
|
|
43
|
+
constructor() {
|
|
44
|
+
(0, _defineProperty2.default)(this, "logger", (_initProto(this), (0, _logger.createLogger)({
|
|
45
|
+
prefix: 'FcrWhiteboardControlFactory'
|
|
46
|
+
})));
|
|
38
47
|
}
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
this._privilegeControl = _privilegeControl;
|
|
48
|
-
this._api = _api;
|
|
49
|
-
this.logger.info(`[annotation]: constructor initialized`);
|
|
48
|
+
createForSubProcess(rtmClient, hasOperationPrivilege, boardConfig) {
|
|
49
|
+
return new _base.FcrBaseWhiteboardControlImpl(rtmClient, boardConfig, hasOperationPrivilege, () => {
|
|
50
|
+
const forgeInitConfig = (0, _sharedStorage.getWhiteboardOptions)();
|
|
51
|
+
if (!forgeInitConfig) {
|
|
52
|
+
throw (0, _error.generateFcrCoreClientError)(_error.FcrErrorModuleCode.ROOM_WHITEBOARD, _error.FcrErrorCode.UNDEFINED_ERROR, "whiteboard init config is not exist", new Error("whiteboard init config is not exist"));
|
|
53
|
+
}
|
|
54
|
+
return Promise.resolve(forgeInitConfig);
|
|
55
|
+
});
|
|
50
56
|
}
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
return new _control.FcrAnnotationControlImpl(this._rtmClient, config);
|
|
57
|
+
createForMainProcess(rtmClient, hasOperationPrivilege, boardConfig, scene, api, sharedCache) {
|
|
58
|
+
return new _control.FcrWhiteboardControlImpl(rtmClient, boardConfig, hasOperationPrivilege, sharedCache, this._createForgeInitConfigFetcher(api, boardConfig.roomId, boardConfig.userId), scene, api);
|
|
54
59
|
}
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
const annotationConfig = (0, _utils.getAnnotationConfigFromRoomProperties)(roomProperties, this.logger);
|
|
66
|
-
return {
|
|
67
|
-
userId: localUser.userId,
|
|
68
|
-
nickName: localUser.userName,
|
|
69
|
-
...annotationConfig
|
|
60
|
+
_createForgeInitConfigFetcher(api, roomId, userId) {
|
|
61
|
+
const getObjectInitConfig = async (roomId, userId) => {
|
|
62
|
+
return await (0, _error.handleRequestError)(() => api.getWhiteboardToken({
|
|
63
|
+
roomId,
|
|
64
|
+
userId
|
|
65
|
+
}), _error.FcrErrorModuleCode.ROOM_WHITEBOARD, 'get whiteboard token failed');
|
|
66
|
+
};
|
|
67
|
+
return async () => {
|
|
68
|
+
const response = await getObjectInitConfig(roomId, userId);
|
|
69
|
+
return response.data;
|
|
70
70
|
};
|
|
71
71
|
}
|
|
72
72
|
}
|
|
73
|
-
exports.
|
|
73
|
+
exports.FcrWhiteboardControlFactoryImpl = FcrWhiteboardControlFactoryImpl;
|
|
74
|
+
_FcrWhiteboardControlFactoryImpl = FcrWhiteboardControlFactoryImpl;
|
|
75
|
+
[_initProto] = _applyDecs(_FcrWhiteboardControlFactoryImpl, [[_log.trace, 2, "createForSubProcess"], [_log.trace, 2, "createForMainProcess"]], []).e;
|
|
@@ -1,30 +1,21 @@
|
|
|
1
|
-
import { FcrConnectionState } from '../../../type';
|
|
2
1
|
import { FcrUserInfo } from '../../../type';
|
|
3
|
-
import { FcrBaseWhiteboardControl,
|
|
4
|
-
import {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
removeObserver(observer: FcrWhiteboardObserver): void;
|
|
2
|
+
import { FcrBaseWhiteboardControl, FcrBaseWhiteboardObserver } from '../type';
|
|
3
|
+
import { AgoraRteScene } from '../../../imports';
|
|
4
|
+
import { FcrCoreServiceApi } from '../../../service/api';
|
|
5
|
+
import { FcrSharedCache } from '../../shared-cache';
|
|
6
|
+
import type { RTMClient } from 'agora-rtm';
|
|
7
|
+
import { FcrBoardInactiveReason } from '../../whiteboard-control/enum';
|
|
8
|
+
export interface FcrStandaloneWhiteboardControl extends FcrBaseWhiteboardControl<FcrBaseWhiteboardObserver> {
|
|
11
9
|
}
|
|
12
|
-
export interface
|
|
10
|
+
export interface FcrWhiteboardControl extends FcrBaseWhiteboardControl<FcrWhiteboardObserver> {
|
|
13
11
|
active(): Promise<void>;
|
|
14
12
|
inactive(): Promise<void>;
|
|
15
13
|
getActivity(): boolean;
|
|
16
|
-
getOwnerId(): string;
|
|
17
|
-
getBackgroundColor(): string
|
|
14
|
+
getOwnerId(): string | null;
|
|
15
|
+
getBackgroundColor(): string;
|
|
18
16
|
setBackgroundColor(color: string): Promise<void>;
|
|
19
|
-
addObserver(observer: FcrWhiteboardObserver): void;
|
|
20
|
-
removeObserver(observer: FcrWhiteboardObserver): void;
|
|
21
17
|
}
|
|
22
|
-
export
|
|
23
|
-
/**
|
|
24
|
-
* Callback to receive the connection state change.
|
|
25
|
-
* @param state
|
|
26
|
-
*/
|
|
27
|
-
onConnectionStateUpdated?(state: FcrConnectionState): void;
|
|
18
|
+
export interface FcrWhiteboardObserver extends FcrBaseWhiteboardObserver {
|
|
28
19
|
/**
|
|
29
20
|
* Callback to receive the background color of the whiteboard change.
|
|
30
21
|
* @param info
|
|
@@ -41,18 +32,15 @@ export type FcrWhiteboardObserver = {
|
|
|
41
32
|
* @param operatorUser
|
|
42
33
|
*/
|
|
43
34
|
onInactive?(reason: FcrBoardInactiveReason, operatorUser?: FcrUserInfo): void;
|
|
44
|
-
}
|
|
35
|
+
}
|
|
45
36
|
export type FcrBoardConfig = {
|
|
46
37
|
userId: string;
|
|
47
|
-
|
|
48
|
-
|
|
38
|
+
userName: string;
|
|
39
|
+
boardRatio: number;
|
|
40
|
+
roomId: string;
|
|
49
41
|
};
|
|
50
|
-
export
|
|
51
|
-
ACTIVE = 1,
|
|
52
|
-
INACTIVE = 0,
|
|
53
|
-
BACKGROUND_COLOR_UPDATED = 100101
|
|
54
|
-
}
|
|
42
|
+
export type FcrBoardConfigForPrivilege = Pick<FcrBoardConfig, 'userId' | 'userName'>;
|
|
55
43
|
export interface FcrWhiteboardControlFactory {
|
|
56
|
-
createForSubProcess(
|
|
57
|
-
createForMainProcess():
|
|
44
|
+
createForSubProcess(rtmClient: RTMClient, hasOperationPrivilege: boolean, boardConfig: FcrBoardConfig): FcrStandaloneWhiteboardControl;
|
|
45
|
+
createForMainProcess(rtmClient: RTMClient, hasOperationPrivilege: boolean, boardConfig: FcrBoardConfig, scene: AgoraRteScene, api: FcrCoreServiceApi, sharedCache: FcrSharedCache): FcrWhiteboardControl;
|
|
58
46
|
}
|
|
@@ -2,12 +2,4 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.WHITEBOARD_APP_ID = exports.FcrBoardPropertiesState = void 0;
|
|
7
|
-
const WHITEBOARD_APP_ID = exports.WHITEBOARD_APP_ID = 'MainWhiteboard';
|
|
8
|
-
let FcrBoardPropertiesState = exports.FcrBoardPropertiesState = /*#__PURE__*/function (FcrBoardPropertiesState) {
|
|
9
|
-
FcrBoardPropertiesState[FcrBoardPropertiesState["ACTIVE"] = 1] = "ACTIVE";
|
|
10
|
-
FcrBoardPropertiesState[FcrBoardPropertiesState["INACTIVE"] = 0] = "INACTIVE";
|
|
11
|
-
FcrBoardPropertiesState[FcrBoardPropertiesState["BACKGROUND_COLOR_UPDATED"] = 100101] = "BACKGROUND_COLOR_UPDATED";
|
|
12
|
-
return FcrBoardPropertiesState;
|
|
13
|
-
}({});
|
|
5
|
+
});
|