Merge pull request #20122 from prlanzarin/u27/fix/review-mobile-audio-chevron

fix(audio): review device selection in mobile endpoints
This commit is contained in:
Anton Georgiev 2024-04-30 14:39:14 -04:00 committed by GitHub
commit d484867c99
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 40 additions and 29 deletions

View File

@ -109,18 +109,14 @@ class AudioControls extends PureComponent {
inAudio, inAudio,
} = this.props; } = this.props;
const { isMobile } = deviceInfo;
let { enableDynamicAudioDeviceSelection } = Meteor.settings.public.app; let { enableDynamicAudioDeviceSelection } = Meteor.settings.public.app;
if (typeof enableDynamicAudioDeviceSelection === 'undefined') { if (typeof enableDynamicAudioDeviceSelection === 'undefined') {
enableDynamicAudioDeviceSelection = true; enableDynamicAudioDeviceSelection = true;
} }
const _enableDynamicDeviceSelection = enableDynamicAudioDeviceSelection && !isMobile;
if (inAudio) { if (inAudio) {
return this.renderButtonsAndStreamSelector(_enableDynamicDeviceSelection); return this.renderButtonsAndStreamSelector(enableDynamicAudioDeviceSelection);
} }
return this.renderJoinButton(); return this.renderJoinButton();

View File

@ -77,6 +77,7 @@ const propTypes = {
disable: PropTypes.bool.isRequired, disable: PropTypes.bool.isRequired,
talking: PropTypes.bool, talking: PropTypes.bool,
notify: PropTypes.func.isRequired, notify: PropTypes.func.isRequired,
isMobile: PropTypes.bool.isRequired,
}; };
const defaultProps = { const defaultProps = {
@ -95,7 +96,7 @@ class InputStreamLiveSelector extends Component {
super(props); super(props);
this.updateDeviceList = this.updateDeviceList.bind(this); this.updateDeviceList = this.updateDeviceList.bind(this);
this.renderDeviceList = this.renderDeviceList.bind(this); this.renderDeviceList = this.renderDeviceList.bind(this);
this.renderListenOnlyButton = this.renderListenOnlyButton.bind(this); this.renderAudioButton = this.renderAudioButton.bind(this);
this.renderMuteToggleButton = this.renderMuteToggleButton.bind(this); this.renderMuteToggleButton = this.renderMuteToggleButton.bind(this);
this.renderButtonsWithSelectorDevice = this.renderButtonsWithSelectorDevice.bind(this); this.renderButtonsWithSelectorDevice = this.renderButtonsWithSelectorDevice.bind(this);
this.renderButtonsWithoutSelectorDevice = this.renderButtonsWithoutSelectorDevice.bind(this); this.renderButtonsWithoutSelectorDevice = this.renderButtonsWithoutSelectorDevice.bind(this);
@ -345,18 +346,23 @@ class InputStreamLiveSelector extends Component {
); );
} }
renderListenOnlyButton() { renderAudioButton() {
const { const {
handleLeaveAudio, handleLeaveAudio,
intl, intl,
shortcuts, shortcuts,
isListenOnly, isListenOnly,
_enableDynamicDeviceSelection,
isMobile,
} = this.props; } = this.props;
const actAsSelectorTrigger = _enableDynamicDeviceSelection && isMobile;
return ( return (
<Button <Button
aria-label={intl.formatMessage(intlMessages.leaveAudio)} aria-label={intl.formatMessage(intlMessages.leaveAudio)}
label={intl.formatMessage(intlMessages.leaveAudio)} label={actAsSelectorTrigger
? intl.formatMessage(intlMessages.changeAudioDevice)
: intl.formatMessage(intlMessages.leaveAudio)}
accessKey={shortcuts.leaveaudio} accessKey={shortcuts.leaveaudio}
data-test="leaveListenOnly" data-test="leaveListenOnly"
hideLabel hideLabel
@ -364,7 +370,9 @@ class InputStreamLiveSelector extends Component {
icon={isListenOnly ? 'listen' : 'volume_level_2'} icon={isListenOnly ? 'listen' : 'volume_level_2'}
size="lg" size="lg"
circle circle
onClick={(e) => { onClick={actAsSelectorTrigger
? () => null
: (e) => {
e.stopPropagation(); e.stopPropagation();
handleLeaveAudio(); handleLeaveAudio();
}} }}
@ -372,6 +380,26 @@ class InputStreamLiveSelector extends Component {
); );
} }
renderMenuTrigger() {
const { intl, isMobile, isListenOnly } = this.props;
return (
<>
{!isListenOnly && !isMobile
? this.renderMuteToggleButton()
: this.renderAudioButton()}
<Styled.AudioDropdown
data-test="audioDropdownMenu"
emoji="device_list_selector"
label={intl.formatMessage(intlMessages.changeAudioDevice)}
hideLabel
tabIndex={0}
rotate
/>
</>
);
}
renderButtonsWithSelectorDevice() { renderButtonsWithSelectorDevice() {
const { const {
audioInputDevices, audioInputDevices,
@ -433,23 +461,10 @@ class InputStreamLiveSelector extends Component {
aria-hidden="true" aria-hidden="true"
/> />
) : null} ) : null}
{(!isListenOnly && isMobile) && this.renderMuteToggleButton()}
<BBBMenu <BBBMenu
customStyles={!isMobile ? customStyles : null} customStyles={!isMobile ? customStyles : null}
trigger={( trigger={this.renderMenuTrigger()}
<>
{isListenOnly
? this.renderListenOnlyButton()
: this.renderMuteToggleButton()}
<Styled.AudioDropdown
data-test="audioDropdownMenu"
emoji="device_list_selector"
label={intl.formatMessage(intlMessages.changeAudioDevice)}
hideLabel
tabIndex={0}
rotate
/>
</>
)}
actions={dropdownListComplete} actions={dropdownListComplete}
opts={{ opts={{
id: 'audio-selector-dropdown-menu', id: 'audio-selector-dropdown-menu',
@ -469,11 +484,11 @@ class InputStreamLiveSelector extends Component {
renderButtonsWithoutSelectorDevice() { renderButtonsWithoutSelectorDevice() {
const { isListenOnly } = this.props; const { isListenOnly } = this.props;
return isListenOnly return isListenOnly
? this.renderListenOnlyButton() ? this.renderAudioButton()
: ( : (
<> <>
{this.renderMuteToggleButton()} {this.renderMuteToggleButton()}
{this.renderListenOnlyButton()} {this.renderAudioButton()}
</> </>
); );
} }