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

View File

@ -7,7 +7,6 @@ import {
sendAnalytics sendAnalytics
} from '../../../analytics'; } from '../../../analytics';
import { JitsiRecordingConstants } from '../../../base/lib-jitsi-meet'; import { JitsiRecordingConstants } from '../../../base/lib-jitsi-meet';
import { toggleScreenshotCaptureSummary } from '../../../screenshot-capture';
import { getActiveSession } from '../../functions'; 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. // Bind event handler so it is only bound once for every instance.
this._onSubmit = this._onSubmit.bind(this); this._onSubmit = this._onSubmit.bind(this);
this._toggleScreenshotCapture = this._toggleScreenshotCapture.bind(this);
} }
_onSubmit: () => boolean; _onSubmit: () => boolean;
@ -72,11 +72,16 @@ export default class AbstractStopRecordingDialog<P: Props>
if (_fileRecordingSession) { if (_fileRecordingSession) {
this.props._conference.stopRecording(_fileRecordingSession.id); this.props._conference.stopRecording(_fileRecordingSession.id);
this.props.dispatch(toggleScreenshotCaptureSummary(false)); this._toggleScreenshotCapture();
} }
return true; 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 { Dialog } from '../../../../base/dialog';
import { translate } from '../../../../base/i18n'; import { translate } from '../../../../base/i18n';
import { connect } from '../../../../base/redux'; import { connect } from '../../../../base/redux';
import { isScreenVideoShared } from '../../../../screen-share';
import { toggleScreenshotCaptureSummary } from '../../../../screenshot-capture';
import AbstractStartRecordingDialog, { import AbstractStartRecordingDialog, {
mapStateToProps mapStateToProps as abstractMapStateToProps
} from '../AbstractStartRecordingDialog'; } from '../AbstractStartRecordingDialog';
import StartRecordingDialogContent from '../StartRecordingDialogContent'; 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; _areIntegrationsEnabled: () => boolean;
_onSubmit: () => boolean; _onSubmit: () => boolean;
_onSelectedRecordingServiceChanged: (string) => void; _onSelectedRecordingServiceChanged: (string) => void;
_onSharingSettingChanged: () => 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)); export default translate(connect(mapStateToProps)(StartRecordingDialog));

View File

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