Jitsi Meet - Secure, Simple and Scalable Video Conferences that you use as a standalone app or embed in your web application.
TypeScript debiandeep-videojitsijitsi-meetscalable-video-conferencessfuvideovideo-communicationvideo-conferencingwebrtc
fix(subtitles): open recording dialog via navigation on native for async transcription (#17510)
Calinteodore1175ffa1b11
diff --git a/react/features/base/modal/components/JitsiKeyboardAvoidingView.tsx b/react/features/base/modal/components/JitsiKeyboardAvoidingView.tsxindex b2308f7227..d36991901b 100644--- a/react/features/base/modal/components/JitsiKeyboardAvoidingView.tsx+++ b/react/features/base/modal/components/JitsiKeyboardAvoidingView.tsx@@ -1,5 +1,5 @@-import { useHeaderHeight } from '@react-navigation/elements';-import React, { useCallback, useEffect, useState } from 'react';+import { HeaderHeightContext } from '@react-navigation/elements';+import React, { useCallback, useContext, useEffect, useState } from 'react';import {Keyboard,KeyboardAvoidingView,@@ -59,7 +59,8 @@ const JitsiKeyboardAvoidingView = (hasExtraHeaderHeight,style}: IProps) => {- const headerHeight = useHeaderHeight();+ // Default to 0 when outside a navigator.+ const headerHeight = useContext(HeaderHeightContext) ?? 0;const insets = useSafeAreaInsets();const [ bottomPadding, setBottomPadding ] = useState(insets.bottom);diff --git a/react/features/recording/components/Recording/AbstractStartRecordingDialog.ts b/react/features/recording/components/Recording/AbstractStartRecordingDialog.tsindex 1923c6050e..2fae031dfb 100644--- a/react/features/recording/components/Recording/AbstractStartRecordingDialog.ts+++ b/react/features/recording/components/Recording/AbstractStartRecordingDialog.ts@@ -9,10 +9,11 @@ import { MEET_FEATURES } from '../../../base/jwt/constants';import { isJwtFeatureEnabled } from '../../../base/jwt/functions';import { JitsiRecordingConstants } from '../../../base/lib-jitsi-meet';import { updateDropboxToken } from '../../../dropbox/actions';-import { getDropboxData, getNewAccessToken, isEnabled as isDropboxEnabled } from '../../../dropbox/functions.any';+import { getNewAccessToken, isEnabled as isDropboxEnabled } from '../../../dropbox/functions';+import { getDropboxData } from '../../../dropbox/functions.any';import { showErrorNotification } from '../../../notifications/actions';import { setRequestingSubtitles } from '../../../subtitles/actions.any';-import { setSelectedRecordingService, setStartRecordingIntent, startLocalVideoRecording } from '../../actions';+import { setSelectedRecordingService, setStartRecordingIntent, startLocalVideoRecording } from '../../actions.any';import { RECORDING_METADATA_ID, RECORDING_TYPES } from '../../constants';import { isRecordingSharingEnabled, shouldAutoTranscribeOnRecord, supportsLocalRecording } from '../../functions';diff --git a/react/features/recording/components/Recording/native/StartRecordingDialog.tsx b/react/features/recording/components/Recording/native/StartRecordingDialog.tsxindex 942cf6cea9..fc5e41b5cd 100644--- a/react/features/recording/components/Recording/native/StartRecordingDialog.tsx+++ b/react/features/recording/components/Recording/native/StartRecordingDialog.tsx@@ -1,7 +1,8 @@import React from 'react';import { connect } from 'react-redux';-import { translate } from '../../../../base/i18n/functions';+import { IReduxState } from '../../../../app/types';+import { translate } from '../../../../base/i18n/functions.native';import JitsiScreen from '../../../../base/modal/components/JitsiScreen';import HeaderNavigationButtonfrom '../../../../mobile/navigation/components/HeaderNavigationButton';@@ -10,7 +11,7 @@ import { goBack } fromimport { RECORDING_TYPES } from '../../../constants';import AbstractStartRecordingDialog, {IProps,- mapStateToProps+ mapStateToProps as abstractMapStateToProps} from '../AbstractStartRecordingDialog';import styles from '../styles.native';@@ -167,4 +168,21 @@ class StartRecordingDialog extends AbstractStartRecordingDialog {}}+/**+ * Maps redux state to component props, bridging the navigation route params+ * (native-only) into the shared {@code recordAudioAndVideo} prop.+ *+ * @param {Object} state - Redux state.+ * @param {any} ownProps - Component's own props.+ * @returns {Object}+ */+function mapStateToProps(state: IReduxState, ownProps: any) {+ return {+ ...abstractMapStateToProps(state, {+ ...ownProps,+ recordAudioAndVideo: ownProps.recordAudioAndVideo ?? ownProps.route?.params?.recordAudioAndVideo+ })+ };+}+export default translate(connect(mapStateToProps)(StartRecordingDialog));diff --git a/react/features/subtitles/components/AbstractLanguageSelectorDialog.tsx b/react/features/subtitles/components/AbstractLanguageSelectorDialog.tsxindex 5a3039fcb2..d71d3bbcf5 100644--- a/react/features/subtitles/components/AbstractLanguageSelectorDialog.tsx+++ b/react/features/subtitles/components/AbstractLanguageSelectorDialog.tsx@@ -3,12 +3,11 @@ import { useTranslation } from 'react-i18next';import { useDispatch, useSelector } from 'react-redux';import { IReduxState, IStore } from '../../app/types';-import { openDialog } from '../../base/dialog/actions';-import { StartRecordingDialog } from '../../recording/components/Recording/index';import { setRequestingSubtitles } from '../actions.any';import { getAvailableSubtitlesLanguages, isTranslationEnabled } from '../functions.any';export interface IAbstractLanguageSelectorDialogProps {+ asyncTranscription: boolean;dispatch: IStore['dispatch'];language: string | null;listItems: Array<any>;@@ -47,20 +46,15 @@ const AbstractLanguageSelectorDialog = (Component: ComponentType<IAbstractLangua});const { conference } = useSelector((state: IReduxState) => state['features/base/conference']);const translationEnabled = useSelector(isTranslationEnabled);+ const asyncTranscription = Boolean(conference?.getMetadataHandler()?.getMetadata()?.asyncTranscription);const onLanguageSelected = useCallback((value: string) => {const _selectedLanguage = value === noLanguageLabel ? null : value;const enabled = Boolean(_selectedLanguage);const displaySubtitles = enabled;- if (conference?.getMetadataHandler()?.getMetadata()?.asyncTranscription) {- dispatch(openDialog('StartRecordingDialog', StartRecordingDialog, {- recordAudioAndVideo: false- }));- } else {- dispatch(setRequestingSubtitles(enabled, displaySubtitles, _selectedLanguage));- }- }, [ conference, language ]);+ dispatch(setRequestingSubtitles(enabled, displaySubtitles, _selectedLanguage));+ }, [ language ]);if (!translationEnabled) {return null;@@ -68,6 +62,7 @@ const AbstractLanguageSelectorDialog = (Component: ComponentType<IAbstractLanguareturn (<Component+ asyncTranscription = { asyncTranscription }dispatch = { dispatch }language = { language }listItems = { listItems }diff --git a/react/features/subtitles/components/native/LanguageSelectorDialog.tsx b/react/features/subtitles/components/native/LanguageSelectorDialog.tsxindex 3cd997df6e..fd21a52933 100644--- a/react/features/subtitles/components/native/LanguageSelectorDialog.tsx+++ b/react/features/subtitles/components/native/LanguageSelectorDialog.tsx@@ -1,8 +1,9 @@import React, { useCallback } from 'react';import JitsiScreen from '../../../base/modal/components/JitsiScreen';-import { goBack }+import { goBack, navigate }from '../../../mobile/navigation/components/conference/ConferenceNavigationContainerRef';+import { screen } from '../../../mobile/navigation/routes';import AbstractLanguageSelectorDialog, {IAbstractLanguageSelectorDialogProps} from '../AbstractLanguageSelectorDialog';@@ -11,12 +12,16 @@ import LanguageList from './LanguageList';import styles from './styles';const LanguageSelectorDialog = (props: IAbstractLanguageSelectorDialogProps) => {- const { language, listItems, onLanguageSelected, subtitles } = props;+ const { asyncTranscription, language, listItems, onLanguageSelected, subtitles } = props;const onSelected = useCallback((e: string) => {- onLanguageSelected(e);- goBack();- }, [ language ]);+ if (asyncTranscription) {+ navigate(screen.conference.recording, { recordAudioAndVideo: false });+ } else {+ onLanguageSelected(e);+ goBack();+ }+ }, [ asyncTranscription, language ]);return (<JitsiScreendiff --git a/react/features/subtitles/components/web/LanguageSelectorDialog.tsx b/react/features/subtitles/components/web/LanguageSelectorDialog.tsxindex 62be88dd4e..4882b66904 100644--- a/react/features/subtitles/components/web/LanguageSelectorDialog.tsx+++ b/react/features/subtitles/components/web/LanguageSelectorDialog.tsx@@ -2,8 +2,10 @@ import i18next from 'i18next';import React, { useCallback } from 'react';import { makeStyles } from 'tss-react/mui';+import { openDialog } from '../../../base/dialog/actions';import { translate, translateToHTML } from '../../../base/i18n/functions';import Dialog from '../../../base/ui/components/web/Dialog';+import { StartRecordingDialog } from '../../../recording/components/Recording';import { openSettingsDialog } from '../../../settings/actions.web';import { SETTINGS_TABS } from '../../../settings/constants';import { toggleLanguageSelectorDialog } from '../../actions.web';@@ -35,14 +37,20 @@ const useStyles = makeStyles()(theme => {const LanguageSelectorDialog = (props: IAbstractLanguageSelectorDialogProps) => {- const { dispatch, language, listItems, onLanguageSelected, subtitles, t } = props;+ const { asyncTranscription, dispatch, language, listItems, onLanguageSelected, subtitles, t } = props;const { classes: styles } = useStyles();const onSelected = useCallback((e: string) => {- onLanguageSelected(e);+ if (asyncTranscription) {+ dispatch(openDialog('StartRecordingDialog', StartRecordingDialog, {+ recordAudioAndVideo: false+ }));+ } else {+ onLanguageSelected(e);+ }dispatch(toggleLanguageSelectorDialog());- }, [ language ]);+ }, [ asyncTranscription, language ]);const onSourceLanguageClick = useCallback(() => {dispatch(openSettingsDialog(SETTINGS_TABS.MORE, false));