fix(RN): broken build after AV pending changes.

pull/13439/head jitsi-meet_8729
Hristo Terezov 2 years ago
parent acb91990bf
commit 70be08212d
  1. 2
      react/features/base/toolbox/components/BaseAudioMuteButton.ts
  2. 2
      react/features/base/toolbox/components/BaseVideoMuteButton.ts
  3. 4
      react/features/lobby/components/native/LobbyScreen.tsx
  4. 4
      react/features/prejoin/components/native/Prejoin.tsx
  5. 94
      react/features/toolbox/components/AbstractAudioMuteButton.tsx
  6. 93
      react/features/toolbox/components/AbstractVideoMuteButton.tsx
  7. 6
      react/features/toolbox/components/native/AudioMuteButton.tsx
  8. 4
      react/features/toolbox/components/native/Toolbox.tsx
  9. 7
      react/features/toolbox/components/native/VideoMuteButton.tsx
  10. 89
      react/features/toolbox/components/web/AudioMuteButton.tsx
  11. 3
      react/features/toolbox/components/web/AudioSettingsButton.tsx
  12. 91
      react/features/toolbox/components/web/VideoMuteButton.tsx
  13. 3
      react/features/toolbox/components/web/VideoSettingsButton.tsx

@ -5,7 +5,7 @@ import AbstractButton, { IProps } from './AbstractButton';
/**
* An abstract implementation of a button for toggling audio mute.
*/
export default class AbstractAudioMuteButton<P extends IProps, S=any>
export default class BaseAudioMuteButton<P extends IProps, S=any>
extends AbstractButton<P, S> {
icon = IconMic;

@ -5,7 +5,7 @@ import AbstractButton, { IProps } from './AbstractButton';
/**
* An abstract implementation of a button for toggling video mute.
*/
export default class AbstractVideoMuteButton<P extends IProps, S=any>
export default class BaseVideoMuteButton<P extends IProps, S=any>
extends AbstractButton<P, S> {
icon = IconVideo;

@ -18,8 +18,8 @@ import { navigate }
from '../../../mobile/navigation/components/lobby/LobbyNavigationContainerRef';
import { screen } from '../../../mobile/navigation/routes';
import { preJoinStyles } from '../../../prejoin/components/native/styles';
import AudioMuteButton from '../../../toolbox/components/AudioMuteButton';
import VideoMuteButton from '../../../toolbox/components/VideoMuteButton';
import AudioMuteButton from '../../../toolbox/components/native/AudioMuteButton';
import VideoMuteButton from '../../../toolbox/components/native/VideoMuteButton';
import AbstractLobbyScreen, {
IProps as AbstractProps,
_mapStateToProps as abstractMapStateToProps } from '../AbstractLobbyScreen';

@ -33,8 +33,8 @@ import LargeVideo from '../../../large-video/components/LargeVideo.native';
import HeaderNavigationButton from '../../../mobile/navigation/components/HeaderNavigationButton';
import { navigateRoot } from '../../../mobile/navigation/rootNavigationContainerRef';
import { screen } from '../../../mobile/navigation/routes';
import AudioMuteButton from '../../../toolbox/components/AudioMuteButton';
import VideoMuteButton from '../../../toolbox/components/VideoMuteButton';
import AudioMuteButton from '../../../toolbox/components/native/AudioMuteButton';
import VideoMuteButton from '../../../toolbox/components/native/VideoMuteButton';
import { isDisplayNameRequired } from '../../functions';
import { IPrejoinProps } from '../../types';

@ -0,0 +1,94 @@
import { IReduxState } from '../../app/types';
import { AUDIO_MUTE_BUTTON_ENABLED } from '../../base/flags/constants';
import { getFeatureFlag } from '../../base/flags/functions';
import { MEDIA_TYPE } from '../../base/media/constants';
import { IProps as AbstractButtonProps } from '../../base/toolbox/components/AbstractButton';
import BaseAudioMuteButton from '../../base/toolbox/components/BaseAudioMuteButton';
import { isLocalTrackMuted } from '../../base/tracks/functions';
import { muteLocal } from '../../video-menu/actions';
import { isAudioMuteButtonDisabled } from '../functions';
/**
* The type of the React {@code Component} props of {@link AbstractAudioMuteButton}.
*/
export interface IProps extends AbstractButtonProps {
/**
* Whether audio is currently muted or not.
*/
_audioMuted: boolean;
/**
* Whether the button is disabled.
*/
_disabled: boolean;
}
/**
* Component that renders a toolbar button for toggling audio mute.
*
* @augments BaseAudioMuteButton
*/
export default class AbstractAudioMuteButton<P extends IProps> extends BaseAudioMuteButton<P> {
accessibilityLabel = 'toolbar.accessibilityLabel.mute';
toggledAccessibilityLabel = 'toolbar.accessibilityLabel.unmute';
label = 'toolbar.mute';
tooltip = 'toolbar.mute';
toggledTooltip = 'toolbar.unmute';
/**
* Indicates if audio is currently muted or not.
*
* @override
* @protected
* @returns {boolean}
*/
_isAudioMuted() {
return this.props._audioMuted;
}
/**
* Changes the muted state.
*
* @param {boolean} audioMuted - Whether audio should be muted or not.
* @protected
* @returns {void}
*/
_setAudioMuted(audioMuted: boolean) {
this.props.dispatch(muteLocal(audioMuted, MEDIA_TYPE.AUDIO));
}
/**
* Return a boolean value indicating if this button is disabled or not.
*
* @returns {boolean}
*/
_isDisabled() {
return this.props._disabled;
}
}
/**
* Maps (parts of) the redux state to the associated props for the
* {@code AbstractAudioMuteButton} component.
*
* @param {Object} state - The Redux state.
* @private
* @returns {{
* _audioMuted: boolean,
* _disabled: boolean
* }}
*/
export function mapStateToProps(state: IReduxState) {
const _audioMuted = isLocalTrackMuted(state['features/base/tracks'], MEDIA_TYPE.AUDIO);
const _disabled = isAudioMuteButtonDisabled(state);
const enabledFlag = getFeatureFlag(state, AUDIO_MUTE_BUTTON_ENABLED, true);
return {
_audioMuted,
_disabled,
visible: enabledFlag
};
}

@ -0,0 +1,93 @@
import { IReduxState } from '../../app/types';
import { VIDEO_MUTE_BUTTON_ENABLED } from '../../base/flags/constants';
import { getFeatureFlag } from '../../base/flags/functions';
import { MEDIA_TYPE } from '../../base/media/constants';
import { IProps as AbstractButtonProps } from '../../base/toolbox/components/AbstractButton';
import BaseVideoMuteButton from '../../base/toolbox/components/BaseVideoMuteButton';
import { isLocalTrackMuted } from '../../base/tracks/functions';
import { handleToggleVideoMuted } from '../actions.any';
import { isVideoMuteButtonDisabled } from '../functions';
/**
* The type of the React {@code Component} props of {@link AbstractVideoMuteButton}.
*/
export interface IProps extends AbstractButtonProps {
/**
* Whether video button is disabled or not.
*/
_videoDisabled: boolean;
/**
* Whether video is currently muted or not.
*/
_videoMuted: boolean;
}
/**
* Component that renders a toolbar button for toggling video mute.
*
* @augments BaseVideoMuteButton
*/
export default class AbstractVideoMuteButton<P extends IProps> extends BaseVideoMuteButton<P> {
accessibilityLabel = 'toolbar.accessibilityLabel.videomute';
toggledAccessibilityLabel = 'toolbar.accessibilityLabel.videounmute';
label = 'toolbar.videomute';
tooltip = 'toolbar.videomute';
toggledTooltip = 'toolbar.videounmute';
/**
* Indicates if video is currently disabled or not.
*
* @override
* @protected
* @returns {boolean}
*/
_isDisabled() {
return this.props._videoDisabled;
}
/**
* Indicates if video is currently muted or not.
*
* @override
* @protected
* @returns {boolean}
*/
_isVideoMuted() {
return this.props._videoMuted;
}
/**
* Changes the muted state.
*
* @override
* @param {boolean} videoMuted - Whether video should be muted or not.
* @protected
* @returns {void}
*/
_setVideoMuted(videoMuted: boolean) {
this.props.dispatch(handleToggleVideoMuted(videoMuted, true, true));
}
}
/**
* Maps (parts of) the redux state to the associated props for the
* {@code VideoMuteButton} component.
*
* @param {Object} state - The Redux state.
* @private
* @returns {{
* _videoMuted: boolean
* }}
*/
export function mapStateToProps(state: IReduxState) {
const tracks = state['features/base/tracks'];
const enabledFlag = getFeatureFlag(state, VIDEO_MUTE_BUTTON_ENABLED, true);
return {
_videoDisabled: isVideoMuteButtonDisabled(state),
_videoMuted: isLocalTrackMuted(tracks, MEDIA_TYPE.VIDEO),
visible: enabledFlag
};
}

@ -0,0 +1,6 @@
import { connect } from 'react-redux';
import { translate } from '../../../base/i18n/functions';
import AbstractAudioMuteButton, { IProps, mapStateToProps } from '../AbstractAudioMuteButton';
export default translate(connect(mapStateToProps)(AbstractAudioMuteButton<IProps>));

@ -12,14 +12,14 @@ import { isReactionsEnabled } from '../../../reactions/functions.any';
import TileViewButton from '../../../video-layout/components/TileViewButton';
import { iAmVisitor } from '../../../visitors/functions';
import { getMovableButtons, isToolboxVisible } from '../../functions.native';
import AudioMuteButton from '../AudioMuteButton';
import HangupButton from '../HangupButton';
import VideoMuteButton from '../VideoMuteButton';
import AudioMuteButton from './AudioMuteButton';
import HangupMenuButton from './HangupMenuButton';
import OverflowMenuButton from './OverflowMenuButton';
import RaiseHandButton from './RaiseHandButton';
import ScreenSharingButton from './ScreenSharingButton';
import VideoMuteButton from './VideoMuteButton';
import styles from './styles';
/**

@ -0,0 +1,7 @@
import { connect } from 'react-redux';
import { translate } from '../../../base/i18n/functions';
import AbstractVideoMuteButton, { IProps, mapStateToProps } from '../AbstractVideoMuteButton';
export default translate(connect(mapStateToProps)(AbstractVideoMuteButton<IProps>));

@ -2,22 +2,19 @@ import { ClassNameMap, withStyles } from '@mui/styles';
import React, { ReactElement } from 'react';
import { connect } from 'react-redux';
import { ACTION_SHORTCUT_TRIGGERED, AUDIO_MUTE, createShortcutEvent } from '../../analytics/AnalyticsEvents';
import { sendAnalytics } from '../../analytics/functions';
import { IReduxState } from '../../app/types';
import { AUDIO_MUTE_BUTTON_ENABLED } from '../../base/flags/constants';
import { getFeatureFlag } from '../../base/flags/functions';
import { translate } from '../../base/i18n/functions';
import { MEDIA_TYPE } from '../../base/media/constants';
import { IGUMPendingState } from '../../base/media/types';
import AbstractAudioMuteButton from '../../base/toolbox/components/AbstractAudioMuteButton';
import AbstractButton, { IProps as AbstractButtonProps } from '../../base/toolbox/components/AbstractButton';
import { isLocalTrackMuted } from '../../base/tracks/functions';
import Spinner from '../../base/ui/components/web/Spinner';
import { registerShortcut, unregisterShortcut } from '../../keyboard-shortcuts/actions';
import { muteLocal } from '../../video-menu/actions';
import { SPINNER_COLOR } from '../constants';
import { isAudioMuteButtonDisabled } from '../functions';
import { ACTION_SHORTCUT_TRIGGERED, AUDIO_MUTE, createShortcutEvent } from '../../../analytics/AnalyticsEvents';
import { sendAnalytics } from '../../../analytics/functions';
import { IReduxState } from '../../../app/types';
import { translate } from '../../../base/i18n/functions';
import { IGUMPendingState } from '../../../base/media/types';
import AbstractButton from '../../../base/toolbox/components/AbstractButton';
import Spinner from '../../../base/ui/components/web/Spinner';
import { registerShortcut, unregisterShortcut } from '../../../keyboard-shortcuts/actions';
import { SPINNER_COLOR } from '../../constants';
import AbstractAudioMuteButton, {
IProps as AbstractAudioMuteButtonProps,
mapStateToProps as abstractMapStateToProps
} from '../AbstractAudioMuteButton';
const styles = () => {
return {
@ -32,19 +29,9 @@ const styles = () => {
/**
* The type of the React {@code Component} props of {@link AudioMuteButton}.
*/
interface IProps extends AbstractButtonProps {
interface IProps extends AbstractAudioMuteButtonProps {
/**
* Whether audio is currently muted or not.
*/
_audioMuted: boolean;
/**
* Whether the button is disabled.
*/
_disabled: boolean;
/**
* The gumPending state from redux.
*/
@ -62,11 +49,6 @@ interface IProps extends AbstractButtonProps {
* @augments AbstractAudioMuteButton
*/
class AudioMuteButton extends AbstractAudioMuteButton<IProps> {
accessibilityLabel = 'toolbar.accessibilityLabel.mute';
toggledAccessibilityLabel = 'toolbar.accessibilityLabel.unmute';
label = 'toolbar.mute';
tooltip = 'toolbar.mute';
toggledTooltip = 'toolbar.unmute';
/**
* Initializes a new {@code AudioMuteButton} instance.
@ -89,10 +71,6 @@ class AudioMuteButton extends AbstractAudioMuteButton<IProps> {
* @returns {void}
*/
componentDidMount() {
if (typeof APP === 'undefined') {
return;
}
this.props.dispatch(registerShortcut({
character: 'M',
helpDescription: 'keyboardShortcuts.mute',
@ -107,10 +85,6 @@ class AudioMuteButton extends AbstractAudioMuteButton<IProps> {
* @returns {void}
*/
componentWillUnmount() {
if (typeof APP === 'undefined') {
return;
}
this.props.dispatch(unregisterShortcut('M'));
}
@ -159,13 +133,11 @@ class AudioMuteButton extends AbstractAudioMuteButton<IProps> {
* @returns {boolean}
*/
_isAudioMuted() {
const { _audioMuted, _gumPending } = this.props;
if (_gumPending === IGUMPendingState.PENDING_UNMUTE) {
if (this.props._gumPending === IGUMPendingState.PENDING_UNMUTE) {
return false;
}
return _audioMuted;
return super._isAudioMuted();
}
/**
@ -207,26 +179,6 @@ class AudioMuteButton extends AbstractAudioMuteButton<IProps> {
</div>
);
}
/**
* Changes the muted state.
*
* @param {boolean} audioMuted - Whether audio should be muted or not.
* @protected
* @returns {void}
*/
_setAudioMuted(audioMuted: boolean) {
this.props.dispatch(muteLocal(audioMuted, MEDIA_TYPE.AUDIO));
}
/**
* Return a boolean value indicating if this button is disabled or not.
*
* @returns {boolean}
*/
_isDisabled() {
return this.props._disabled;
}
}
/**
@ -241,16 +193,11 @@ class AudioMuteButton extends AbstractAudioMuteButton<IProps> {
* }}
*/
function _mapStateToProps(state: IReduxState) {
const _audioMuted = isLocalTrackMuted(state['features/base/tracks'], MEDIA_TYPE.AUDIO);
const _disabled = isAudioMuteButtonDisabled(state);
const enabledFlag = getFeatureFlag(state, AUDIO_MUTE_BUTTON_ENABLED, true);
const { gumPending } = state['features/base/media'].audio;
return {
_audioMuted,
_disabled,
_gumPending: gumPending,
visible: enabledFlag
...abstractMapStateToProps(state),
_gumPending: gumPending
};
}

@ -13,7 +13,8 @@ import { toggleAudioSettings } from '../../../settings/actions';
import AudioSettingsPopup from '../../../settings/components/web/audio/AudioSettingsPopup';
import { getAudioSettingsVisibility } from '../../../settings/functions';
import { isAudioSettingsButtonDisabled } from '../../functions';
import AudioMuteButton from '../AudioMuteButton';
import AudioMuteButton from './AudioMuteButton';
interface IProps extends WithTranslation {

@ -2,22 +2,19 @@ import { ClassNameMap, withStyles } from '@mui/styles';
import React, { ReactElement } from 'react';
import { connect } from 'react-redux';
import { ACTION_SHORTCUT_TRIGGERED, VIDEO_MUTE, createShortcutEvent } from '../../analytics/AnalyticsEvents';
import { sendAnalytics } from '../../analytics/functions';
import { IReduxState } from '../../app/types';
import { VIDEO_MUTE_BUTTON_ENABLED } from '../../base/flags/constants';
import { getFeatureFlag } from '../../base/flags/functions';
import { translate } from '../../base/i18n/functions';
import { MEDIA_TYPE } from '../../base/media/constants';
import { IGUMPendingState } from '../../base/media/types';
import AbstractButton, { IProps as AbstractButtonProps } from '../../base/toolbox/components/AbstractButton';
import AbstractVideoMuteButton from '../../base/toolbox/components/AbstractVideoMuteButton';
import { isLocalTrackMuted } from '../../base/tracks/functions';
import Spinner from '../../base/ui/components/web/Spinner';
import { registerShortcut, unregisterShortcut } from '../../keyboard-shortcuts/actions';
import { handleToggleVideoMuted } from '../actions.any';
import { SPINNER_COLOR } from '../constants';
import { isVideoMuteButtonDisabled } from '../functions';
import { ACTION_SHORTCUT_TRIGGERED, VIDEO_MUTE, createShortcutEvent } from '../../../analytics/AnalyticsEvents';
import { sendAnalytics } from '../../../analytics/functions';
import { IReduxState } from '../../../app/types';
import { translate } from '../../../base/i18n/functions';
import { IGUMPendingState } from '../../../base/media/types';
import AbstractButton from '../../../base/toolbox/components/AbstractButton';
import Spinner from '../../../base/ui/components/web/Spinner';
import { registerShortcut, unregisterShortcut } from '../../../keyboard-shortcuts/actions';
import { SPINNER_COLOR } from '../../constants';
import AbstractVideoMuteButton, {
IProps as AbstractVideoMuteButtonProps,
mapStateToProps as abstractMapStateToProps
} from '../AbstractVideoMuteButton';
const styles = () => {
return {
@ -32,23 +29,13 @@ const styles = () => {
/**
* The type of the React {@code Component} props of {@link VideoMuteButton}.
*/
interface IProps extends AbstractButtonProps {
export interface IProps extends AbstractVideoMuteButtonProps {
/**
* The gumPending state from redux.
*/
_gumPending: IGUMPendingState;
/**
* Whether video button is disabled or not.
*/
_videoDisabled: boolean;
/**
* Whether video is currently muted or not.
*/
_videoMuted: boolean;
/**
* The @mui/styles classes.
*/
@ -61,11 +48,6 @@ interface IProps extends AbstractButtonProps {
* @augments AbstractVideoMuteButton
*/
class VideoMuteButton extends AbstractVideoMuteButton<IProps> {
accessibilityLabel = 'toolbar.accessibilityLabel.videomute';
toggledAccessibilityLabel = 'toolbar.accessibilityLabel.videounmute';
label = 'toolbar.videomute';
tooltip = 'toolbar.videomute';
toggledTooltip = 'toolbar.videounmute';
/**
* Initializes a new {@code VideoMuteButton} instance.
@ -88,10 +70,6 @@ class VideoMuteButton extends AbstractVideoMuteButton<IProps> {
* @returns {void}
*/
componentDidMount() {
if (typeof APP === 'undefined') {
return;
}
this.props.dispatch(registerShortcut({
character: 'V',
helpDescription: 'keyboardShortcuts.videoMute',
@ -106,10 +84,6 @@ class VideoMuteButton extends AbstractVideoMuteButton<IProps> {
* @returns {void}
*/
componentWillUnmount() {
if (typeof APP === 'undefined') {
return;
}
this.props.dispatch(unregisterShortcut('V'));
}
@ -150,17 +124,6 @@ class VideoMuteButton extends AbstractVideoMuteButton<IProps> {
return 'toolbar.videomuteGUMPending';
}
/**
* Indicates if video is currently disabled or not.
*
* @override
* @protected
* @returns {boolean}
*/
_isDisabled() {
return this.props._videoDisabled || this.props._gumPending !== IGUMPendingState.NONE;
}
/**
* Indicates if video is currently muted or not.
*
@ -169,13 +132,11 @@ class VideoMuteButton extends AbstractVideoMuteButton<IProps> {
* @returns {boolean}
*/
_isVideoMuted() {
const { _gumPending, _videoMuted } = this.props;
if (_gumPending === IGUMPendingState.PENDING_UNMUTE) {
if (this.props._gumPending === IGUMPendingState.PENDING_UNMUTE) {
return false;
}
return _videoMuted;
return super._isVideoMuted();
}
/**
@ -217,18 +178,6 @@ class VideoMuteButton extends AbstractVideoMuteButton<IProps> {
AbstractButton.prototype._onClick.call(this);
}
/**
* Changes the muted state.
*
* @override
* @param {boolean} videoMuted - Whether video should be muted or not.
* @protected
* @returns {void}
*/
_setVideoMuted(videoMuted: boolean) {
this.props.dispatch(handleToggleVideoMuted(videoMuted, true, true));
}
}
/**
@ -242,15 +191,11 @@ class VideoMuteButton extends AbstractVideoMuteButton<IProps> {
* }}
*/
function _mapStateToProps(state: IReduxState) {
const tracks = state['features/base/tracks'];
const enabledFlag = getFeatureFlag(state, VIDEO_MUTE_BUTTON_ENABLED, true);
const { gumPending } = state['features/base/media'].video;
return {
_videoDisabled: isVideoMuteButtonDisabled(state),
_videoMuted: isLocalTrackMuted(tracks, MEDIA_TYPE.VIDEO),
_gumPending: gumPending,
visible: enabledFlag
...abstractMapStateToProps(state),
_gumPending: gumPending
};
}

@ -13,7 +13,8 @@ import { toggleVideoSettings } from '../../../settings/actions';
import VideoSettingsPopup from '../../../settings/components/web/video/VideoSettingsPopup';
import { getVideoSettingsVisibility } from '../../../settings/functions.web';
import { isVideoSettingsButtonDisabled } from '../../functions.web';
import VideoMuteButton from '../VideoMuteButton';
import VideoMuteButton from './VideoMuteButton';
interface IProps extends WithTranslation {

Loading…
Cancel
Save