Skip to content

Commit

Permalink
Merge pull request #19732 from JoVictorNunes/issue-19607
Browse files Browse the repository at this point in the history
fix: Captions controls duplicated
  • Loading branch information
ramonlsouza committed Mar 6, 2024
2 parents 1f6b215 + 0fa7c5d commit efcae7d
Showing 1 changed file with 6 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,13 @@ import useCurrentUser from '/imports/ui/core/hooks/useCurrentUser';
import ButtonEmoji from '/imports/ui/components/common/button/button-emoji/ButtonEmoji';
import BBBMenu from '/imports/ui/components/common/menu/component';
import Styled from './styles';
import { getSpeechVoices, setAudioCaptions, setSpeechLocale } from '../service';
import {
getSpeechVoices, isAudioTranscriptionEnabled, setAudioCaptions, setSpeechLocale,
} from '../service';
import { defineMessages, useIntl } from 'react-intl';
import { MenuSeparatorItemType, MenuOptionItemType } from '/imports/ui/components/common/menu/menuTypes';
import useAudioCaptionEnable from '/imports/ui/core/local-states/useAudioCaptionEnable';
import { User } from '/imports/ui/Types/user';
import useMeeting from '/imports/ui/core/hooks/useMeeting';
import { useMutation } from '@apollo/client';
import { SET_SPEECH_LOCALE } from '/imports/ui/core/graphql/mutations/userMutations';

Expand Down Expand Up @@ -260,27 +261,15 @@ const AudioCaptionsButtonContainer: React.FC = () => {
}),
);

const {
data: currentMeeting,
loading: componentsFlagsLoading,
} = useMeeting((m) => {
return {
componentsFlags: m.componentsFlags,
};
});
if (currentUserLoading || componentsFlagsLoading) return null;
if (!currentUser || !currentMeeting) return null;
if (currentUserLoading) return null;
if (!currentUser) return null;

const availableVoices = getSpeechVoices();
const currentSpeechLocale = currentUser.speechLocale || '';
const isSupported = availableVoices.length > 0;
const isVoiceUser = !!currentUser.voice;

const { componentsFlags } = currentMeeting;

const hasCaptions = componentsFlags?.hasCaption;

if (!hasCaptions) return null;
if (!isAudioTranscriptionEnabled()) return null;

return (
<AudioCaptionsButton
Expand Down

0 comments on commit efcae7d

Please sign in to comment.