Add config options for presence & join/leave message visibility
This commit is contained in:
parent
45aafe5432
commit
ad68a87dba
|
@ -193,7 +193,13 @@ var interfaceConfig = {
|
||||||
/**
|
/**
|
||||||
* If we should capture periodic screenshots of the content sharing.
|
* If we should capture periodic screenshots of the content sharing.
|
||||||
*/
|
*/
|
||||||
ENABLE_SCREENSHOT_CAPTURE: false
|
ENABLE_SCREENSHOT_CAPTURE: false,
|
||||||
|
|
||||||
|
// If true, presence status: busy, calling, connected etc. is not displayed
|
||||||
|
DISABLE_PRESENCE_STATUS: false,
|
||||||
|
|
||||||
|
// If true, notifications regarding joining/leaving are no longer displayed
|
||||||
|
DISABLE_JOIN_LEAVE_NOTIFICATIONS: false
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* How many columns the tile view can expand to. The respected range is
|
* How many columns the tile view can expand to. The respected range is
|
||||||
|
|
|
@ -18,6 +18,8 @@ export default [
|
||||||
'CONNECTION_INDICATOR_AUTO_HIDE_TIMEOUT',
|
'CONNECTION_INDICATOR_AUTO_HIDE_TIMEOUT',
|
||||||
'CONNECTION_INDICATOR_DISABLED',
|
'CONNECTION_INDICATOR_DISABLED',
|
||||||
'DEFAULT_BACKGROUND',
|
'DEFAULT_BACKGROUND',
|
||||||
|
'DISABLE_PRESENCE_STATUS',
|
||||||
|
'DISABLE_JOIN_LEAVE_NOTIFICATIONS',
|
||||||
'DEFAULT_LOCAL_DISPLAY_NAME',
|
'DEFAULT_LOCAL_DISPLAY_NAME',
|
||||||
'DEFAULT_REMOTE_DISPLAY_NAME',
|
'DEFAULT_REMOTE_DISPLAY_NAME',
|
||||||
'DISABLE_DOMINANT_SPEAKER_INDICATOR',
|
'DISABLE_DOMINANT_SPEAKER_INDICATOR',
|
||||||
|
|
|
@ -2,6 +2,8 @@
|
||||||
|
|
||||||
import { toState } from '../base/redux';
|
import { toState } from '../base/redux';
|
||||||
|
|
||||||
|
declare var interfaceConfig: Object;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Tells whether or not the notifications are enabled and if there are any
|
* Tells whether or not the notifications are enabled and if there are any
|
||||||
* notifications to be displayed based on the current Redux state.
|
* notifications to be displayed based on the current Redux state.
|
||||||
|
@ -15,3 +17,12 @@ export function areThereNotifications(stateful: Object | Function) {
|
||||||
|
|
||||||
return enabled && notifications.length > 0;
|
return enabled && notifications.length > 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Tells wether join/leave notifications are enabled in interface_config.
|
||||||
|
*
|
||||||
|
* @returns {boolean}
|
||||||
|
*/
|
||||||
|
export function joinLeaveNotificationsDisabled() {
|
||||||
|
return Boolean(interfaceConfig?.DISABLE_JOIN_LEAVE_NOTIFICATIONS);
|
||||||
|
}
|
||||||
|
|
|
@ -15,6 +15,7 @@ import {
|
||||||
showParticipantJoinedNotification
|
showParticipantJoinedNotification
|
||||||
} from './actions';
|
} from './actions';
|
||||||
import { NOTIFICATION_TIMEOUT } from './constants';
|
import { NOTIFICATION_TIMEOUT } from './constants';
|
||||||
|
import { joinLeaveNotificationsDisabled } from './functions';
|
||||||
|
|
||||||
declare var interfaceConfig: Object;
|
declare var interfaceConfig: Object;
|
||||||
|
|
||||||
|
@ -31,7 +32,7 @@ MiddlewareRegistry.register(store => next => action => {
|
||||||
|
|
||||||
const { participant: p } = action;
|
const { participant: p } = action;
|
||||||
|
|
||||||
if (!p.local) {
|
if (!p.local && !joinLeaveNotificationsDisabled()) {
|
||||||
store.dispatch(showParticipantJoinedNotification(
|
store.dispatch(showParticipantJoinedNotification(
|
||||||
getParticipantDisplayName(store.getState, p.id)
|
getParticipantDisplayName(store.getState, p.id)
|
||||||
));
|
));
|
||||||
|
@ -40,20 +41,21 @@ MiddlewareRegistry.register(store => next => action => {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
case PARTICIPANT_LEFT: {
|
case PARTICIPANT_LEFT: {
|
||||||
const participant = getParticipantById(
|
if (!joinLeaveNotificationsDisabled()) {
|
||||||
store.getState(),
|
const participant = getParticipantById(
|
||||||
action.participant.id
|
store.getState(),
|
||||||
);
|
action.participant.id
|
||||||
|
);
|
||||||
|
|
||||||
if (typeof interfaceConfig === 'object'
|
if (typeof interfaceConfig === 'object'
|
||||||
&& participant
|
&& participant
|
||||||
&& !participant.local) {
|
&& !participant.local) {
|
||||||
store.dispatch(showNotification({
|
store.dispatch(showNotification({
|
||||||
descriptionKey: 'notify.disconnected',
|
descriptionKey: 'notify.disconnected',
|
||||||
titleKey: 'notify.somebody',
|
titleKey: 'notify.somebody',
|
||||||
title: participant.name
|
title: participant.name
|
||||||
},
|
}, NOTIFICATION_TIMEOUT));
|
||||||
NOTIFICATION_TIMEOUT));
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return next(action);
|
return next(action);
|
||||||
|
|
|
@ -8,6 +8,7 @@ import { Text } from '../../base/react';
|
||||||
import { connect } from '../../base/redux';
|
import { connect } from '../../base/redux';
|
||||||
|
|
||||||
import { STATUS_TO_I18N_KEY } from '../constants';
|
import { STATUS_TO_I18N_KEY } from '../constants';
|
||||||
|
import { presenceStatusDisabled } from '../functions';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The type of the React {@code Component} props of {@link PresenceLabel}.
|
* The type of the React {@code Component} props of {@link PresenceLabel}.
|
||||||
|
@ -124,8 +125,9 @@ function _mapStateToProps(state, ownProps) {
|
||||||
const participant = getParticipantById(state, ownProps.participantID);
|
const participant = getParticipantById(state, ownProps.participantID);
|
||||||
|
|
||||||
return {
|
return {
|
||||||
_presence:
|
_presence: presenceStatusDisabled() ? ''
|
||||||
(participant && participant.presence) || ownProps.defaultPresence
|
: participant?.presence || ownProps.defaultPresence
|
||||||
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,12 @@
|
||||||
|
// @flow
|
||||||
|
|
||||||
|
declare var interfaceConfig: Object;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Tells wether presence status should be displayed.
|
||||||
|
*
|
||||||
|
* @returns {boolean}
|
||||||
|
*/
|
||||||
|
export function presenceStatusDisabled() {
|
||||||
|
return Boolean(interfaceConfig?.DISABLE_PRESENCE_STATUS);
|
||||||
|
}
|
Loading…
Reference in New Issue