fcr-core 3.7.2 → 3.7.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/chat-connection/index.js +4 -2
- package/lib/engine/index.js +6 -5
- package/lib/imports.d.ts +6 -5
- package/lib/imports.js +25 -18
- package/lib/media-control/desktop.js +4 -2
- package/lib/media-control/mobile.js +4 -2
- package/lib/monitor-control/index.js +4 -2
- package/lib/peer-session/index.js +4 -2
- package/lib/plugins/chatroom.js +4 -2
- package/lib/room-control/ability-control/index.js +4 -2
- package/lib/room-control/group-control/index.js +4 -2
- package/lib/room-control/index.js +13 -6
- package/lib/room-control/interpreter-control/index.js +4 -2
- package/lib/room-control/interpreter-control/room.js +2 -3
- package/lib/room-control/join-before-host-waitingroom-control/index.js +2 -2
- package/lib/room-control/mainroom-control/index.js +52 -13
- package/lib/room-control/privilege-control/index.js +4 -2
- package/lib/room-control/room-connector-control/index.js +4 -2
- package/lib/room-control/room-session/index.js +4 -2
- package/lib/room-control/sharing-control/index.d.ts +8 -7
- package/lib/room-control/sharing-control/index.js +33 -34
- package/lib/room-control/sharing-control/type.d.ts +4 -4
- package/lib/room-control/stream-control/index.js +4 -2
- package/lib/room-control/user-control/index.js +4 -2
- package/lib/room-control/waitingroom-control/index.js +6 -4
- package/lib/room-control/whiteboard-control/types.d.ts +16 -13
- package/lib/room-control/whiteboard-control-v2/annotation-control/control.d.ts +32 -0
- package/lib/room-control/whiteboard-control-v2/annotation-control/control.js +239 -0
- package/lib/room-control/whiteboard-control-v2/annotation-control/index.d.ts +15 -35
- package/lib/room-control/whiteboard-control-v2/annotation-control/index.js +32 -217
- package/lib/room-control/whiteboard-control-v2/annotation-control/privilege-control.d.ts +36 -0
- package/lib/room-control/whiteboard-control-v2/annotation-control/privilege-control.js +252 -0
- package/lib/room-control/whiteboard-control-v2/annotation-control/type.d.ts +15 -3
- package/lib/room-control/whiteboard-control-v2/annotation-control/type.js +3 -1
- package/lib/room-control/whiteboard-control-v2/index.d.ts +3 -3
- package/lib/room-control/whiteboard-control-v2/index.js +7 -4
- package/lib/room-control/whiteboard-control-v2/main-window.d.ts +7 -11
- package/lib/room-control/whiteboard-control-v2/main-window.js +42 -48
- package/lib/room-control/whiteboard-control-v2/utils.d.ts +17 -0
- package/lib/room-control/whiteboard-control-v2/utils.js +64 -1
- package/lib/room-control/whiteboard-control-v2/whiteboard-control/control.d.ts +34 -0
- package/lib/room-control/whiteboard-control-v2/whiteboard-control/control.js +233 -0
- package/lib/room-control/whiteboard-control-v2/whiteboard-control/index.d.ts +17 -0
- package/lib/room-control/whiteboard-control-v2/whiteboard-control/index.js +30 -0
- package/lib/room-control/whiteboard-control-v2/whiteboard-control/privilege-control.d.ts +36 -0
- package/lib/room-control/whiteboard-control-v2/whiteboard-control/privilege-control.js +240 -0
- package/lib/room-control/whiteboard-control-v2/whiteboard-control/type.d.ts +20 -4
- package/lib/room-control/whiteboard-control-v2/whiteboard-control/type.js +9 -1
- package/lib/room-router/index.js +5 -4
- package/lib/service/api.d.ts +7 -2
- package/lib/service/api.js +2 -1
- package/lib/type.d.ts +1 -1
- package/lib/utilities/logger.d.ts +0 -1
- package/lib/utilities/logger.js +2 -3
- package/lib/utilities/shared-storage.d.ts +5 -0
- package/lib/utilities/shared-storage.js +34 -0
- package/lib/utilities/storage.d.ts +8 -0
- package/lib/utilities/storage.js +32 -0
- package/package.json +5 -11
- package/lib/room-control/whiteboard-control/board-window.d.ts +0 -52
- package/lib/room-control/whiteboard-control/board-window.js +0 -405
- package/lib/room-control/whiteboard-control/index.d.ts +0 -1
- package/lib/room-control/whiteboard-control/index.js +0 -343
- package/lib/room-control/whiteboard-control/mount-manager.d.ts +0 -4
- package/lib/room-control/whiteboard-control/mount-manager.js +0 -13
- package/lib/room-control/whiteboard-control/utils.d.ts +0 -51
- package/lib/room-control/whiteboard-control/utils.js +0 -270
|
@@ -20,239 +20,54 @@ require("core-js/modules/esnext.symbol.metadata.js");
|
|
|
20
20
|
Object.defineProperty(exports, "__esModule", {
|
|
21
21
|
value: true
|
|
22
22
|
});
|
|
23
|
-
exports.
|
|
24
|
-
require("
|
|
25
|
-
require("
|
|
26
|
-
require("core-js/modules/esnext.iterator.some.js");
|
|
27
|
-
var _forgeRoom = require("@netless/forge-room");
|
|
28
|
-
var _forgeWhiteboard = require("@netless/forge-whiteboard");
|
|
29
|
-
var _imports = require("agora-rte-sdk/lib/imports");
|
|
30
|
-
var _type = require("../../../type");
|
|
31
|
-
var _mainWindow = require("../main-window");
|
|
23
|
+
exports.FcrAnnotationControlFactoryImpl = void 0;
|
|
24
|
+
var _control = require("./control");
|
|
25
|
+
var _decorator = require("agora-foundation/lib/decorator");
|
|
32
26
|
var _logger = require("../../../utilities/logger");
|
|
33
|
-
var
|
|
27
|
+
var _privilegeControl2 = require("./privilege-control");
|
|
28
|
+
var _utils = require("../utils");
|
|
29
|
+
var _staticBlock;
|
|
34
30
|
let _initProto;
|
|
35
31
|
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
32
|
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
|
|
37
33
|
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
34
|
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
35
|
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
|
-
logger = (() => (_initProto(this), (0, _imports.createLogger)({
|
|
44
|
-
prefix: 'FcrAnnotationControlImpl'
|
|
36
|
+
class FcrAnnotationControlFactoryImpl {
|
|
37
|
+
logger = (() => (_initProto(this), (0, _logger.createLogger)({
|
|
38
|
+
prefix: 'FcrAnnotationControlFactory'
|
|
45
39
|
})))();
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
_connectState = (() => _type.FcrConnectionState.DISCONNECTED)();
|
|
49
|
-
_needRetry = true;
|
|
50
|
-
_needRetrySyncOpenDone = true;
|
|
51
|
-
constructor(_scene, _api, _engine, _privilegeControl, _sharedCache, _streamControl, _userControl) {
|
|
40
|
+
constructor(_rtmClient, _scene, _streamControl, _userControl, _privilegeControl, _api) {
|
|
41
|
+
this._rtmClient = _rtmClient;
|
|
52
42
|
this._scene = _scene;
|
|
53
|
-
this._api = _api;
|
|
54
|
-
this._engine = _engine;
|
|
55
|
-
this._privilegeControl = _privilegeControl;
|
|
56
|
-
this._sharedCache = _sharedCache;
|
|
57
43
|
this._streamControl = _streamControl;
|
|
58
44
|
this._userControl = _userControl;
|
|
59
|
-
this.
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
const retriesMax = 10;
|
|
63
|
-
try {
|
|
64
|
-
await (0, _imports.retryAttempt)(async () => {
|
|
65
|
-
await this._api.syncScreenShareOwnerAnnotationOpenDone(this._scene.sceneId);
|
|
66
|
-
}, [], {
|
|
67
|
-
retriesMax
|
|
68
|
-
}).fail(async _ref => {
|
|
69
|
-
let {
|
|
70
|
-
error,
|
|
71
|
-
timeFn,
|
|
72
|
-
currentRetry
|
|
73
|
-
} = _ref;
|
|
74
|
-
this.logger.info(`[annotation]: failed to sync screen share owner annotation open done event, error: ${error.message}, current retry: ${currentRetry}`);
|
|
75
|
-
this._needRetrySyncOpenDone && (await timeFn());
|
|
76
|
-
this.logger.info(`[annotation]: continue attemptting? need retry: ${this._needRetrySyncOpenDone}`);
|
|
77
|
-
return this._needRetrySyncOpenDone;
|
|
78
|
-
}).abort(() => {}).exec();
|
|
79
|
-
} catch (e) {}
|
|
80
|
-
}
|
|
81
|
-
async open() {
|
|
82
|
-
const {
|
|
83
|
-
size,
|
|
84
|
-
extra
|
|
85
|
-
} = this._getBoardConfigInfoWithScene();
|
|
86
|
-
const {
|
|
87
|
-
width,
|
|
88
|
-
height
|
|
89
|
-
} = size;
|
|
90
|
-
const {
|
|
91
|
-
boardAppId,
|
|
92
|
-
boardId,
|
|
93
|
-
boardToken,
|
|
94
|
-
region
|
|
95
|
-
} = extra;
|
|
96
|
-
const userId = this._scene.localUser.getLocalUserId();
|
|
97
|
-
const nickName = this._scene.getUser(userId)?.userName;
|
|
98
|
-
// @ts-ignore
|
|
99
|
-
const rtmClient = this._engine._rtmClient._client;
|
|
100
|
-
const rtmProvider = new _forgeRtm.RTMProvider_2_2(rtmClient);
|
|
101
|
-
const wbRoom = new _forgeRoom.Room(boardId, rtmProvider);
|
|
102
|
-
wbRoom.applicationManager.registerApplication(_forgeWhiteboard.WhiteboardApplication);
|
|
103
|
-
try {
|
|
104
|
-
this._updateConnnectionState(_type.FcrConnectionState.CONNECTING);
|
|
105
|
-
const retriesMax = 10;
|
|
106
|
-
await (0, _imports.retryAttempt)(async () => {
|
|
107
|
-
await wbRoom.joinRoom({
|
|
108
|
-
userId,
|
|
109
|
-
nickName,
|
|
110
|
-
roomToken: boardToken,
|
|
111
|
-
sdkConfig: {
|
|
112
|
-
// @ts-ignore
|
|
113
|
-
region,
|
|
114
|
-
appIdentifier: boardAppId,
|
|
115
|
-
enableIFramePlugin: false,
|
|
116
|
-
useMultiViews: true
|
|
117
|
-
}
|
|
118
|
-
});
|
|
119
|
-
this._boardRoom = wbRoom;
|
|
120
|
-
const currentTimestamp = Date.now();
|
|
121
|
-
// @ts-ignore
|
|
122
|
-
this._boardRoom['traceId'] = `${boardToken}-${boardAppId}-${userId}-${currentTimestamp}`;
|
|
123
|
-
this.logger.info(
|
|
124
|
-
// @ts-ignore
|
|
125
|
-
`[annotation]: receiver join board room success, traceId : ${this._boardRoom['traceId']}`);
|
|
126
|
-
const whiteboard = await wbRoom.applicationManager.launchApplication(_forgeWhiteboard.WhiteboardApplication, {
|
|
127
|
-
width,
|
|
128
|
-
height,
|
|
129
|
-
defaultToolbarStyle: {
|
|
130
|
-
tool: 'laser'
|
|
131
|
-
},
|
|
132
|
-
maxScaleRatio: 1
|
|
133
|
-
}, this._FCR_ANNOTATION_APP_ID);
|
|
134
|
-
whiteboard.enableCameraByMouse = false;
|
|
135
|
-
whiteboard.enableCameraByTouch = false;
|
|
136
|
-
whiteboard.setViewModeToMain();
|
|
137
|
-
this._boardView = new _mainWindow.FcrBoardMainWindowImpl(whiteboard, this._scene, this._sharedCache, wbRoom);
|
|
138
|
-
this._needRetry = false;
|
|
139
|
-
this.logger.info('[annotation][open]: set background color');
|
|
140
|
-
this._boardView.setBackgroundColor('rgba(0, 0, 0, 0)');
|
|
141
|
-
// this._boardView.setBoardTransparent(true);
|
|
142
|
-
const isLocalUserInScreenSharing = this._isLocalUserInScreenSharing();
|
|
143
|
-
if (isLocalUserInScreenSharing) {
|
|
144
|
-
const currentMainWindow = this.getMainWindow();
|
|
145
|
-
if (currentMainWindow) {
|
|
146
|
-
currentMainWindow.clean();
|
|
147
|
-
currentMainWindow.updateWindowSize({
|
|
148
|
-
width,
|
|
149
|
-
height
|
|
150
|
-
});
|
|
151
|
-
this.syncScreenShareOwnerAnnotationOpenDone();
|
|
152
|
-
}
|
|
153
|
-
}
|
|
154
|
-
this._updateConnnectionState(_type.FcrConnectionState.CONNECTED);
|
|
155
|
-
}, [], {
|
|
156
|
-
retriesMax
|
|
157
|
-
}).fail(async _ref2 => {
|
|
158
|
-
let {
|
|
159
|
-
error,
|
|
160
|
-
timeFn,
|
|
161
|
-
currentRetry
|
|
162
|
-
} = _ref2;
|
|
163
|
-
this.logger.info(`[annotation]: failed to join board room, error: ${error.message}, current retry: ${currentRetry}`);
|
|
164
|
-
this._needRetry && (await timeFn());
|
|
165
|
-
this.logger.info(`[annotation]: continue attemptting? need retry: ${this._needRetry}`);
|
|
166
|
-
return this._needRetry;
|
|
167
|
-
}).abort(() => {
|
|
168
|
-
this._updateConnnectionState(_type.FcrConnectionState.DISCONNECTED);
|
|
169
|
-
}).exec();
|
|
170
|
-
} catch (e) {
|
|
171
|
-
this._updateConnnectionState(_type.FcrConnectionState.DISCONNECTED);
|
|
172
|
-
}
|
|
173
|
-
return this._boardView;
|
|
174
|
-
}
|
|
175
|
-
async close() {
|
|
176
|
-
this._needRetry = false;
|
|
177
|
-
this._boardRoom?.applicationManager.removeAllListeners();
|
|
178
|
-
// this._boardRoom?.applicationManager.terminateApplication(this._FCR_ANNOTATION_APP_ID);
|
|
179
|
-
await this._boardRoom?.leaveRoom();
|
|
180
|
-
this.logger.info(
|
|
181
|
-
// @ts-ignore
|
|
182
|
-
`[annotation]: receiver leave board room success, traceId: ${this._boardRoom['traceId']}`);
|
|
183
|
-
this._boardRoom = undefined;
|
|
184
|
-
this._boardView = undefined;
|
|
185
|
-
this.logger.info('[annotation]: closed annotation control');
|
|
186
|
-
}
|
|
187
|
-
getConnectionState() {
|
|
188
|
-
return this._connectState;
|
|
189
|
-
}
|
|
190
|
-
getMainWindow() {
|
|
191
|
-
return this._boardView;
|
|
45
|
+
this._privilegeControl = _privilegeControl;
|
|
46
|
+
this._api = _api;
|
|
47
|
+
this.logger.info(`[annotation]: constructor initialized`);
|
|
192
48
|
}
|
|
193
|
-
|
|
194
|
-
this.
|
|
49
|
+
createForSubProcess(config) {
|
|
50
|
+
this.logger.info(`[annotation]: create for sub process with config: ${JSON.stringify(config)}`);
|
|
51
|
+
return new _control.FcrAnnotationControlImpl(this._rtmClient, config);
|
|
195
52
|
}
|
|
196
|
-
|
|
197
|
-
this.
|
|
53
|
+
createForMainProcess() {
|
|
54
|
+
this.logger.info(`[annotation]: start create for main process`);
|
|
55
|
+
const config = this._getBoardConfigInfoWithScene();
|
|
56
|
+
this.logger.info(`[annotation]: create for main process with config: ${JSON.stringify(config)}`);
|
|
57
|
+
const control = new _privilegeControl2.FcrPrivilegedAnnotationControlImpl(this._rtmClient, config, this._scene, this._streamControl, this._userControl, this._privilegeControl, this._api);
|
|
58
|
+
return control;
|
|
198
59
|
}
|
|
199
60
|
_getBoardConfigInfoWithScene() {
|
|
200
|
-
const
|
|
201
|
-
const
|
|
202
|
-
const
|
|
203
|
-
const boardRegion = this._scene.getScenePropertiesByKeyPath('widgets.annotation.extra.boardRegion');
|
|
204
|
-
const boardWidthVal = Number(this._scene.getScenePropertiesByKeyPath('widgets.annotation.size.width'));
|
|
205
|
-
const boardHeightVal = Number(this._scene.getScenePropertiesByKeyPath('widgets.annotation.size.height'));
|
|
206
|
-
const {
|
|
207
|
-
width: boardWidth,
|
|
208
|
-
height: boardHeight
|
|
209
|
-
} = this._resizeToMax(boardWidthVal, boardHeightVal, FCR_ANNOTATION_SCALE_BASE);
|
|
210
|
-
return {
|
|
211
|
-
size: {
|
|
212
|
-
width: boardWidth,
|
|
213
|
-
height: boardHeight
|
|
214
|
-
},
|
|
215
|
-
extra: {
|
|
216
|
-
boardAppId,
|
|
217
|
-
boardId,
|
|
218
|
-
boardToken,
|
|
219
|
-
region: boardRegion
|
|
220
|
-
}
|
|
221
|
-
};
|
|
222
|
-
}
|
|
223
|
-
_resizeToMax(w, h) {
|
|
224
|
-
let scaleBase = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : FCR_ANNOTATION_SCALE_BASE;
|
|
225
|
-
const scale = scaleBase / Math.max(w, h);
|
|
61
|
+
const roomProperties = this._scene.getSceneProperties();
|
|
62
|
+
const localUser = this._userControl?.getLocalUser();
|
|
63
|
+
const annotationConfig = (0, _utils.getAnnotationConfigFromRoomProperties)(roomProperties, this.logger);
|
|
226
64
|
return {
|
|
227
|
-
|
|
228
|
-
|
|
65
|
+
userId: localUser.userId,
|
|
66
|
+
nickName: localUser.userName,
|
|
67
|
+
...annotationConfig
|
|
229
68
|
};
|
|
230
69
|
}
|
|
231
|
-
|
|
232
|
-
this._connectState = state;
|
|
233
|
-
if (state === _type.FcrConnectionState.CONNECTED) {
|
|
234
|
-
this._streamControl.getStreamList().forEach(stream => {
|
|
235
|
-
const ownerId = stream.owner.userId;
|
|
236
|
-
const isNotMeSharing = ownerId !== this._userControl.getLocalUser().userId;
|
|
237
|
-
const platform = this._userControl.getUser(ownerId)?.platform;
|
|
238
|
-
const isPcPlatform = platform && [_type.FcrPlatform.WEB_DESKTOP, _type.FcrPlatform.WINDOWS, _type.FcrPlatform.MACOS].includes(platform);
|
|
239
|
-
const isAndroidPlatform = platform && platform === _type.FcrPlatform.ANDROID;
|
|
240
|
-
if (isPcPlatform) {
|
|
241
|
-
this._boardView?.setAutoCancelDraw(false);
|
|
242
|
-
}
|
|
243
|
-
if (isAndroidPlatform) {
|
|
244
|
-
this._boardView?.setAutoCancelDraw(isNotMeSharing);
|
|
245
|
-
}
|
|
246
|
-
});
|
|
247
|
-
}
|
|
248
|
-
this._observable.notifyObservers('onConnectionStateUpdated', state);
|
|
249
|
-
}
|
|
250
|
-
_isLocalUserInScreenSharing() {
|
|
251
|
-
const localUserInfo = this._userControl.getLocalUser();
|
|
252
|
-
return this._streamControl.getStreamList().some(streamInfo => streamInfo.videoSourceType === _type.FcrVideoSourceType.SCREEN && streamInfo.owner.userId === localUserInfo.userId);
|
|
253
|
-
}
|
|
254
|
-
_addLogObserver() {
|
|
255
|
-
this.addObserver((0, _logger.generateLogObserver)(this.logger, ['onActive', 'onInactive', 'onBackgroundColorUpdated', 'onConnectionStateUpdated']));
|
|
256
|
-
}
|
|
70
|
+
static #_ = (() => _staticBlock = () => [_initProto] = _applyDecs(this, [[_decorator.bound, 2, "_getBoardConfigInfoWithScene"]], []).e)();
|
|
257
71
|
}
|
|
258
|
-
exports.
|
|
72
|
+
exports.FcrAnnotationControlFactoryImpl = FcrAnnotationControlFactoryImpl;
|
|
73
|
+
_staticBlock();
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { FcrAnnotationConfig, FcrPrivilegedAnnotationControl } from './type';
|
|
2
|
+
import { AgoraRteScene } from 'agora-rte-sdk';
|
|
3
|
+
import { FcrConnectionState, FcrPrivilegeControl, FcrStreamControl, FcrUserControl, FcrWhiteboardObserver } from '../../../type';
|
|
4
|
+
import { FcrAnnotationControlImpl } from './control';
|
|
5
|
+
import { FcrCoreServiceApi } from '../../../service/api';
|
|
6
|
+
import { AgoraRtmClient } from 'agora-rte-sdk/lib/core/rtm/client';
|
|
7
|
+
import { FcrBoardMainWindow } from '../../whiteboard-control/types';
|
|
8
|
+
export declare class FcrPrivilegedAnnotationControlImpl extends FcrAnnotationControlImpl implements FcrPrivilegedAnnotationControl {
|
|
9
|
+
private _scene;
|
|
10
|
+
private _streamControl;
|
|
11
|
+
private _userControl;
|
|
12
|
+
private _privilegeControl;
|
|
13
|
+
private _api;
|
|
14
|
+
protected logger: import("agora-foundation/lib/logger").Logger;
|
|
15
|
+
private _config;
|
|
16
|
+
private _isOpen;
|
|
17
|
+
private _waitPromise;
|
|
18
|
+
private _waitPromiseResolve;
|
|
19
|
+
private _waitPromiseReject;
|
|
20
|
+
private _privilegeObserver;
|
|
21
|
+
private _sceneObserver;
|
|
22
|
+
constructor(rtmClient: AgoraRtmClient, config: FcrAnnotationConfig, _scene: AgoraRteScene, _streamControl: FcrStreamControl, _userControl: FcrUserControl, _privilegeControl: FcrPrivilegeControl, _api: FcrCoreServiceApi);
|
|
23
|
+
addObserver(observer: FcrWhiteboardObserver): void;
|
|
24
|
+
removeObserver(observer: FcrWhiteboardObserver): void;
|
|
25
|
+
open(): Promise<FcrBoardMainWindow>;
|
|
26
|
+
close(): Promise<void>;
|
|
27
|
+
syncScreenShareOwnerAnnotationOpenDone(): Promise<void>;
|
|
28
|
+
protected updateConnnectionState(state: FcrConnectionState): void;
|
|
29
|
+
protected _connect(): Promise<FcrBoardMainWindow>;
|
|
30
|
+
private _hasBoardWritePermission;
|
|
31
|
+
private _checkForConnect;
|
|
32
|
+
private _clearWaitPromise;
|
|
33
|
+
private _getToken;
|
|
34
|
+
private _handleApplicationLaunch;
|
|
35
|
+
private _handleApplicationTerminal;
|
|
36
|
+
}
|
|
@@ -0,0 +1,252 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
require("core-js/modules/es.array.push.js");
|
|
4
|
+
require("core-js/modules/esnext.function.metadata.js");
|
|
5
|
+
require("core-js/modules/esnext.map.delete-all.js");
|
|
6
|
+
require("core-js/modules/esnext.map.emplace.js");
|
|
7
|
+
require("core-js/modules/esnext.map.every.js");
|
|
8
|
+
require("core-js/modules/esnext.map.filter.js");
|
|
9
|
+
require("core-js/modules/esnext.map.find.js");
|
|
10
|
+
require("core-js/modules/esnext.map.find-key.js");
|
|
11
|
+
require("core-js/modules/esnext.map.includes.js");
|
|
12
|
+
require("core-js/modules/esnext.map.key-of.js");
|
|
13
|
+
require("core-js/modules/esnext.map.map-keys.js");
|
|
14
|
+
require("core-js/modules/esnext.map.map-values.js");
|
|
15
|
+
require("core-js/modules/esnext.map.merge.js");
|
|
16
|
+
require("core-js/modules/esnext.map.reduce.js");
|
|
17
|
+
require("core-js/modules/esnext.map.some.js");
|
|
18
|
+
require("core-js/modules/esnext.map.update.js");
|
|
19
|
+
require("core-js/modules/esnext.symbol.metadata.js");
|
|
20
|
+
Object.defineProperty(exports, "__esModule", {
|
|
21
|
+
value: true
|
|
22
|
+
});
|
|
23
|
+
exports.FcrPrivilegedAnnotationControlImpl = void 0;
|
|
24
|
+
require("core-js/modules/esnext.iterator.constructor.js");
|
|
25
|
+
require("core-js/modules/esnext.iterator.find.js");
|
|
26
|
+
require("core-js/modules/esnext.iterator.some.js");
|
|
27
|
+
var _type = require("../../../type");
|
|
28
|
+
var _control = require("./control");
|
|
29
|
+
var _forgeWhiteboard = require("@netless/forge-whiteboard");
|
|
30
|
+
var _helper = require("../../privilege-control/helper");
|
|
31
|
+
var _imports = require("../../../imports");
|
|
32
|
+
var _error = require("../../../utilities/error");
|
|
33
|
+
var _logger = require("../../../utilities/logger");
|
|
34
|
+
var _utils = require("../utils");
|
|
35
|
+
var _staticBlock;
|
|
36
|
+
let _initProto;
|
|
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)]; } }; }
|
|
38
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
|
|
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); }
|
|
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; }
|
|
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; }
|
|
42
|
+
class FcrPrivilegedAnnotationControlImpl extends _control.FcrAnnotationControlImpl {
|
|
43
|
+
logger = (() => (_initProto(this), (0, _logger.createLogger)({
|
|
44
|
+
prefix: 'FcrPrivilegedAnnotationControlImpl'
|
|
45
|
+
})))();
|
|
46
|
+
_isOpen = false;
|
|
47
|
+
_waitPromise = null;
|
|
48
|
+
_waitPromiseResolve = null;
|
|
49
|
+
_waitPromiseReject = null;
|
|
50
|
+
_privilegeObserver = {
|
|
51
|
+
onLocalUserPermissionInfoAdded: (roomId, event) => {
|
|
52
|
+
if (this._hasBoardWritePermission(event)) {
|
|
53
|
+
this.logger.info(`add board write permission`);
|
|
54
|
+
const whiteboard = this.annotation;
|
|
55
|
+
if (whiteboard) {
|
|
56
|
+
whiteboard.permissions.addPermission(_forgeWhiteboard.WhiteboardPermissionFlag.all);
|
|
57
|
+
} else {
|
|
58
|
+
this.logger.warn('whiteboard is not initialized yet, should add permission when application launched');
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
},
|
|
62
|
+
onLocalUserPermissionInfoDeleted: (roomId, event) => {
|
|
63
|
+
if (this._hasBoardWritePermission(event)) {
|
|
64
|
+
this.logger.info(`remove board write permission`);
|
|
65
|
+
const whiteboard = this.annotation;
|
|
66
|
+
if (whiteboard) {
|
|
67
|
+
whiteboard.permissions.removePermission(_forgeWhiteboard.WhiteboardPermissionFlag.all);
|
|
68
|
+
} else {
|
|
69
|
+
this.logger.warn('whiteboard is not initialized yet, should remove permission when application launched');
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
};
|
|
74
|
+
_sceneObserver = {
|
|
75
|
+
onScenePropertiesUpdated: async (sceneId, event) => {
|
|
76
|
+
const hasKey = Object.keys(event.changedProperties).some(changeKey => {
|
|
77
|
+
return changeKey === 'widgets.annotation.extra.boardAppId';
|
|
78
|
+
});
|
|
79
|
+
if (hasKey) {
|
|
80
|
+
this.logger.info('widgets.annotation.extra.boardAppId updated, re-initializing annotation info');
|
|
81
|
+
if (this._isOpen && (await this._checkForConnect())) {
|
|
82
|
+
this._connect();
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
};
|
|
87
|
+
constructor(rtmClient, config, _scene, _streamControl, _userControl, _privilegeControl, _api) {
|
|
88
|
+
super(rtmClient, config);
|
|
89
|
+
this._scene = _scene;
|
|
90
|
+
this._streamControl = _streamControl;
|
|
91
|
+
this._userControl = _userControl;
|
|
92
|
+
this._privilegeControl = _privilegeControl;
|
|
93
|
+
this._api = _api;
|
|
94
|
+
this._config = config;
|
|
95
|
+
this._privilegeControl.addObserver(this._privilegeObserver);
|
|
96
|
+
this._scene.addObserver(this._sceneObserver);
|
|
97
|
+
this.logger.info(`initialized, config: ${JSON.stringify(config)}`);
|
|
98
|
+
}
|
|
99
|
+
addObserver(observer) {
|
|
100
|
+
this.observable.addObserver(observer);
|
|
101
|
+
}
|
|
102
|
+
removeObserver(observer) {
|
|
103
|
+
this.observable.removeObserver(observer);
|
|
104
|
+
}
|
|
105
|
+
async open() {
|
|
106
|
+
this._isOpen = true;
|
|
107
|
+
this.logger.info(`open privileged annotation control with config: ${(0, _imports.jsonstring)(this._config)}`);
|
|
108
|
+
const isReadyToConnect = await this._checkForConnect();
|
|
109
|
+
if (isReadyToConnect) {
|
|
110
|
+
return this._connect();
|
|
111
|
+
}
|
|
112
|
+
if (!this._waitPromise) {
|
|
113
|
+
this._waitPromise = new Promise((resolve, reject) => {
|
|
114
|
+
this._waitPromiseResolve = resolve;
|
|
115
|
+
this._waitPromiseReject = reject;
|
|
116
|
+
this.logger.info('waiting for annotation config to be ready');
|
|
117
|
+
});
|
|
118
|
+
}
|
|
119
|
+
return this._waitPromise;
|
|
120
|
+
}
|
|
121
|
+
close() {
|
|
122
|
+
this._isOpen = false;
|
|
123
|
+
if (this._waitPromiseReject) {
|
|
124
|
+
this._waitPromiseReject(new Error('closed before connection established'));
|
|
125
|
+
this._clearWaitPromise();
|
|
126
|
+
}
|
|
127
|
+
return super.close();
|
|
128
|
+
}
|
|
129
|
+
async syncScreenShareOwnerAnnotationOpenDone() {
|
|
130
|
+
try {
|
|
131
|
+
await this._api.syncScreenShareOwnerAnnotationOpenDone(this._scene.sceneId);
|
|
132
|
+
} catch (e) {
|
|
133
|
+
const error = e;
|
|
134
|
+
const errorMessage = error.message;
|
|
135
|
+
throw (0, _error.generateFcrCoreClientError)(_error.FcrErrorModuleCode.ROOM_WHITEBOARD, _error.FcrErrorCode.LOCAL_HTTP_REQUEST_FAILED, `sync screen share owner annotation open done failed: ${errorMessage}`, error);
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
updateConnnectionState(state) {
|
|
139
|
+
super.updateConnnectionState(state);
|
|
140
|
+
if (state === _type.FcrConnectionState.CONNECTED) {
|
|
141
|
+
const whiteboard = this.annotation;
|
|
142
|
+
const mainWindow = this.boardView;
|
|
143
|
+
if (!whiteboard) {
|
|
144
|
+
this.logger.error('whiteboard is expected to be initialized at this point');
|
|
145
|
+
return;
|
|
146
|
+
}
|
|
147
|
+
if (!mainWindow) {
|
|
148
|
+
this.logger.error('main window is expected to be initialized at this point');
|
|
149
|
+
return;
|
|
150
|
+
}
|
|
151
|
+
const isEnabled = action => (0, _helper.getLocalUserPermissionInfo)(this._scene, action).enable;
|
|
152
|
+
const hasOperationPrivilege = isEnabled(_type.FcrPermissionAction.BoardWrite) || isEnabled(_type.FcrPermissionAction.AnnotationWrite);
|
|
153
|
+
if (hasOperationPrivilege) {
|
|
154
|
+
this.logger.info('add whiteboard permission');
|
|
155
|
+
whiteboard.permissions.addPermission(_forgeWhiteboard.WhiteboardPermissionFlag.all);
|
|
156
|
+
} else {
|
|
157
|
+
this.logger.info('remove whiteboard permission');
|
|
158
|
+
whiteboard.permissions.removePermission(_forgeWhiteboard.WhiteboardPermissionFlag.all);
|
|
159
|
+
}
|
|
160
|
+
const stream = this._streamControl.getStreamList().find(stream => stream.videoSourceType === _type.FcrVideoSourceType.SCREEN);
|
|
161
|
+
const localUserId = this._userControl.getLocalUser().userId;
|
|
162
|
+
if (stream) {
|
|
163
|
+
const ownerId = stream.owner.userId;
|
|
164
|
+
const isNotMeSharing = ownerId !== localUserId;
|
|
165
|
+
const platform = this._userControl.getUser(ownerId)?.platform;
|
|
166
|
+
const isPcPlatform = platform && [_type.FcrPlatform.WEB_DESKTOP, _type.FcrPlatform.WINDOWS, _type.FcrPlatform.MACOS].includes(platform);
|
|
167
|
+
const isAndroidPlatform = platform && platform === _type.FcrPlatform.ANDROID;
|
|
168
|
+
this.logger.debug(`isPcPlatform: ${isPcPlatform}, isAndroidPlatform: ${isAndroidPlatform}, isNotMeSharing: ${isNotMeSharing}, ownerId: ${ownerId}, localUserId: ${localUserId}, platform: ${platform}`);
|
|
169
|
+
if (isPcPlatform) {
|
|
170
|
+
mainWindow.setAutoCancelDraw(false);
|
|
171
|
+
}
|
|
172
|
+
if (isAndroidPlatform) {
|
|
173
|
+
mainWindow.setAutoCancelDraw(isNotMeSharing);
|
|
174
|
+
}
|
|
175
|
+
if (ownerId === localUserId) {
|
|
176
|
+
if (mainWindow) {
|
|
177
|
+
mainWindow.clean();
|
|
178
|
+
mainWindow.updateWindowSize({
|
|
179
|
+
width: this._config.size.width,
|
|
180
|
+
height: this._config.size.height
|
|
181
|
+
});
|
|
182
|
+
this.syncScreenShareOwnerAnnotationOpenDone();
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
async _connect() {
|
|
189
|
+
const promise = super._connect();
|
|
190
|
+
promise.then(boardView => {
|
|
191
|
+
this.boardRoom.applicationManager.on('launch', this._handleApplicationLaunch);
|
|
192
|
+
this.boardRoom.applicationManager.on('terminal', this._handleApplicationTerminal);
|
|
193
|
+
if (this._waitPromiseResolve) {
|
|
194
|
+
this._waitPromiseResolve(boardView);
|
|
195
|
+
this._clearWaitPromise();
|
|
196
|
+
}
|
|
197
|
+
return boardView;
|
|
198
|
+
}).catch(reason => {
|
|
199
|
+
if (this._waitPromiseReject) {
|
|
200
|
+
this._waitPromiseReject(reason);
|
|
201
|
+
this._clearWaitPromise();
|
|
202
|
+
}
|
|
203
|
+
});
|
|
204
|
+
return promise;
|
|
205
|
+
}
|
|
206
|
+
_hasBoardWritePermission(event) {
|
|
207
|
+
const hasPermissionNow = event.permissionInfo.some(perm => perm.info?.action === _type.FcrPermissionAction.BoardWrite);
|
|
208
|
+
return hasPermissionNow;
|
|
209
|
+
}
|
|
210
|
+
async _checkForConnect() {
|
|
211
|
+
const roomId = this._scene.sceneId;
|
|
212
|
+
const userId = this._scene.localUser.getLocalUserId();
|
|
213
|
+
const boardOptions = (await this._getToken(roomId, userId)).data;
|
|
214
|
+
if (boardOptions && boardOptions.boardAppId) {
|
|
215
|
+
this.logger.info(`board options found, ready to connect: ${(0, _imports.jsonstring)(boardOptions)}`);
|
|
216
|
+
if (this.annotationConfig) {
|
|
217
|
+
this.annotationConfig.extra = this.annotationConfig.extra || {};
|
|
218
|
+
this.annotationConfig.extra.boardAppId = boardOptions.boardAppId;
|
|
219
|
+
this.annotationConfig.extra.boardId = boardOptions.boardId;
|
|
220
|
+
this.annotationConfig.extra.boardToken = boardOptions.boardToken;
|
|
221
|
+
this.annotationConfig.extra.region = boardOptions.region;
|
|
222
|
+
const roomProperties = this._scene.getSceneProperties();
|
|
223
|
+
const annotationConfig = (0, _utils.getAnnotationConfigFromRoomProperties)(roomProperties, this.logger);
|
|
224
|
+
this.annotationConfig.size.width = annotationConfig.size.width;
|
|
225
|
+
this.annotationConfig.size.height = annotationConfig.size.height;
|
|
226
|
+
this.logger.info(`update annotation config, config: ${(0, _imports.jsonstring)(this.annotationConfig)}`);
|
|
227
|
+
}
|
|
228
|
+
return true;
|
|
229
|
+
}
|
|
230
|
+
return false;
|
|
231
|
+
}
|
|
232
|
+
_clearWaitPromise() {
|
|
233
|
+
this._waitPromiseResolve = null;
|
|
234
|
+
this._waitPromiseReject = null;
|
|
235
|
+
this._waitPromise = null;
|
|
236
|
+
}
|
|
237
|
+
async _getToken(roomId, userId) {
|
|
238
|
+
return await (0, _error.handleRequestError)(() => this._api.getAnnotationToken({
|
|
239
|
+
roomId,
|
|
240
|
+
userId
|
|
241
|
+
}), _error.FcrErrorModuleCode.ROOM_WHITEBOARD, 'get whiteboard token failed');
|
|
242
|
+
}
|
|
243
|
+
async _handleApplicationLaunch(appId, app) {
|
|
244
|
+
this.annotation = app;
|
|
245
|
+
}
|
|
246
|
+
async _handleApplicationTerminal(appId, app) {
|
|
247
|
+
this.annotation = app;
|
|
248
|
+
}
|
|
249
|
+
static #_ = (() => _staticBlock = () => [_initProto] = _applyDecs(this, [[_imports.trace, 2, "open"], [_imports.trace, 2, "close"], [_imports.trace, 2, "syncScreenShareOwnerAnnotationOpenDone"], [[_imports.bound, _imports.trace], 2, "_handleApplicationLaunch"], [[_imports.bound, _imports.trace], 2, "_handleApplicationTerminal"]], [], 0, void 0, _control.FcrAnnotationControlImpl).e)();
|
|
250
|
+
}
|
|
251
|
+
exports.FcrPrivilegedAnnotationControlImpl = FcrPrivilegedAnnotationControlImpl;
|
|
252
|
+
_staticBlock();
|
|
@@ -1,6 +1,12 @@
|
|
|
1
1
|
import { FcrBaseWhiteboardControl } from '../../whiteboard-control/types';
|
|
2
|
+
import { FcrJoinRoomOptions, FcrWhiteboardPermissionFlag } from '../../../imports';
|
|
3
|
+
export declare const ANNOTATION_APP_ID = "Annotation";
|
|
2
4
|
export interface FcrAnnotationControl extends FcrBaseWhiteboardControl {
|
|
3
|
-
|
|
5
|
+
addPermission(permission: FcrWhiteboardPermissionFlag): void;
|
|
6
|
+
removePermission(permission: FcrWhiteboardPermissionFlag): void;
|
|
7
|
+
}
|
|
8
|
+
export interface FcrPrivilegedAnnotationControl extends FcrAnnotationControl {
|
|
9
|
+
syncScreenShareOwnerAnnotationOpenDone(): void;
|
|
4
10
|
}
|
|
5
11
|
export interface FcrAnnotationBoardConfig {
|
|
6
12
|
state: number;
|
|
@@ -19,7 +25,9 @@ export interface FcrAnnotationBoardConfig {
|
|
|
19
25
|
region: string;
|
|
20
26
|
};
|
|
21
27
|
}
|
|
22
|
-
export
|
|
28
|
+
export type FcrAnnotationConfig = {
|
|
29
|
+
userId: string;
|
|
30
|
+
nickName: string;
|
|
23
31
|
size: {
|
|
24
32
|
width: number;
|
|
25
33
|
height: number;
|
|
@@ -28,6 +36,10 @@ export interface FcrAnnotationBoardSceneInfo {
|
|
|
28
36
|
boardAppId: string;
|
|
29
37
|
boardId: string;
|
|
30
38
|
boardToken: string;
|
|
31
|
-
region:
|
|
39
|
+
region: FcrJoinRoomOptions['sdkConfig']['region'];
|
|
32
40
|
};
|
|
41
|
+
};
|
|
42
|
+
export interface FcrAnnotationControlFactory {
|
|
43
|
+
createForSubProcess(config: FcrAnnotationConfig): FcrAnnotationControl;
|
|
44
|
+
createForMainProcess(): FcrPrivilegedAnnotationControl;
|
|
33
45
|
}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { FcrBoardActiveInfo, FcrBoardMainWindow } from '../whiteboard-control/types';
|
|
1
|
+
import { FcrBaseWhiteboardControl, FcrBoardActiveInfo, FcrBoardMainWindow } from '../whiteboard-control/types';
|
|
2
2
|
import { AgoraRteEngine, AgoraRteScene } from '../../imports';
|
|
3
3
|
import { FcrCoreServiceApi } from '../../service/api';
|
|
4
4
|
import { FcrConnectionState } from '../../type';
|
|
5
5
|
import { FcrSharedCache } from '../shared-cache';
|
|
6
|
-
import {
|
|
7
|
-
export declare class FcrWhiteboardControlImpl implements
|
|
6
|
+
import { FcrWhiteboardObserver } from './whiteboard-control/type';
|
|
7
|
+
export declare class FcrWhiteboardControlImpl implements FcrBaseWhiteboardControl {
|
|
8
8
|
private _scene;
|
|
9
9
|
private _api;
|
|
10
10
|
private _engine;
|