feat(branding) Add premeeting background image overwrite

This commit is contained in:
hmuresan 2021-08-26 12:26:38 +03:00 committed by Horatiu Muresan
parent b14e571d5c
commit 6c40329f6a
3 changed files with 42 additions and 14 deletions

View File

@ -794,7 +794,11 @@ var config = {
// The anchor url used when clicking the logo image // The anchor url used when clicking the logo image
logoClickUrl: 'https://example-company.org', logoClickUrl: 'https://example-company.org',
// The url used for the image used as logo // The url used for the image used as logo
logoImageUrl: 'https://example.com/logo-img.png' logoImageUrl: 'https://example.com/logo-img.png',
// Overwrite for pool of background images for avatars
avatarBackgrounds: ['url(https://example.com/avatar-background-1.png)', '#FFF'],
// The lobby/prejoin screen background
premeetingBackground: 'url(https://example.com/premeeting-background.png)'
} }
*/ */
// dynamicBrandingUrl: '', // dynamicBrandingUrl: '',

View File

@ -17,6 +17,11 @@ type Props = {
*/ */
_buttons: Array<string>, _buttons: Array<string>,
/**
* The branding background of the premeeting screen(lobby/prejoin).
*/
_premeetingBackground: string,
/** /**
* Children component(s) to be rendered on the screen. * Children component(s) to be rendered on the screen.
*/ */
@ -91,6 +96,7 @@ class PreMeetingScreen extends PureComponent<Props> {
render() { render() {
const { const {
_buttons, _buttons,
_premeetingBackground,
children, children,
className, className,
showDeviceStatus, showDeviceStatus,
@ -101,9 +107,15 @@ class PreMeetingScreen extends PureComponent<Props> {
} = this.props; } = this.props;
const containerClassName = `premeeting-screen ${className ? className : ''}`; const containerClassName = `premeeting-screen ${className ? className : ''}`;
const style = _premeetingBackground ? {
background: _premeetingBackground,
backgroundPosition: 'center',
backgroundSize: 'cover'
} : {};
return ( return (
<div className = { containerClassName }> <div className = { containerClassName }>
<div style = { style }>
<div className = 'content'> <div className = 'content'>
<ConnectionStatus /> <ConnectionStatus />
@ -117,7 +129,7 @@ class PreMeetingScreen extends PureComponent<Props> {
{ showDeviceStatus && <DeviceStatus /> } { showDeviceStatus && <DeviceStatus /> }
</div> </div>
</div> </div>
</div>
<Preview <Preview
videoMuted = { videoMuted } videoMuted = { videoMuted }
videoTrack = { videoTrack } /> videoTrack = { videoTrack } />
@ -139,9 +151,11 @@ function mapStateToProps(state, ownProps): Object {
const premeetingButtons = ownProps.thirdParty const premeetingButtons = ownProps.thirdParty
? THIRD_PARTY_PREJOIN_BUTTONS ? THIRD_PARTY_PREJOIN_BUTTONS
: PREMEETING_BUTTONS; : PREMEETING_BUTTONS;
const { premeetingBackground } = state['features/dynamic-branding'];
return { return {
_buttons: premeetingButtons.filter(b => !hideButtons.includes(b)) _buttons: premeetingButtons.filter(b => !hideButtons.includes(b)),
_premeetingBackground: premeetingBackground
}; };
} }

View File

@ -99,6 +99,14 @@ const DEFAULT_STATE = {
*/ */
logoImageUrl: '', logoImageUrl: '',
/**
* The lobby/prejoin background.
*
* @public
* @type {string}
*/
premeetingBackground: '',
/** /**
* Flag used to signal if the app should use a custom logo or not * Flag used to signal if the app should use a custom logo or not
* *
@ -115,6 +123,7 @@ ReducerRegistry.register(STORE_NAME, (state = DEFAULT_STATE, action) => {
switch (action.type) { switch (action.type) {
case SET_DYNAMIC_BRANDING_DATA: { case SET_DYNAMIC_BRANDING_DATA: {
const { const {
avatarBackgrounds,
backgroundColor, backgroundColor,
backgroundImageUrl, backgroundImageUrl,
defaultBranding, defaultBranding,
@ -122,7 +131,7 @@ ReducerRegistry.register(STORE_NAME, (state = DEFAULT_STATE, action) => {
inviteDomain, inviteDomain,
logoClickUrl, logoClickUrl,
logoImageUrl, logoImageUrl,
avatarBackgrounds premeetingBackground
} = action.value; } = action.value;
return { return {
@ -134,6 +143,7 @@ ReducerRegistry.register(STORE_NAME, (state = DEFAULT_STATE, action) => {
inviteDomain, inviteDomain,
logoClickUrl, logoClickUrl,
logoImageUrl, logoImageUrl,
premeetingBackground,
customizationFailed: false, customizationFailed: false,
customizationReady: true, customizationReady: true,
useDynamicBrandingData: true useDynamicBrandingData: true