fcr-core 3.4.0
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/base-session.d.ts +3 -0
- package/lib/base-session.js +8 -0
- package/lib/chat-connection/config.d.ts +51 -0
- package/lib/chat-connection/config.js +105 -0
- package/lib/chat-connection/index.d.ts +25 -0
- package/lib/chat-connection/index.js +118 -0
- package/lib/chat-connection/type.d.ts +17 -0
- package/lib/chat-connection/type.js +12 -0
- package/lib/engine/index.d.ts +86 -0
- package/lib/engine/index.js +317 -0
- package/lib/imports.d.ts +43 -0
- package/lib/imports.js +322 -0
- package/lib/index.d.ts +22 -0
- package/lib/index.js +140 -0
- package/lib/media-control/desktop.d.ts +1 -0
- package/lib/media-control/desktop.js +120 -0
- package/lib/media-control/mobile.d.ts +1 -0
- package/lib/media-control/mobile.js +168 -0
- package/lib/media-control/type.d.ts +640 -0
- package/lib/media-control/type.js +5 -0
- package/lib/monitor-control/index.d.ts +1 -0
- package/lib/monitor-control/index.js +22 -0
- package/lib/monitor-control/type.d.ts +16 -0
- package/lib/monitor-control/type.js +5 -0
- package/lib/peer-session/index.d.ts +1 -0
- package/lib/peer-session/index.js +286 -0
- package/lib/peer-session/type.d.ts +54 -0
- package/lib/peer-session/type.js +5 -0
- package/lib/plugins/chatroom.d.ts +1 -0
- package/lib/plugins/chatroom.js +331 -0
- package/lib/plugins/electron-rtc-plugin.d.ts +1 -0
- package/lib/plugins/electron-rtc-plugin.js +13 -0
- package/lib/plugins/rtm-plugin.d.ts +1 -0
- package/lib/plugins/rtm-plugin.js +13 -0
- package/lib/plugins/web-rtc-plugin.d.ts +1 -0
- package/lib/plugins/web-rtc-plugin.js +13 -0
- package/lib/room-control/chatroom-control/config.d.ts +51 -0
- package/lib/room-control/chatroom-control/config.js +105 -0
- package/lib/room-control/chatroom-control/index.d.ts +1 -0
- package/lib/room-control/chatroom-control/index.js +323 -0
- package/lib/room-control/chatroom-control/type.d.ts +95 -0
- package/lib/room-control/chatroom-control/type.js +18 -0
- package/lib/room-control/group-control/index.d.ts +25 -0
- package/lib/room-control/group-control/index.js +227 -0
- package/lib/room-control/index.d.ts +1 -0
- package/lib/room-control/index.js +459 -0
- package/lib/room-control/interpreter-control/index.d.ts +1 -0
- package/lib/room-control/interpreter-control/index.js +136 -0
- package/lib/room-control/interpreter-control/room.d.ts +1 -0
- package/lib/room-control/interpreter-control/room.js +22 -0
- package/lib/room-control/interpreter-control/types.d.ts +66 -0
- package/lib/room-control/interpreter-control/types.js +32 -0
- package/lib/room-control/mainroom-control/index.d.ts +1 -0
- package/lib/room-control/mainroom-control/index.js +181 -0
- package/lib/room-control/privilege-control/helper.d.ts +9 -0
- package/lib/room-control/privilege-control/helper.js +43 -0
- package/lib/room-control/privilege-control/index.d.ts +1 -0
- package/lib/room-control/privilege-control/index.js +245 -0
- package/lib/room-control/privilege-control/type.d.ts +293 -0
- package/lib/room-control/privilege-control/type.js +141 -0
- package/lib/room-control/room-connector-control/index.d.ts +1 -0
- package/lib/room-control/room-connector-control/index.js +160 -0
- package/lib/room-control/room-connector-control/type.d.ts +102 -0
- package/lib/room-control/room-connector-control/type.js +34 -0
- package/lib/room-control/room-session/index.d.ts +1 -0
- package/lib/room-control/room-session/index.js +286 -0
- package/lib/room-control/room-session/type.d.ts +61 -0
- package/lib/room-control/room-session/type.js +5 -0
- package/lib/room-control/stream-control/index.d.ts +1 -0
- package/lib/room-control/stream-control/index.js +341 -0
- package/lib/room-control/stream-control/type.d.ts +209 -0
- package/lib/room-control/stream-control/type.js +5 -0
- package/lib/room-control/type.d.ts +281 -0
- package/lib/room-control/type.js +23 -0
- package/lib/room-control/user-control/index.d.ts +1 -0
- package/lib/room-control/user-control/index.js +318 -0
- package/lib/room-control/user-control/type.d.ts +177 -0
- package/lib/room-control/user-control/type.js +17 -0
- package/lib/room-control/waitingroom-control/index.d.ts +1 -0
- package/lib/room-control/waitingroom-control/index.js +46 -0
- package/lib/room-control/whiteboard-control/board-window.d.ts +47 -0
- package/lib/room-control/whiteboard-control/board-window.js +396 -0
- package/lib/room-control/whiteboard-control/enums.d.ts +164 -0
- package/lib/room-control/whiteboard-control/enums.js +96 -0
- package/lib/room-control/whiteboard-control/index.d.ts +1 -0
- package/lib/room-control/whiteboard-control/index.js +342 -0
- package/lib/room-control/whiteboard-control/mount-manager.d.ts +4 -0
- package/lib/room-control/whiteboard-control/mount-manager.js +15 -0
- package/lib/room-control/whiteboard-control/types.d.ts +330 -0
- package/lib/room-control/whiteboard-control/types.js +12 -0
- package/lib/room-control/whiteboard-control/utils.d.ts +51 -0
- package/lib/room-control/whiteboard-control/utils.js +273 -0
- package/lib/room-control/whiteboard-control-v2/index.d.ts +35 -0
- package/lib/room-control/whiteboard-control-v2/index.js +242 -0
- package/lib/room-control/whiteboard-control-v2/main-window.d.ts +33 -0
- package/lib/room-control/whiteboard-control-v2/main-window.js +213 -0
- package/lib/room-control/whiteboard-control-v2/utils.d.ts +3 -0
- package/lib/room-control/whiteboard-control-v2/utils.js +39 -0
- package/lib/service/api.d.ts +401 -0
- package/lib/service/api.js +924 -0
- package/lib/service/type.d.ts +7 -0
- package/lib/service/type.js +5 -0
- package/lib/type.d.ts +254 -0
- package/lib/type.js +87 -0
- package/lib/utilities/cmd.d.ts +1 -0
- package/lib/utilities/cmd.js +7 -0
- package/lib/utilities/collection.d.ts +22 -0
- package/lib/utilities/collection.js +74 -0
- package/lib/utilities/error.d.ts +41 -0
- package/lib/utilities/error.js +68 -0
- package/lib/utilities/package-info.d.ts +1 -0
- package/lib/utilities/package-info.js +12 -0
- package/lib/utilities/parameters.d.ts +9 -0
- package/lib/utilities/parameters.js +30 -0
- package/lib/utilities/stream.d.ts +27 -0
- package/lib/utilities/stream.js +34 -0
- package/lib/utilities/user.d.ts +7 -0
- package/lib/utilities/user.js +34 -0
- package/package.json +98 -0
|
@@ -0,0 +1,331 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
require("core-js/modules/es.array.push.js");
|
|
4
|
+
require("core-js/modules/esnext.async-iterator.filter.js");
|
|
5
|
+
require("core-js/modules/esnext.async-iterator.for-each.js");
|
|
6
|
+
require("core-js/modules/esnext.iterator.constructor.js");
|
|
7
|
+
require("core-js/modules/esnext.iterator.filter.js");
|
|
8
|
+
require("core-js/modules/esnext.iterator.for-each.js");
|
|
9
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
10
|
+
Object.defineProperty(exports, "__esModule", {
|
|
11
|
+
value: true
|
|
12
|
+
});
|
|
13
|
+
exports.FcrChatRoomControlImpl = void 0;
|
|
14
|
+
require("core-js/modules/es.error.cause.js");
|
|
15
|
+
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
16
|
+
var _imports = require("../imports");
|
|
17
|
+
var _observable = require("agora-foundation/lib/utilities/observable");
|
|
18
|
+
var _easemobWebsdk = _interopRequireDefault(require("easemob-websdk"));
|
|
19
|
+
var _user = require("../utilities/user");
|
|
20
|
+
var _error = require("../utilities/error");
|
|
21
|
+
var _type = require("../room-control/chatroom-control/type");
|
|
22
|
+
var _type2 = require("../chat-connection/type");
|
|
23
|
+
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; }
|
|
24
|
+
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; }
|
|
25
|
+
/**
|
|
26
|
+
* @internal
|
|
27
|
+
*/
|
|
28
|
+
class FcrChatRoomControlImpl {
|
|
29
|
+
_setConnectionState(state) {
|
|
30
|
+
this._connectionState = state;
|
|
31
|
+
this._observable.notifyObservers('onConnectionStateUpdated', this._scene.sceneId, state);
|
|
32
|
+
}
|
|
33
|
+
get conn() {
|
|
34
|
+
if (!this._chatConnection.getConnectionInstance()) {
|
|
35
|
+
throw (0, _error.generateFcrCoreClientError)(_error.FcrErrorModuleCode.ROOM_CHATROOM, _error.FcrErrorCode.UNDEFINED_ERROR, 'chat room connection not initialized, please get chat room token first', new Error('chat room connection not initialized, please get chat room token first'));
|
|
36
|
+
}
|
|
37
|
+
return this._chatConnection.getConnectionInstance();
|
|
38
|
+
}
|
|
39
|
+
get chatRoomId() {
|
|
40
|
+
return this._scene.getScenePropertiesByKeyPath('widgets.easemobIM.extra.chatRoomId');
|
|
41
|
+
}
|
|
42
|
+
constructor(_scene, _chatConnection) {
|
|
43
|
+
(0, _defineProperty2.default)(this, "logger", (0, _imports.getLogger)());
|
|
44
|
+
(0, _defineProperty2.default)(this, "_observable", new _observable.AgoraObservable());
|
|
45
|
+
(0, _defineProperty2.default)(this, "_connectionState", _type.FcrChatRoomConnectionState.Disconnected);
|
|
46
|
+
(0, _defineProperty2.default)(this, "_chatConnectionObserver", {
|
|
47
|
+
onConnectionStateUpdated: async state => {
|
|
48
|
+
// im reconnect
|
|
49
|
+
if (state === _type2.FcrChatConnectionState.DISCONNECTED && this.getConnectionState() === _type.FcrChatRoomConnectionState.Connected) {
|
|
50
|
+
this._setConnectionState(_type.FcrChatRoomConnectionState.Disconnected);
|
|
51
|
+
} else if (state === _type2.FcrChatConnectionState.CONNECTED && this.getConnectionState() !== _type.FcrChatRoomConnectionState.Connected) {
|
|
52
|
+
this._removeEventListener();
|
|
53
|
+
this._addEventListener();
|
|
54
|
+
await this._joinChatRoom(state);
|
|
55
|
+
}
|
|
56
|
+
},
|
|
57
|
+
onConnectionLoginSuccess: () => {
|
|
58
|
+
this._addEventListener();
|
|
59
|
+
}
|
|
60
|
+
});
|
|
61
|
+
(0, _defineProperty2.default)(this, "_joinChatRoom", async state => {
|
|
62
|
+
if (state === _type2.FcrChatConnectionState.CONNECTED && this.getConnectionState() === _type.FcrChatRoomConnectionState.Disconnected && this.chatRoomId) {
|
|
63
|
+
this._setConnectionState(_type.FcrChatRoomConnectionState.Connecting);
|
|
64
|
+
await this.conn.joinChatRoom({
|
|
65
|
+
roomId: this.chatRoomId
|
|
66
|
+
});
|
|
67
|
+
this._setConnectionState(_type.FcrChatRoomConnectionState.Connected);
|
|
68
|
+
}
|
|
69
|
+
});
|
|
70
|
+
(0, _defineProperty2.default)(this, "_convertAgoraChatMessageToFcrChatRoomReceiveMessage", msg => {
|
|
71
|
+
// TODO: 没看到有 contentsType 字段
|
|
72
|
+
//@ts-ignore
|
|
73
|
+
switch (msg.type) {
|
|
74
|
+
case 'txt':
|
|
75
|
+
{
|
|
76
|
+
const message = {
|
|
77
|
+
id: msg.id,
|
|
78
|
+
//@ts-ignore
|
|
79
|
+
from: msg.ext.sender,
|
|
80
|
+
type: _type.FcrChatRoomMessageType.Text,
|
|
81
|
+
//@ts-ignore
|
|
82
|
+
timestamp: parseInt(msg.time),
|
|
83
|
+
//@ts-ignore
|
|
84
|
+
content: msg.msg,
|
|
85
|
+
//@ts-ignore
|
|
86
|
+
isPrivate: msg.ext.isPrivate
|
|
87
|
+
};
|
|
88
|
+
return message;
|
|
89
|
+
}
|
|
90
|
+
// TODO: 3.x
|
|
91
|
+
// case 'IMAGE': {
|
|
92
|
+
// const message: FcrChatRoomReceiveImageMessage = {
|
|
93
|
+
// id: msg.id,
|
|
94
|
+
// //@ts-ignore
|
|
95
|
+
// from: msg.ext.sender,
|
|
96
|
+
// type: FcrChatRoomMessageType.Image,
|
|
97
|
+
// //@ts-ignore
|
|
98
|
+
// timestamp: parseInt(msg.time),
|
|
99
|
+
// //@ts-ignore
|
|
100
|
+
// file: msg.url,
|
|
101
|
+
// //@ts-ignore
|
|
102
|
+
// isPrivate: msg.ext.isPrivate,
|
|
103
|
+
// };
|
|
104
|
+
// return message;
|
|
105
|
+
// }
|
|
106
|
+
}
|
|
107
|
+
throw (0, _error.generateFcrCoreClientError)(_error.FcrErrorModuleCode.ROOM_CHATROOM, _error.FcrErrorCode.UNDEFINED_ERROR, 'unknown remote message type', new Error('unknown remote message type'));
|
|
108
|
+
});
|
|
109
|
+
(0, _defineProperty2.default)(this, "_convertFcrChatRoomSendBaseMessageToAgoraChatMessage", msg => {
|
|
110
|
+
var _message$to;
|
|
111
|
+
switch (msg.type) {
|
|
112
|
+
case _type.FcrChatRoomMessageType.Text:
|
|
113
|
+
const message = msg;
|
|
114
|
+
const isPrivate = !!((_message$to = message.to) !== null && _message$to !== void 0 && _message$to.length);
|
|
115
|
+
const localUserInfo = this._scene.getUser(this._scene.getLocalUser().getLocalUserId());
|
|
116
|
+
return _easemobWebsdk.default.message.create({
|
|
117
|
+
to: this.chatRoomId,
|
|
118
|
+
msg: message.content,
|
|
119
|
+
type: 'txt',
|
|
120
|
+
chatType: 'chatRoom',
|
|
121
|
+
ext: {
|
|
122
|
+
sender: (0, _user.convertRteUserToFcrUser)(localUserInfo),
|
|
123
|
+
roomUuid: this._scene.sceneId,
|
|
124
|
+
isPrivate
|
|
125
|
+
},
|
|
126
|
+
receiverList: message.to
|
|
127
|
+
});
|
|
128
|
+
}
|
|
129
|
+
throw (0, _error.generateFcrCoreClientError)(_error.FcrErrorModuleCode.ROOM_CHATROOM, _error.FcrErrorCode.UNDEFINED_ERROR, 'unknown local message type', new Error('unknown local message type'));
|
|
130
|
+
});
|
|
131
|
+
this._scene = _scene;
|
|
132
|
+
this._chatConnection = _chatConnection;
|
|
133
|
+
this._chatConnection.addObserver(this._chatConnectionObserver);
|
|
134
|
+
if (this._chatConnection.getConnectionInstance()) {
|
|
135
|
+
this._addEventListener();
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
async join() {
|
|
139
|
+
await this._joinChatRoom(this._chatConnection.getConnectionState());
|
|
140
|
+
}
|
|
141
|
+
_removeEventListener() {
|
|
142
|
+
this.conn.removeEventHandler("chatroom".concat(this._scene.sceneId));
|
|
143
|
+
}
|
|
144
|
+
_addEventListener() {
|
|
145
|
+
this._removeEventListener();
|
|
146
|
+
this.conn.addEventHandler("chatroom".concat(this._scene.sceneId), {
|
|
147
|
+
onTextMessage: msg => {
|
|
148
|
+
if (msg.to !== this.chatRoomId) {
|
|
149
|
+
return;
|
|
150
|
+
}
|
|
151
|
+
const message = this._convertAgoraChatMessageToFcrChatRoomReceiveMessage(msg);
|
|
152
|
+
this._observable.notifyObservers('onTextMessageReceived', this._scene.sceneId, message);
|
|
153
|
+
}
|
|
154
|
+
});
|
|
155
|
+
// TODO: 3.x
|
|
156
|
+
// this.conn.onPictureMessage = (msg) => {
|
|
157
|
+
// if (msg.to !== this.initConfig.chatRoomId) {
|
|
158
|
+
// return;
|
|
159
|
+
// }
|
|
160
|
+
// const message: FcrChatRoomReceiveImageMessage =
|
|
161
|
+
// this._convertAgoraChatMessageToFcrChatRoomReceiveMessage(
|
|
162
|
+
// msg,
|
|
163
|
+
// ) as FcrChatRoomReceiveImageMessage;
|
|
164
|
+
// this._observable.notifyObservers('onImageMessageReceived', this._scene.sceneId, message);
|
|
165
|
+
// };
|
|
166
|
+
|
|
167
|
+
// TODO: 3.x
|
|
168
|
+
// this.conn.onCmdMessage = (msg) => {
|
|
169
|
+
// if (msg.to !== this.initConfig.chatRoomId) {
|
|
170
|
+
// return;
|
|
171
|
+
// }
|
|
172
|
+
// const message: FcrChatRoomReceiveCustomMessage =
|
|
173
|
+
// this._convertAgoraChatMessageToFcrChatRoomReceiveMessage(msg);
|
|
174
|
+
// this._observable.notifyObservers('onCustomMessageReceived', this._scene.sceneId, message);
|
|
175
|
+
// };
|
|
176
|
+
|
|
177
|
+
// TODO: 3.x
|
|
178
|
+
// this.conn.onChatroomEvent = (eventData: EasemobChat.ChatroomEvent) => {
|
|
179
|
+
// if (eventData.operation === 'updateAnnouncement') {
|
|
180
|
+
// this._observable.notifyObservers(
|
|
181
|
+
// 'onAnnouncementUpdated',
|
|
182
|
+
// this._scene.sceneId,
|
|
183
|
+
// // TODO: 应该用什么字段传递?
|
|
184
|
+
// (eventData.attributes as { [key: string]: string })?.announcement,
|
|
185
|
+
// );
|
|
186
|
+
// } else if (eventData.operation === 'deleteAnnouncement') {
|
|
187
|
+
// this._observable.notifyObservers('onAnnouncementDeleted', this._scene.sceneId);
|
|
188
|
+
// }
|
|
189
|
+
// };
|
|
190
|
+
}
|
|
191
|
+
getConnectionState() {
|
|
192
|
+
return this._connectionState;
|
|
193
|
+
}
|
|
194
|
+
async sendMessage(message) {
|
|
195
|
+
var _message$to2;
|
|
196
|
+
const msg = this._convertFcrChatRoomSendBaseMessageToAgoraChatMessage(message);
|
|
197
|
+
await this.conn.send(msg);
|
|
198
|
+
const localUserInfo = this._scene.getUser(this._scene.getLocalUser().getLocalUserId());
|
|
199
|
+
const res = _objectSpread(_objectSpread({}, message.type === _type.FcrChatRoomMessageType.Text ? {
|
|
200
|
+
content: message.content
|
|
201
|
+
} : {
|
|
202
|
+
file: message.file
|
|
203
|
+
}), {}, {
|
|
204
|
+
from: (0, _user.convertRteUserToFcrUser)(localUserInfo),
|
|
205
|
+
id: msg.id,
|
|
206
|
+
type: _type.FcrChatRoomMessageType.Text,
|
|
207
|
+
properties: message.properties,
|
|
208
|
+
timestamp: Date.now(),
|
|
209
|
+
isPrivate: !!((_message$to2 = message.to) !== null && _message$to2 !== void 0 && _message$to2.length)
|
|
210
|
+
});
|
|
211
|
+
return res;
|
|
212
|
+
}
|
|
213
|
+
addObserver(observer) {
|
|
214
|
+
this._observable.addObserver(observer);
|
|
215
|
+
}
|
|
216
|
+
removeObserver(observer) {
|
|
217
|
+
this._observable.removeObserver(observer);
|
|
218
|
+
}
|
|
219
|
+
async leave() {
|
|
220
|
+
await new Promise(async (resolve, reject) => {
|
|
221
|
+
this._removeEventListener();
|
|
222
|
+
try {
|
|
223
|
+
await this.conn.leaveChatRoom({
|
|
224
|
+
roomId: this.chatRoomId,
|
|
225
|
+
success: () => {
|
|
226
|
+
resolve(undefined);
|
|
227
|
+
},
|
|
228
|
+
error: e => {
|
|
229
|
+
reject((0, _error.generateFcrCoreClientError)(_error.FcrErrorModuleCode.ROOM_CHATROOM, _error.FcrErrorCode.UNDEFINED_ERROR, 'leave chat room failed', e));
|
|
230
|
+
}
|
|
231
|
+
});
|
|
232
|
+
} catch (e) {
|
|
233
|
+
resolve(undefined);
|
|
234
|
+
}
|
|
235
|
+
});
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
// TODO: 3.x
|
|
239
|
+
// /**
|
|
240
|
+
// *
|
|
241
|
+
// * @param pageSize max 50
|
|
242
|
+
// * @param startedMessageId
|
|
243
|
+
// * @returns
|
|
244
|
+
// */
|
|
245
|
+
// async getHistoryMessageList(
|
|
246
|
+
// pageSize: number,
|
|
247
|
+
// startedMessageId: string,
|
|
248
|
+
// ): Promise<Array<FcrChatRoomReceiveBaseMessage>> {
|
|
249
|
+
// if (pageSize > 50) {
|
|
250
|
+
// throw generateFcrCoreClientError(
|
|
251
|
+
// FcrErrorModuleCode.ROOM_CHATROOM,
|
|
252
|
+
// FcrErrorCode.UNDEFINED_ERROR,
|
|
253
|
+
// 'pageSize should be less than 50',
|
|
254
|
+
// new Error('pageSize should be less than 50'),
|
|
255
|
+
// );
|
|
256
|
+
// }
|
|
257
|
+
|
|
258
|
+
// const assembleRet = await this.conn.fetchHistoryMessages({
|
|
259
|
+
// queue: this.initConfig.chatRoomId,
|
|
260
|
+
// isGroup: true,
|
|
261
|
+
// count: pageSize,
|
|
262
|
+
// start: startedMessageId,
|
|
263
|
+
// fail(error) {
|
|
264
|
+
// throw generateFcrCoreClientError(
|
|
265
|
+
// FcrErrorModuleCode.ROOM_CHATROOM,
|
|
266
|
+
// FcrErrorCode.UNDEFINED_ERROR,
|
|
267
|
+
// error.message,
|
|
268
|
+
// new Error('get history message list failed'),
|
|
269
|
+
// );
|
|
270
|
+
// },
|
|
271
|
+
// });
|
|
272
|
+
|
|
273
|
+
// const ret: FcrChatRoomReceiveBaseMessage[] = assembleRet.map((msgBody) => {
|
|
274
|
+
// return this._convertAgoraChatMessageToFcrChatRoomReceiveMessage(msgBody);
|
|
275
|
+
// });
|
|
276
|
+
// return ret;
|
|
277
|
+
// }
|
|
278
|
+
|
|
279
|
+
// TODO: 3.x
|
|
280
|
+
// async getAnnouncement(): Promise<string> {
|
|
281
|
+
// const announcement = await this.conn.fetchChatRoomAnnouncement({
|
|
282
|
+
// roomId: this.initConfig.chatRoomId,
|
|
283
|
+
// error: (e) => {
|
|
284
|
+
// throw generateFcrCoreClientError(
|
|
285
|
+
// FcrErrorModuleCode.ROOM_CHATROOM,
|
|
286
|
+
// FcrErrorCode.UNDEFINED_ERROR,
|
|
287
|
+
// e.message,
|
|
288
|
+
// new Error('get announcement failed'),
|
|
289
|
+
// );
|
|
290
|
+
// },
|
|
291
|
+
// });
|
|
292
|
+
|
|
293
|
+
// return announcement.data?.announcement || '';
|
|
294
|
+
// }
|
|
295
|
+
|
|
296
|
+
// TODO: 3.x
|
|
297
|
+
// async setAnnouncement(announcement: string) {
|
|
298
|
+
// await this.conn.updateChatRoomAnnouncement({
|
|
299
|
+
// roomId: this.initConfig.chatRoomId,
|
|
300
|
+
// announcement,
|
|
301
|
+
// success: (_) => {},
|
|
302
|
+
// error: (e) => {
|
|
303
|
+
// throw generateFcrCoreClientError(
|
|
304
|
+
// FcrErrorModuleCode.ROOM_CHATROOM,
|
|
305
|
+
// FcrErrorCode.UNDEFINED_ERROR,
|
|
306
|
+
// e.message,
|
|
307
|
+
// new Error('set announcement failed'),
|
|
308
|
+
// );
|
|
309
|
+
// },
|
|
310
|
+
// });
|
|
311
|
+
// }
|
|
312
|
+
|
|
313
|
+
// TODO: 3.x
|
|
314
|
+
// async deleteAnnouncement() {
|
|
315
|
+
// await this.conn.updateChatRoomAnnouncement({
|
|
316
|
+
// roomId: this.initConfig.chatRoomId,
|
|
317
|
+
// announcement: '',
|
|
318
|
+
// success: (_) => {},
|
|
319
|
+
// error: (e) => {
|
|
320
|
+
// const { message } = e;
|
|
321
|
+
// throw generateFcrCoreClientError(
|
|
322
|
+
// FcrErrorModuleCode.ROOM_CHATROOM,
|
|
323
|
+
// FcrErrorCode.UNDEFINED_ERROR,
|
|
324
|
+
// message,
|
|
325
|
+
// new Error('delete announcement failed'),
|
|
326
|
+
// );
|
|
327
|
+
// },
|
|
328
|
+
// });
|
|
329
|
+
// }
|
|
330
|
+
}
|
|
331
|
+
exports.FcrChatRoomControlImpl = FcrChatRoomControlImpl;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as ElectronRtcPlugin } from 'agora-rte-sdk/lib/plugin/rtc/electron';
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
Object.defineProperty(exports, "ElectronRtcPlugin", {
|
|
8
|
+
enumerable: true,
|
|
9
|
+
get: function () {
|
|
10
|
+
return _electron.default;
|
|
11
|
+
}
|
|
12
|
+
});
|
|
13
|
+
var _electron = _interopRequireDefault(require("agora-rte-sdk/lib/plugin/rtc/electron"));
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as RtmPlugin } from 'agora-rte-sdk/lib/plugin/rtm';
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
Object.defineProperty(exports, "RtmPlugin", {
|
|
8
|
+
enumerable: true,
|
|
9
|
+
get: function () {
|
|
10
|
+
return _rtm.default;
|
|
11
|
+
}
|
|
12
|
+
});
|
|
13
|
+
var _rtm = _interopRequireDefault(require("agora-rte-sdk/lib/plugin/rtm"));
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as WebRtcPlugin } from 'agora-rte-sdk/lib/plugin/rtc/web';
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
Object.defineProperty(exports, "WebRtcPlugin", {
|
|
8
|
+
enumerable: true,
|
|
9
|
+
get: function () {
|
|
10
|
+
return _web.default;
|
|
11
|
+
}
|
|
12
|
+
});
|
|
13
|
+
var _web = _interopRequireDefault(require("agora-rte-sdk/lib/plugin/rtc/web"));
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* git do not control webim.config.js
|
|
3
|
+
* everyone should copy webim.config.js.demo to webim.config.js
|
|
4
|
+
* and have their own configs.
|
|
5
|
+
* In this way , others won't be influenced by this config while git pull.
|
|
6
|
+
*/
|
|
7
|
+
declare const agoraChatConfig: {
|
|
8
|
+
Host: string;
|
|
9
|
+
https: boolean;
|
|
10
|
+
isHttpDNS: boolean;
|
|
11
|
+
isMultiLoginSessions: boolean;
|
|
12
|
+
/**
|
|
13
|
+
* @parameter {Boolean} true or false
|
|
14
|
+
*/
|
|
15
|
+
isSandBox: boolean;
|
|
16
|
+
/**
|
|
17
|
+
* Whether to console.log
|
|
18
|
+
* @parameter {Boolean} true or false
|
|
19
|
+
*/
|
|
20
|
+
isDebug: boolean;
|
|
21
|
+
/**
|
|
22
|
+
* will auto connect the websocket server autoReconnectNumMax times in background when client is offline.
|
|
23
|
+
* won't auto connect if autoReconnectNumMax=0.
|
|
24
|
+
*/
|
|
25
|
+
autoReconnectNumMax: number;
|
|
26
|
+
/**
|
|
27
|
+
* webrtc supports WebKit and https only
|
|
28
|
+
*/
|
|
29
|
+
useOwnUploadFun: boolean;
|
|
30
|
+
isAutoLogin: boolean;
|
|
31
|
+
/**
|
|
32
|
+
* Size of message cache for person to person
|
|
33
|
+
*/
|
|
34
|
+
p2pMessageCacheSize: number;
|
|
35
|
+
/**
|
|
36
|
+
* When a message arrived, the receiver send an ack message to the
|
|
37
|
+
* sender, in order to tell the sender the message has delivered.
|
|
38
|
+
* See call back function onReceivedMessage
|
|
39
|
+
*/
|
|
40
|
+
delivery: boolean;
|
|
41
|
+
/**
|
|
42
|
+
* Size of message cache for group chating like group, chatroom etc. For use in this demo
|
|
43
|
+
*/
|
|
44
|
+
groupMessageCacheSize: number;
|
|
45
|
+
/**
|
|
46
|
+
* enable localstorage for history messages. For use in this demo
|
|
47
|
+
*/
|
|
48
|
+
enableLocalStorage: boolean;
|
|
49
|
+
deviceId: string;
|
|
50
|
+
};
|
|
51
|
+
export { agoraChatConfig };
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.agoraChatConfig = void 0;
|
|
7
|
+
/**
|
|
8
|
+
* git do not control webim.config.js
|
|
9
|
+
* everyone should copy webim.config.js.demo to webim.config.js
|
|
10
|
+
* and have their own configs.
|
|
11
|
+
* In this way , others won't be influenced by this config while git pull.
|
|
12
|
+
*/
|
|
13
|
+
|
|
14
|
+
// for react native
|
|
15
|
+
// var location = {
|
|
16
|
+
// protocol: "https"
|
|
17
|
+
// }
|
|
18
|
+
|
|
19
|
+
const agoraChatConfig = exports.agoraChatConfig = {
|
|
20
|
+
/*
|
|
21
|
+
* websocket server
|
|
22
|
+
* im-api-v2.easemob.com/ws 线上环境
|
|
23
|
+
* im-api-v2-hsb.easemob.com/ws 沙箱环境
|
|
24
|
+
*/
|
|
25
|
+
// socketServer: getUrl().socketUrl, //(window.location.protocol === "https:" ? "https:" : "http:") + "//im-api-v2.easemob.com/ws",
|
|
26
|
+
/*
|
|
27
|
+
* Backend REST API URL
|
|
28
|
+
* a1.easemob.com 线上环境
|
|
29
|
+
* a1-hsb.easemob.com 沙箱环境
|
|
30
|
+
*/
|
|
31
|
+
// restServer: getUrl().apiUrl, //(window.location.protocol === "https:" ? "https:" : "http:") + "//a1.easemob.com",
|
|
32
|
+
/*
|
|
33
|
+
* Application AppKey
|
|
34
|
+
*/
|
|
35
|
+
// appkey: 'easemob-demo#cloudclass',
|
|
36
|
+
/*
|
|
37
|
+
* Application Host
|
|
38
|
+
*/
|
|
39
|
+
Host: 'easemob.com',
|
|
40
|
+
/*
|
|
41
|
+
* Whether to use HTTPS
|
|
42
|
+
* @parameter {Boolean} true or false
|
|
43
|
+
*/
|
|
44
|
+
https: true,
|
|
45
|
+
/*
|
|
46
|
+
* 公有云配置默认为 true,
|
|
47
|
+
* 私有云配置请设置 isHttpDNS = false , 详细文档:http://docs-im.easemob.com/im/web/other/privatedeploy
|
|
48
|
+
*/
|
|
49
|
+
isHttpDNS: true,
|
|
50
|
+
/*
|
|
51
|
+
* isMultiLoginSessions
|
|
52
|
+
* true: A visitor can sign in to multiple webpages and receive messages at all the webpages.
|
|
53
|
+
* false: A visitor can sign in to only one webpage and receive messages at the webpage.
|
|
54
|
+
*/
|
|
55
|
+
isMultiLoginSessions: true,
|
|
56
|
+
/**
|
|
57
|
+
* @parameter {Boolean} true or false
|
|
58
|
+
*/
|
|
59
|
+
isSandBox: false,
|
|
60
|
+
//内部测试环境,集成时设为false
|
|
61
|
+
/**
|
|
62
|
+
* Whether to console.log
|
|
63
|
+
* @parameter {Boolean} true or false
|
|
64
|
+
*/
|
|
65
|
+
isDebug: true,
|
|
66
|
+
/**
|
|
67
|
+
* will auto connect the websocket server autoReconnectNumMax times in background when client is offline.
|
|
68
|
+
* won't auto connect if autoReconnectNumMax=0.
|
|
69
|
+
*/
|
|
70
|
+
autoReconnectNumMax: 10,
|
|
71
|
+
/**
|
|
72
|
+
* webrtc supports WebKit and https only
|
|
73
|
+
*/
|
|
74
|
+
// isWebRTC: window.RTCPeerConnection && /^https\:$/.test(window.location.protocol),
|
|
75
|
+
/*
|
|
76
|
+
* Upload pictures or file to your own server and send message with url
|
|
77
|
+
* @parameter {Boolean} true or false
|
|
78
|
+
* true: Using the API provided by SDK to upload file to huanxin server
|
|
79
|
+
* false: Using your method to upload file to your own server
|
|
80
|
+
*/
|
|
81
|
+
useOwnUploadFun: false,
|
|
82
|
+
/*
|
|
83
|
+
* Set to auto sign-in
|
|
84
|
+
*/
|
|
85
|
+
isAutoLogin: false,
|
|
86
|
+
/**
|
|
87
|
+
* Size of message cache for person to person
|
|
88
|
+
*/
|
|
89
|
+
p2pMessageCacheSize: 500,
|
|
90
|
+
/**
|
|
91
|
+
* When a message arrived, the receiver send an ack message to the
|
|
92
|
+
* sender, in order to tell the sender the message has delivered.
|
|
93
|
+
* See call back function onReceivedMessage
|
|
94
|
+
*/
|
|
95
|
+
delivery: false,
|
|
96
|
+
/**
|
|
97
|
+
* Size of message cache for group chating like group, chatroom etc. For use in this demo
|
|
98
|
+
*/
|
|
99
|
+
groupMessageCacheSize: 200,
|
|
100
|
+
/**
|
|
101
|
+
* enable localstorage for history messages. For use in this demo
|
|
102
|
+
*/
|
|
103
|
+
enableLocalStorage: true,
|
|
104
|
+
deviceId: 'webim'
|
|
105
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|