fix(screenshot-capture) Use feature on web only

Fixes broken native
This commit is contained in:
robertpin 2021-12-09 10:19:29 +02:00 committed by Saúl Ibarra Corretgé
parent 41f11e5adb
commit d96ecc5b65
4 changed files with 59 additions and 10 deletions

View File

@ -14,8 +14,6 @@ import {
updateDropboxToken
} from '../../../dropbox';
import { NOTIFICATION_TIMEOUT_TYPE, showErrorNotification } from '../../../notifications';
import { isScreenVideoShared } from '../../../screen-share';
import { toggleScreenshotCaptureSummary } from '../../../screenshot-capture';
import { toggleRequestingSubtitles } from '../../../subtitles';
import { setSelectedRecordingService } from '../../actions';
import { RECORDING_TYPES } from '../../constants';
@ -64,6 +62,11 @@ type Props = {
*/
_screensharing: boolean,
/**
* Whether or not the screenshot capture feature is enabled.
*/
_screenshotCaptureEnabled: boolean,
/**
* Access token's expiration date as UNIX timestamp.
*/
@ -135,6 +138,7 @@ class AbstractStartRecordingDialog extends Component<Props, State> {
this._onSelectedRecordingServiceChanged
= this._onSelectedRecordingServiceChanged.bind(this);
this._onSharingSettingChanged = this._onSharingSettingChanged.bind(this);
this._toggleScreenshotCapture = this._toggleScreenshotCapture.bind(this);
let selectedRecordingService;
@ -283,7 +287,6 @@ class AbstractStartRecordingDialog extends Component<Props, State> {
_conference,
_isDropboxEnabled,
_rToken,
_screensharing,
_token,
dispatch
} = this.props;
@ -323,9 +326,7 @@ class AbstractStartRecordingDialog extends Component<Props, State> {
createRecordingDialogEvent('start', 'confirm.button', attributes)
);
if (_screensharing) {
dispatch(toggleScreenshotCaptureSummary(true));
}
this._toggleScreenshotCapture();
_conference.startRecording({
mode: JitsiRecordingConstants.mode.FILE,
appData
@ -338,6 +339,11 @@ class AbstractStartRecordingDialog extends Component<Props, State> {
return true;
}
/**
* To be overwritten by web component.
*/
_toggleScreenshotCapture:() => void;
/**
* Renders the platform specific dialog content.
*
@ -381,7 +387,6 @@ export function mapStateToProps(state: Object) {
_fileRecordingsServiceSharingEnabled: fileRecordingsServiceSharingEnabled,
_isDropboxEnabled: isDropboxEnabled(state),
_rToken: state['features/dropbox'].rToken,
_screensharing: isScreenVideoShared(state),
_tokenExpireDate: state['features/dropbox'].expireDate,
_token: state['features/dropbox'].token
};

View File

@ -7,7 +7,6 @@ import {
sendAnalytics
} from '../../../analytics';
import { JitsiRecordingConstants } from '../../../base/lib-jitsi-meet';
import { toggleScreenshotCaptureSummary } from '../../../screenshot-capture';
import { getActiveSession } from '../../functions';
/**
@ -55,6 +54,7 @@ export default class AbstractStopRecordingDialog<P: Props>
// Bind event handler so it is only bound once for every instance.
this._onSubmit = this._onSubmit.bind(this);
this._toggleScreenshotCapture = this._toggleScreenshotCapture.bind(this);
}
_onSubmit: () => boolean;
@ -72,11 +72,16 @@ export default class AbstractStopRecordingDialog<P: Props>
if (_fileRecordingSession) {
this.props._conference.stopRecording(_fileRecordingSession.id);
this.props.dispatch(toggleScreenshotCaptureSummary(false));
this._toggleScreenshotCapture();
}
return true;
}
/**
* To be overwritten by web component.
*/
_toggleScreenshotCapture: () => void;
}
/**

View File

@ -5,8 +5,10 @@ import React from 'react';
import { Dialog } from '../../../../base/dialog';
import { translate } from '../../../../base/i18n';
import { connect } from '../../../../base/redux';
import { isScreenVideoShared } from '../../../../screen-share';
import { toggleScreenshotCaptureSummary } from '../../../../screenshot-capture';
import AbstractStartRecordingDialog, {
mapStateToProps
mapStateToProps as abstractMapStateToProps
} from '../AbstractStartRecordingDialog';
import StartRecordingDialogContent from '../StartRecordingDialogContent';
@ -64,10 +66,37 @@ class StartRecordingDialog extends AbstractStartRecordingDialog {
);
}
/**
* Toggles screenshot capture feature.
*
* @returns {void}
*/
_toggleScreenshotCapture() {
const { dispatch, _screensharing, _screenshotCaptureEnabled } = this.props;
if (_screenshotCaptureEnabled && _screensharing) {
dispatch(toggleScreenshotCaptureSummary(true));
}
}
_areIntegrationsEnabled: () => boolean;
_onSubmit: () => boolean;
_onSelectedRecordingServiceChanged: (string) => void;
_onSharingSettingChanged: () => void;
}
/**
* Maps redux state to component props.
*
* @param {Object} state - Redux state.
* @returns {Object}
*/
function mapStateToProps(state) {
return {
...abstractMapStateToProps(state),
_screensharing: isScreenVideoShared(state),
_screenshotCaptureEnabled: state['features/base/config'].enableScreenshotCapture
};
}
export default translate(connect(mapStateToProps)(StartRecordingDialog));

View File

@ -5,6 +5,7 @@ import React from 'react';
import { Dialog } from '../../../../base/dialog';
import { translate } from '../../../../base/i18n';
import { connect } from '../../../../base/redux';
import { toggleScreenshotCaptureSummary } from '../../../../screenshot-capture';
import AbstractStopRecordingDialog, {
type Props,
_mapStateToProps
@ -38,6 +39,15 @@ class StopRecordingDialog extends AbstractStopRecordingDialog<Props> {
}
_onSubmit: () => boolean;
/**
* Toggles screenshot capture.
*
* @returns {void}
*/
_toggleScreenshotCapture() {
this.props.dispatch(toggleScreenshotCaptureSummary(false));
}
}
export default translate(connect(_mapStateToProps)(StopRecordingDialog));