feat(dialog) start recording/live stream screens, new AlertDialog

This commit is contained in:
Calin Chitu
2022-02-08 13:25:32 +02:00
committed by Calinteodor
parent f38702bb65
commit 8a6b6f2942
22 changed files with 390 additions and 340 deletions

View File

@@ -1,6 +1,5 @@
// @flow
import { openDialog } from '../../../base/dialog';
import { IconLiveStreaming } from '../../../base/icons';
import { JitsiRecordingConstants } from '../../../base/lib-jitsi-meet';
import {
@@ -13,10 +12,6 @@ import { maybeShowPremiumFeatureDialog } from '../../../jaas/actions';
import { FEATURES } from '../../../jaas/constants';
import { getActiveSession } from '../../functions';
import {
StartLiveStreamDialog,
StopLiveStreamDialog
} from './_';
/**
* The type of the React {@code Component} props of
@@ -24,16 +19,16 @@ import {
*/
export type Props = AbstractButtonProps & {
/**
* True if there is a running active live stream, false otherwise.
*/
_isLiveStreamRunning: boolean,
/**
* True if the button needs to be disabled.
*/
_disabled: Boolean,
/**
* True if there is a running active live stream, false otherwise.
*/
_isLiveStreamRunning: boolean,
/**
* The tooltip to display when hovering over the button.
*/
@@ -69,6 +64,17 @@ export default class AbstractLiveStreamButton<P: Props> extends AbstractButton<P
return this.props._tooltip || '';
}
/**
* Helper function to be implemented by subclasses, which should be used
* to handle the live stream button being clicked / pressed.
*
* @protected
* @returns {void}
*/
_onHandleClick() {
// To be implemented by subclass.
}
/**
* Handles clicking / pressing the button.
*
@@ -77,14 +83,12 @@ export default class AbstractLiveStreamButton<P: Props> extends AbstractButton<P
* @returns {void}
*/
async _handleClick() {
const { _isLiveStreamRunning, dispatch } = this.props;
const { dispatch } = this.props;
const dialogShown = await dispatch(maybeShowPremiumFeatureDialog(FEATURES.RECORDING));
if (!dialogShown) {
dispatch(openDialog(
_isLiveStreamRunning ? StopLiveStreamDialog : StartLiveStreamDialog
));
this._onHandleClick();
}
}