fix(screenshare-jwt) Disable screen share based on jwt
This commit is contained in:
parent
4d817af060
commit
ceb1cd9673
|
@ -39,9 +39,10 @@ export function getJwtName(state: IState) {
|
||||||
* @param {IState} state - The app state.
|
* @param {IState} state - The app state.
|
||||||
* @param {string} feature - The feature we want to check.
|
* @param {string} feature - The feature we want to check.
|
||||||
* @param {boolean} ifNoToken - Default value if there is no token.
|
* @param {boolean} ifNoToken - Default value if there is no token.
|
||||||
* @returns {string}
|
* @param {boolean} ifNotInFeatures - Default value if features prop exists but does not have the {@code feature}.
|
||||||
|
* @returns {bolean}
|
||||||
*/
|
*/
|
||||||
export function isJwtFeatureEnabled(state: IState, feature: string, ifNoToken = false) {
|
export function isJwtFeatureEnabled(state: IState, feature: string, ifNoToken = false, ifNotInFeatures = false) {
|
||||||
const { jwt } = state['features/base/jwt'];
|
const { jwt } = state['features/base/jwt'];
|
||||||
|
|
||||||
if (!jwt) {
|
if (!jwt) {
|
||||||
|
@ -55,6 +56,10 @@ export function isJwtFeatureEnabled(state: IState, feature: string, ifNoToken =
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (typeof features[feature as keyof typeof features] === 'undefined') {
|
||||||
|
return ifNotInFeatures;
|
||||||
|
}
|
||||||
|
|
||||||
return String(features[feature as keyof typeof features]) === 'true';
|
return String(features[feature as keyof typeof features]) === 'true';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,8 @@
|
||||||
import { IState } from '../app/types';
|
import { IState } from '../app/types';
|
||||||
import { getToolbarButtons } from '../base/config/functions.web';
|
import { getToolbarButtons } from '../base/config/functions.web';
|
||||||
import { hasAvailableDevices } from '../base/devices/functions';
|
import { hasAvailableDevices } from '../base/devices/functions';
|
||||||
|
import { MEET_FEATURES } from '../base/jwt/constants';
|
||||||
|
import { isJwtFeatureEnabled } from '../base/jwt/functions';
|
||||||
import { isScreenMediaShared } from '../screen-share/functions';
|
import { isScreenMediaShared } from '../screen-share/functions';
|
||||||
import { isWhiteboardVisible } from '../whiteboard/functions';
|
import { isWhiteboardVisible } from '../whiteboard/functions';
|
||||||
|
|
||||||
|
@ -84,8 +86,9 @@ export function isAudioSettingsButtonDisabled(state: IState) {
|
||||||
export function isDesktopShareButtonDisabled(state: IState) {
|
export function isDesktopShareButtonDisabled(state: IState) {
|
||||||
const { muted, unmuteBlocked } = state['features/base/media'].video;
|
const { muted, unmuteBlocked } = state['features/base/media'].video;
|
||||||
const videoOrShareInProgress = !muted || isScreenMediaShared(state);
|
const videoOrShareInProgress = !muted || isScreenMediaShared(state);
|
||||||
|
const enabledInJwt = isJwtFeatureEnabled(state, MEET_FEATURES.SCREEN_SHARING, true, true);
|
||||||
|
|
||||||
return unmuteBlocked && !videoOrShareInProgress;
|
return !enabledInJwt || (unmuteBlocked && !videoOrShareInProgress);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in New Issue