From 71d0577a49231763f76f5ea98a907ded0960768b Mon Sep 17 00:00:00 2001 From: Vlad Piersec Date: Tue, 25 Aug 2020 14:57:35 +0300 Subject: [PATCH] feat(vpaas): Add endpoint counter & remove branding on vpaas meetings --- react/features/app/actions.js | 6 ++ react/features/app/middlewares.any.js | 1 + .../base/react/components/web/Watermarks.js | 55 +++++++++-- react/features/billing-counter/actionTypes.js | 4 + react/features/billing-counter/actions.js | 51 +++++++++++ react/features/billing-counter/constants.js | 9 ++ react/features/billing-counter/functions.js | 91 +++++++++++++++++++ react/features/billing-counter/logger.js | 5 + react/features/billing-counter/middleware.js | 31 +++++++ .../components/ChromeExtensionBanner.web.js | 12 ++- .../Recording/StartRecordingDialogContent.js | 13 ++- 11 files changed, 266 insertions(+), 12 deletions(-) create mode 100644 react/features/billing-counter/actionTypes.js create mode 100644 react/features/billing-counter/actions.js create mode 100644 react/features/billing-counter/constants.js create mode 100644 react/features/billing-counter/functions.js create mode 100644 react/features/billing-counter/logger.js create mode 100644 react/features/billing-counter/middleware.js diff --git a/react/features/app/actions.js b/react/features/app/actions.js index 7f45c68c6..6f614a06a 100644 --- a/react/features/app/actions.js +++ b/react/features/app/actions.js @@ -24,6 +24,7 @@ import { parseURIString, toURLString } from '../base/util'; +import { isVpaasMeeting } from '../billing-counter/functions'; import { clearNotifications, showNotification } from '../notifications'; import { setFatalError } from '../overlay'; @@ -291,7 +292,12 @@ export function maybeRedirectToWelcomePage(options: Object = {}) { // if close page is enabled redirect to it, without further action if (enableClosePage) { + if (isVpaasMeeting(getState())) { + redirectToStaticPage('/'); + } + const { isGuest, jwt } = getState()['features/base/jwt']; + let hashParam; // save whether current user is guest or not, and pass auth token, diff --git a/react/features/app/middlewares.any.js b/react/features/app/middlewares.any.js index 20d05f1c0..95fa4e4a4 100644 --- a/react/features/app/middlewares.any.js +++ b/react/features/app/middlewares.any.js @@ -18,6 +18,7 @@ import '../base/sounds/middleware'; import '../base/testing/middleware'; import '../base/tracks/middleware'; import '../base/user-interaction/middleware'; +import '../billing-counter/middleware'; import '../calendar-sync/middleware'; import '../chat/middleware'; import '../conference/middleware'; diff --git a/react/features/base/react/components/web/Watermarks.js b/react/features/base/react/components/web/Watermarks.js index 36c39d938..c23c3eb29 100644 --- a/react/features/base/react/components/web/Watermarks.js +++ b/react/features/base/react/components/web/Watermarks.js @@ -2,9 +2,11 @@ import React, { Component } from 'react'; +import { isVpaasMeeting } from '../../../../billing-counter/functions'; import { translate } from '../../../i18n'; import { connect } from '../../../redux'; + declare var interfaceConfig: Object; /** @@ -36,6 +38,11 @@ type Props = { */ _isGuest: boolean, + /** + * Whether or not the current meeting is a vpaas one. + */ + _isVpaas: boolean, + /** * Flag used to signal that the logo can be displayed. * It becomes true after the user customization options are fetched. @@ -181,6 +188,33 @@ class Watermarks extends Component { || _welcomePageIsVisible; } + /** + * Returns the background image style. + * + * @private + * @returns {string} + */ + _getBackgroundImageStyle() { + const { + _customLogoUrl, + _isVpaas, + defaultJitsiLogoURL + } = this.props; + let style = 'none'; + + if (_isVpaas) { + if (_customLogoUrl) { + style = `url(${_customLogoUrl})`; + } + } else { + style = `url(${_customLogoUrl + || defaultJitsiLogoURL + || interfaceConfig.DEFAULT_LOGO_URL})`; + } + + return style; + } + /** * Renders a brand watermark if it is enabled. * @@ -221,18 +255,22 @@ class Watermarks extends Component { */ _renderJitsiWatermark() { let reactElement = null; - const { - _customLogoUrl, - _customLogoLink, - defaultJitsiLogoURL - } = this.props; if (this._canDisplayJitsiWatermark()) { - const link = _customLogoLink || this.state.jitsiWatermarkLink; + const backgroundImage = this._getBackgroundImageStyle(); + const link = this.props._customLogoLink || this.state.jitsiWatermarkLink; + const additionalStyles = {}; + + if (backgroundImage === 'none') { + additionalStyles.height = 0; + additionalStyles.width = 0; + } + const style = { - backgroundImage: `url(${_customLogoUrl || defaultJitsiLogoURL || interfaceConfig.DEFAULT_LOGO_URL})`, + backgroundImage, maxWidth: 140, - maxHeight: 70 + maxHeight: 70, + ...additionalStyles }; reactElement = (
next => async action => { + switch (action.type) { + case SET_BILLING_ID: { + setBillingId(action.value); + + break; + } + + case CONFERENCE_JOINED: { + store.dispatch(countEndpoint()); + + break; + } + + } + + return next(action); +}); diff --git a/react/features/chrome-extension-banner/components/ChromeExtensionBanner.web.js b/react/features/chrome-extension-banner/components/ChromeExtensionBanner.web.js index 5abf91450..bae5f0f53 100644 --- a/react/features/chrome-extension-banner/components/ChromeExtensionBanner.web.js +++ b/react/features/chrome-extension-banner/components/ChromeExtensionBanner.web.js @@ -16,6 +16,7 @@ import { translate } from '../../base/i18n'; import { Icon, IconClose } from '../../base/icons'; import { browser } from '../../base/lib-jitsi-meet'; import { connect } from '../../base/redux'; +import { isVpaasMeeting } from '../../billing-counter/functions'; import logger from '../logger'; @@ -50,6 +51,11 @@ type Props = { */ iAmRecorder: boolean, + /** + * Whether it's a vpaas meeting or not. + */ + isVpaas: boolean, + /** * Invoked to obtain translated strings. */ @@ -146,7 +152,8 @@ class ChromeExtensionBanner extends PureComponent { _isSupportedEnvironment() { return interfaceConfig.SHOW_CHROME_EXTENSION_BANNER && browser.isChrome() - && !isMobileBrowser(); + && !isMobileBrowser() + && !this.props.isVpaas; } _onClosePressed: () => void; @@ -280,7 +287,8 @@ const _mapStateToProps = state => { // Using emptyObject so that we don't change the reference every time when _mapStateToProps is called. bannerCfg: state['features/base/config'].chromeExtensionBanner || emptyObject, conference: getCurrentConference(state), - iAmRecorder: state['features/base/config'].iAmRecorder + iAmRecorder: state['features/base/config'].iAmRecorder, + isVpaas: isVpaasMeeting(state) }; }; diff --git a/react/features/recording/components/Recording/StartRecordingDialogContent.js b/react/features/recording/components/Recording/StartRecordingDialogContent.js index 843ba6053..703481d56 100644 --- a/react/features/recording/components/Recording/StartRecordingDialogContent.js +++ b/react/features/recording/components/Recording/StartRecordingDialogContent.js @@ -21,6 +21,7 @@ import { } from '../../../base/react'; import { connect } from '../../../base/redux'; import { ColorPalette, StyleType } from '../../../base/styles'; +import { isVpaasMeeting } from '../../../billing-counter/functions'; import { authorizeDropbox, updateDropboxToken } from '../../../dropbox'; import { RECORDING_TYPES } from '../../constants'; import { getRecordingDurationEstimation } from '../../functions'; @@ -72,6 +73,11 @@ type Props = { */ isValidating: boolean, + /** + * Whether or not the current meeting is a vpaas one. + */ + isVpaas: boolean, + /** * The function will be called when there are changes related to the * switches. @@ -226,7 +232,7 @@ class StartRecordingDialogContent extends Component { return null; } - const { _dialogStyles, _styles: styles, isValidating, t } = this.props; + const { _dialogStyles, _styles: styles, isValidating, isVpaas, t } = this.props; const switchContent = this.props.integrationsEnabled @@ -240,6 +246,8 @@ class StartRecordingDialogContent extends Component { value = { this.props.selectedRecordingService === RECORDING_TYPES.JITSI_REC_SERVICE } /> ) : null; + const icon = isVpaas ? ICON_SHARE : JITSI_LOGO; + return ( { { function _mapStateToProps(state) { return { ..._abstractMapStateToProps(state), + isVpaas: isVpaasMeeting(state), _styles: ColorSchemeRegistry.get(state, 'StartRecordingDialogContent') }; }