Skip to content

Commit

Permalink
feat(raise-hand) group options in config.js
Browse files Browse the repository at this point in the history
  • Loading branch information
liumengyuan1997 authored Aug 9, 2024
1 parent ce22adf commit 8299aa4
Show file tree
Hide file tree
Showing 7 changed files with 75 additions and 5 deletions.
17 changes: 17 additions & 0 deletions config.js
Original file line number Diff line number Diff line change
Expand Up @@ -232,9 +232,26 @@ var config = {
// Sets the preferred resolution (height) for local video. Defaults to 720.
// resolution: 720,

// DEPRECATED. Please use raisedHands.disableRemoveRaisedHandOnFocus instead.
// Specifies whether the raised hand will hide when someone becomes a dominant speaker or not
// disableRemoveRaisedHandOnFocus: false,

// Specifies which raised hand related config should be set.
// raisedHands: {
// // Specifies whether the raised hand can be lowered by moderator.
// disableLowerHandByModerator: false,

// // Specifies whether there is a notification before hiding the raised hand
// // when someone becomes the dominant speaker.
// disableLowerHandNotification: true,

// // Specifies whether there is a notification when you are the next speaker in line.
// disableNextSpeakerNotification: false,

// // Specifies whether the raised hand will hide when someone becomes a dominant speaker or not.
// disableRemoveRaisedHandOnFocus: false,
// },

// speakerStats: {
// // Specifies whether the speaker stats is enable or not.
// disabled: false,
Expand Down
6 changes: 6 additions & 0 deletions react/features/base/config/configType.ts
Original file line number Diff line number Diff line change
Expand Up @@ -488,6 +488,12 @@ export interface IConfig {
hideExtraJoinButtons?: Array<string>;
};
prejoinPageEnabled?: boolean;
raisedHands?: {
disableLowerHandByModerator?: boolean;
disableLowerHandNotification?: boolean;
disableNextSpeakerNotification?: boolean;
disableRemoveRaisedHandOnFocus?: boolean;
};
readOnlyName?: boolean;
recordingLimit?: {
appName?: string;
Expand Down
1 change: 1 addition & 0 deletions react/features/base/config/configWhitelist.ts
Original file line number Diff line number Diff line change
Expand Up @@ -201,6 +201,7 @@ export default [
'preferVisitor',
'prejoinConfig',
'prejoinPageEnabled',
'raisedHands',
'recordingService',
'requireDisplayName',
'remoteVideoMenu',
Expand Down
32 changes: 31 additions & 1 deletion react/features/base/config/functions.any.ts
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,37 @@ export function getFeatureFlag(state: IReduxState, featureFlag: string) {
* @returns {boolean}
*/
export function getDisableRemoveRaisedHandOnFocus(state: IReduxState) {
return state['features/base/config']?.disableRemoveRaisedHandOnFocus || false;
return state['features/base/config']?.raisedHands?.disableRemoveRaisedHandOnFocus || false;
}

/**
* Selector used to get the disableLowerHandByModerator.
*
* @param {Object} state - The global state.
* @returns {boolean}
*/
export function getDisableLowerHandByModerator(state: IReduxState) {
return state['features/base/config']?.raisedHands?.disableLowerHandByModerator || false;
}

/**
* Selector used to get the disableLowerHandNotification.
*
* @param {Object} state - The global state.
* @returns {boolean}
*/
export function getDisableLowerHandNotification(state: IReduxState) {
return state['features/base/config']?.raisedHands?.disableLowerHandNotification || true;
}

/**
* Selector used to get the disableNextSpeakerNotification.
*
* @param {Object} state - The global state.
* @returns {boolean}
*/
export function getDisableNextSpeakerNotification(state: IReduxState) {
return state['features/base/config']?.raisedHands?.disableNextSpeakerNotification || false;
}

/**
Expand Down
6 changes: 6 additions & 0 deletions react/features/base/config/reducer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -442,6 +442,12 @@ function _translateLegacyConfig(oldValue: IConfig) {
newValue.disabledSounds.unshift('INCOMING_MSG_SOUND');
}

newValue.raisedHands = newValue.raisedHands || {};

if (oldValue.disableRemoveRaisedHandOnFocus) {
newValue.raisedHands.disableRemoveRaisedHandOnFocus = oldValue.disableRemoveRaisedHandOnFocus;
}

if (oldValue.stereo || oldValue.opusMaxAverageBitrate) {
newValue.audioQuality = {
opusMaxAverageBitrate: oldValue.audioQuality?.opusMaxAverageBitrate ?? oldValue.opusMaxAverageBitrate,
Expand Down
11 changes: 9 additions & 2 deletions react/features/base/participants/subscriber.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,11 @@ import { IStore } from '../../app/types';
import { hideNotification, showNotification } from '../../notifications/actions';
import { NOTIFICATION_TIMEOUT_TYPE, RAISE_HAND_NOTIFICATION_ID } from '../../notifications/constants';
import { getCurrentConference } from '../conference/functions';
import { getSsrcRewritingFeatureFlag, hasBeenNotified, isNextToSpeak } from '../config/functions.any';
import {
getDisableNextSpeakerNotification,
getSsrcRewritingFeatureFlag,
hasBeenNotified,
isNextToSpeak } from '../config/functions.any';
import { VIDEO_TYPE } from '../media/constants';
import StateListenerRegistry from '../redux/StateListenerRegistry';

Expand All @@ -33,7 +37,10 @@ StateListenerRegistry.register(
StateListenerRegistry.register(
/* selector */ state => state['features/base/participants'].raisedHandsQueue,
/* listener */ (raisedHandsQueue, store) => {
if (raisedHandsQueue.length && isNextToSpeak(store.getState()) && !hasBeenNotified(store.getState())) {
if (raisedHandsQueue.length
&& isNextToSpeak(store.getState())
&& !hasBeenNotified(store.getState())
&& !getDisableNextSpeakerNotification(store.getState())) {
_notifyNextSpeakerInRaisedHandQueue(store);
}
if (!raisedHandsQueue[0]) {
Expand Down
7 changes: 5 additions & 2 deletions react/features/conference/middleware.any.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import {
ENDPOINT_MESSAGE_RECEIVED
} from '../base/conference/actionTypes';
import { getCurrentConference } from '../base/conference/functions';
import { getDisableLowerHandByModerator } from '../base/config/functions.any';
import { getURLWithoutParamsNormalized } from '../base/connection/utils';
import { hideDialog } from '../base/dialog/actions';
import { isDialogOpen } from '../base/dialog/functions';
Expand Down Expand Up @@ -75,9 +76,11 @@ MiddlewareRegistry.register(store => next => action => {
}
case ENDPOINT_MESSAGE_RECEIVED: {
const { participant, data } = action;
const { dispatch } = store;
const { dispatch, getState } = store;

if (data.name === LOWER_HAND_MESSAGE && participant.isModerator()) {
if (data.name === LOWER_HAND_MESSAGE
&& participant.isModerator()
&& !getDisableLowerHandByModerator(getState())) {
dispatch(raiseHand(false));
}
break;
Expand Down

0 comments on commit 8299aa4

Please sign in to comment.