Skip to content

Commit 34807ff

Browse files
feat(ts) migrate AVModeration to TS
1 parent cee13aa commit 34807ff

File tree

1 file changed

+13
-6
lines changed

1 file changed

+13
-6
lines changed
Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
import { getLogger } from '@jitsi/logger';
22
import { $msg } from 'strophe.js';
3-
43
import { MediaType } from '../../service/RTC/MediaType';
54
import { XMPPEvents } from '../../service/xmpp/XMPPEvents';
5+
import ChatRoom from './ChatRoom';
6+
import XMPP from './xmpp';
67

78
const logger = getLogger('modules/xmpp/AVModeration');
89

@@ -16,7 +17,13 @@ export default class AVModeration {
1617
*
1718
* @param {ChatRoom} room the main room.
1819
*/
19-
constructor(room) {
20+
private _xmpp: XMPP;
21+
private _mainRoom: ChatRoom;
22+
private _moderationEnabledByType: { audio: boolean; video: boolean; };
23+
private _whitelistAudio: any[];
24+
private _whitelistVideo: any[];
25+
26+
constructor(room: ChatRoom) {
2027
this._xmpp = room.xmpp;
2128

2229
this._mainRoom = room;
@@ -52,7 +59,7 @@ export default class AVModeration {
5259
/**
5360
* Enables or disables AV Moderation by sending a msg with command to the component.
5461
*/
55-
enable(state, mediaType) {
62+
enable(state: string, mediaType: MediaType) {
5663
if (!this.isSupported() || !this._mainRoom.isModerator()) {
5764
logger.error(`Cannot enable:${state} AV moderation supported:${this.isSupported()},
5865
moderator:${this._mainRoom.isModerator()}`);
@@ -80,7 +87,7 @@ export default class AVModeration {
8087
/**
8188
* Approves that a participant can unmute by sending a msg with its jid to the component.
8289
*/
83-
approve(mediaType, jid) {
90+
approve(mediaType: MediaType, jid: string) {
8491
if (!this.isSupported() || !this._mainRoom.isModerator()) {
8592
logger.error(`Cannot approve in AV moderation supported:${this.isSupported()},
8693
moderator:${this._mainRoom.isModerator()}`);
@@ -101,7 +108,7 @@ export default class AVModeration {
101108
/**
102109
* Rejects that a participant can unmute by sending a msg with its jid to the component.
103110
*/
104-
reject(mediaType, jid) {
111+
reject(mediaType: MediaType, jid: string) {
105112
if (!this.isSupported() || !this._mainRoom.isModerator()) {
106113
logger.error(`Cannot reject in AV moderation supported:${this.isSupported()},
107114
moderator:${this._mainRoom.isModerator()}`);
@@ -125,7 +132,7 @@ export default class AVModeration {
125132
* @param obj the parsed json content of the message to process.
126133
* @private
127134
*/
128-
_onMessage(obj) {
135+
_onMessage(obj: { actor: any; approved: any; enabled: any; mediaType: any; removed: any; whitelists: any; }) {
129136
const { removed, mediaType: media, enabled, approved, actor, whitelists: newWhitelists } = obj;
130137

131138
if (newWhitelists) {

0 commit comments

Comments
 (0)