Skip to content

Jitsi Meet - Secure, Simple and Scalable Video Conferences that you use as a standalone app or embed in your web application.

fix(rn,recording) fix start button not being enabled

Calinteodor3fcfb643384d
diff --git a/react/features/recording/components/Recording/StartRecordingDialogContent.js b/react/features/recording/components/Recording/StartRecordingDialogContent.js
index 638734d009..fbb02d8f40 100644
--- a/react/features/recording/components/Recording/StartRecordingDialogContent.js
+++ b/react/features/recording/components/Recording/StartRecordingDialogContent.js
@@ -379,10 +379,7 @@ class StartRecordingDialogContent extends Component<Props> {
<Container>
<Container
className = 'recording-header recording-header-line'
- style = { [
- styles.headerIntegrations,
- _dialogStyles.topBorderContainer
- ] }>
+ style = { styles.headerIntegrations }>
<Container
className = 'recording-icon-container'>
<Image
diff --git a/react/features/recording/components/Recording/native/StartRecordingDialog.js b/react/features/recording/components/Recording/native/StartRecordingDialog.js
index 36eca6a5a6..79eba0bf4a 100644
--- a/react/features/recording/components/Recording/native/StartRecordingDialog.js
+++ b/react/features/recording/components/Recording/native/StartRecordingDialog.js
@@ -9,6 +9,7 @@ import HeaderNavigationButton
from '../../../../mobile/navigation/components/HeaderNavigationButton';
import { goBack } from
'../../../../mobile/navigation/components/conference/ConferenceNavigationContainerRef';
+import { RECORDING_TYPES } from '../../../constants';
import AbstractStartRecordingDialog, {
type Props,
mapStateToProps
@@ -43,30 +44,34 @@ class StartRecordingDialog extends AbstractStartRecordingDialog<Props> {
* @returns {void}
*/
componentDidMount() {
- const {
- _fileRecordingsServiceEnabled,
- _isDropboxEnabled,
- navigation,
- t
- } = this.props;
+ const { navigation, t } = this.props;
- const {
- isTokenValid,
- isValidating
- } = this.state;
+ navigation.setOptions({
+ headerRight: () => (
+ <HeaderNavigationButton
+ disabled = { this.isStartRecordingDisabled() }
+ label = { t('dialog.start') }
+ onPress = { this._onStartPress }
+ twoActions = { true } />
+ )
+ });
+ }
- // disable start button id recording service is shown only, when
- // validating dropbox token, if that is not enabled we either always
- // show the start button or if just dropbox is enabled start is available
- // when there is token
- const isStartDisabled
- = _fileRecordingsServiceEnabled ? isValidating
- : _isDropboxEnabled ? !isTokenValid : false;
+ /**
+ * Implements React's {@link Component#componentDidUpdate()}. Invoked
+ * immediately after this component is updated.
+ *
+ * @inheritdoc
+ * @returns {void}
+ */
+ componentDidUpdate() {
+ const { navigation, t } = this.props;
navigation.setOptions({
+ // eslint-disable-next-line react/no-multi-comp
headerRight: () => (
<HeaderNavigationButton
- disabled = { isStartDisabled }
+ disabled = { this.isStartRecordingDisabled() }
label = { t('dialog.start') }
onPress = { this._onStartPress }
twoActions = { true } />
@@ -85,6 +90,30 @@ class StartRecordingDialog extends AbstractStartRecordingDialog<Props> {
this._onSubmit() && goBack();
}
+ isStartRecordingDisabled: () => boolean;
+
+ /**
+ * Disables start recording button.
+ *
+ * @returns {boolean}
+ */
+ isStartRecordingDisabled() {
+ const { isTokenValid, selectedRecordingService } = this.state;
+
+ // Start button is disabled if recording service is only shown;
+ // When validating dropbox token, if that is not enabled, we either always
+ // show the start button or, if just dropbox is enabled, start button
+ // is available when there is token.
+ if (selectedRecordingService === RECORDING_TYPES.JITSI_REC_SERVICE) {
+ return false;
+ } else if (selectedRecordingService === RECORDING_TYPES.DROPBOX) {
+ return !isTokenValid;
+ }
+
+ return true;
+
+ }
+
/**
* Implements React's {@link Component#render()}.
*
diff --git a/react/features/recording/components/Recording/web/StartRecordingDialog.js b/react/features/recording/components/Recording/web/StartRecordingDialog.js
index 83a770e8af..0085ba1286 100644
--- a/react/features/recording/components/Recording/web/StartRecordingDialog.js
+++ b/react/features/recording/components/Recording/web/StartRecordingDialog.js
@@ -7,6 +7,7 @@ import { translate } from '../../../../base/i18n';
import { connect } from '../../../../base/redux';
import { toggleScreenshotCaptureSummary } from '../../../../screenshot-capture';
import { isScreenshotCaptureEnabled } from '../../../../screenshot-capture/functions';
+import { RECORDING_TYPES } from '../../../constants';
import AbstractStartRecordingDialog, {
mapStateToProps as abstractMapStateToProps
} from '../AbstractStartRecordingDialog';
@@ -19,6 +20,30 @@ import StartRecordingDialogContent from '../StartRecordingDialogContent';
* @augments Component
*/
class StartRecordingDialog extends AbstractStartRecordingDialog {
+
+ isStartRecordingDisabled: () => boolean;
+
+ /**
+ * Disables start recording button.
+ *
+ * @returns {boolean}
+ */
+ isStartRecordingDisabled() {
+ const { isTokenValid, selectedRecordingService } = this.state;
+
+ // Start button is disabled if recording service is only shown;
+ // When validating dropbox token, if that is not enabled, we either always
+ // show the start button or, if just dropbox is enabled, start button
+ // is available when there is token.
+ if (selectedRecordingService === RECORDING_TYPES.JITSI_REC_SERVICE) {
+ return false;
+ } else if (selectedRecordingService === RECORDING_TYPES.DROPBOX) {
+ return !isTokenValid;
+ }
+
+ return true;
+ }
+
/**
* Implements React's {@link Component#render()}.
*
@@ -33,19 +58,14 @@ class StartRecordingDialog extends AbstractStartRecordingDialog {
spaceLeft,
userName
} = this.state;
- const { _fileRecordingsServiceEnabled, _fileRecordingsServiceSharingEnabled, _isDropboxEnabled } = this.props;
-
- // disable ok button id recording service is shown only, when
- // validating dropbox token, if that is not enabled we either always
- // show the ok button or if just dropbox is enabled ok is available
- // when there is token
- const isOkDisabled
- = _fileRecordingsServiceEnabled ? isValidating
- : _isDropboxEnabled ? !isTokenValid : false;
+ const {
+ _fileRecordingsServiceEnabled,
+ _fileRecordingsServiceSharingEnabled
+ } = this.props;
return (
<Dialog
- okDisabled = { isOkDisabled }
+ okDisabled = { this.isStartRecordingDisabled() }
okKey = 'dialog.startRecording'
onSubmit = { this._onSubmit }
titleKey = 'dialog.startRecording'