From 47ae119279a8b802de3d814b67d4ed1791982618 Mon Sep 17 00:00:00 2001 From: Tina Harter Date: Fri, 30 Aug 2024 11:41:30 -0500 Subject: [PATCH 1/2] fix lobby admitall button bug --- Project/src/MakeCall/CallCard.js | 26 +++++++++++++-- Project/src/MakeCall/Lobby.js | 56 ++++++++++---------------------- 2 files changed, 42 insertions(+), 40 deletions(-) diff --git a/Project/src/MakeCall/CallCard.js b/Project/src/MakeCall/CallCard.js index be8e746..7b5c030 100644 --- a/Project/src/MakeCall/CallCard.js +++ b/Project/src/MakeCall/CallCard.js @@ -43,6 +43,7 @@ export default class CallCard extends React.Component { this.dominantSpeakersFeature = this.call.feature(Features.DominantSpeakers); this.recordingFeature = this.call.feature(Features.Recording); this.transcriptionFeature = this.call.feature(Features.Transcription); + this.lobby = this.call.lobby; if (Features.Reaction) { this.meetingReaction = this.call.feature(Features.Reaction); } @@ -100,7 +101,8 @@ export default class CallCard extends React.Component { reactionRows:[], pptLiveActive: false, isRecordingActive: false, - isTranscriptionActive: false + isTranscriptionActive: false, + lobbyParticipantsCount: this.lobby?.participants.length }; this.selectedRemoteParticipants = new Set(); this.dataChannelRef = React.createRef(); @@ -129,6 +131,7 @@ export default class CallCard extends React.Component { this.call.feature(Features.RaiseHand).off('loweredHandEvent', this.raiseHandChangedHandler); this.recordingFeature.off('isRecordingActiveChanged', this.isRecordingActiveChangedHandler); this.transcriptionFeature.off('isTranscriptionActiveChanged', this.isTranscriptionActiveChangedHandler); + this.call.lobby?.off('lobbyParticipantsUpdated', () => { }); if (Features.Reaction) { this.call.feature(Features.Reaction).off('reaction', this.reactionChangeHandler); } @@ -463,6 +466,7 @@ export default class CallCard extends React.Component { this.pptLiveFeature?.on('isActiveChanged', this.pptLiveChangedHandler); this.recordingFeature.on('isRecordingActiveChanged', this.isRecordingActiveChangedHandler); this.transcriptionFeature.on('isTranscriptionActiveChanged', this.isTranscriptionActiveChangedHandler); + this.lobby?.on('lobbyParticipantsUpdated', this.lobbyParticipantsUpdatedHandler); } } @@ -532,6 +536,21 @@ export default class CallCard extends React.Component { this.setState({ isTranscriptionActive: this.transcriptionFeature.isTranscriptionActive }) } + lobbyParticipantsUpdatedHandler = (event) => { + console.log(`lobbyParticipantsUpdated, added=${event.added}, removed=${event.removed}`); + this.state.lobbyParticipantsCount = this.lobby?.participants.length; + if(event.added.length > 0) { + event.added.forEach(participant => { + console.log('lobbyParticipantAdded', participant); + }); + } + if(event.removed.length > 0) { + event.removed.forEach(participant => { + console.log('lobbyParticipantRemoved', participant); + }); + } + }; + raiseHandChangedHandler = (event) => { this.setState({isHandRaised: utils.isParticipantHandRaised(this.identifier, this.raiseHandFeature.getRaisedHands())}) } @@ -1169,7 +1188,10 @@ export default class CallCard extends React.Component { }
- + { + (this.state.lobbyParticipantsCount > 0) && + + }
{ this.state.dominantSpeakerMode && diff --git a/Project/src/MakeCall/Lobby.js b/Project/src/MakeCall/Lobby.js index 535898b..e5a747d 100644 --- a/Project/src/MakeCall/Lobby.js +++ b/Project/src/MakeCall/Lobby.js @@ -8,38 +8,23 @@ export default class Lobby extends React.Component { super(props); this.call = props.call; this.lobby = this.call.lobby; - this.capabilitiesFeature = props.capabilitiesFeature; this.capabilities = this.capabilitiesFeature.capabilities; this.state = { canManageLobby: this.capabilities.manageLobby?.isPresent || this.capabilities.manageLobby?.reason === 'FeatureNotSupported', - lobbyParticipantsCount: this.lobby.participants.length + lobbyParticipantsCount: props.lobbyParticipantsCount }; } - componentWillUnmount() { - this.lobby?.off('lobbyParticipantsUpdated', () => { }); - } - componentDidMount() { - this.lobby?.on('lobbyParticipantsUpdated', this.lobbyParticipantsUpdatedHandler); this.capabilitiesFeature.on('capabilitiesChanged', this.capabilitiesChangedHandler); } - lobbyParticipantsUpdatedHandler = (event) => { - console.log(`lobbyParticipantsUpdated, added=${event.added}, removed=${event.removed}`); - this.state.lobbyParticipantsCount = this.lobby?.participants.length; - if(event.added.length > 0) { - event.added.forEach(participant => { - console.log('lobbyParticipantAdded', participant); - }); - } - if(event.removed.length > 0) { - event.removed.forEach(participant => { - console.log('lobbyParticipantRemoved', participant); - }); + componentWillReceiveProps(nextProps) { + if (nextProps.lobbyParticipantsCount !== this.state.lobbyParticipantsCount) { + this.setState({ lobbyParticipantsCount: nextProps.lobbyParticipantsCount }); } - }; + } capabilitiesChangedHandler = (capabilitiesChangeInfo) => { console.log('lobby:capabilitiesChanged'); @@ -68,24 +53,19 @@ export default class Lobby extends React.Component { render() { return ( -
- { - (this.state.lobbyParticipantsCount > 0) && -
-
-
In-Lobby participants number: {this.state.lobbyParticipantsCount}
-
-
- this.admitAllParticipants()}> - -
-
- } +
+
+
In-Lobby participants number: {this.state.lobbyParticipantsCount}
+
+
+ this.admitAllParticipants()}> + +
); } From 5ab4aac635fb4a95cb73de6f48e2a81d6e134376 Mon Sep 17 00:00:00 2001 From: Tina Harter Date: Thu, 5 Sep 2024 16:40:10 -0500 Subject: [PATCH 2/2] Address comment --- Project/src/MakeCall/CallCard.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Project/src/MakeCall/CallCard.js b/Project/src/MakeCall/CallCard.js index 7b5c030..5a6d759 100644 --- a/Project/src/MakeCall/CallCard.js +++ b/Project/src/MakeCall/CallCard.js @@ -131,7 +131,7 @@ export default class CallCard extends React.Component { this.call.feature(Features.RaiseHand).off('loweredHandEvent', this.raiseHandChangedHandler); this.recordingFeature.off('isRecordingActiveChanged', this.isRecordingActiveChangedHandler); this.transcriptionFeature.off('isTranscriptionActiveChanged', this.isTranscriptionActiveChangedHandler); - this.call.lobby?.off('lobbyParticipantsUpdated', () => { }); + this.lobby?.off('lobbyParticipantsUpdated', () => { }); if (Features.Reaction) { this.call.feature(Features.Reaction).off('reaction', this.reactionChangeHandler); }