Merge pull request #6182 from antobinary/custom-configs

Drop metadata configs; use userdata configs for autoSwap
This commit is contained in:
Anton Georgiev 2018-10-24 13:07:47 -04:00 committed by GitHub
commit 2d1ad1fcd9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 79 additions and 225 deletions

View File

@ -1,4 +1,3 @@
import { Meteor } from 'meteor/meteor';
import { check } from 'meteor/check';
import addUserSetting from '/imports/api/users-settings/server/modifiers/addUserSetting';
@ -30,6 +29,9 @@ export default function addUserSettings(credentials, meetingId, userId, settings
'multiUserPenOnly',
'presenterTools',
'multiUserTools',
'autoSwapLayout',
'autoShareWebcam',
'hidePresentation',
];
if (!handledHTML5Parameters.includes(key)) {
return acc;

View File

@ -1,5 +1,4 @@
import Auth from '/imports/ui/services/auth';
import SessionStorage from '/imports/ui/services/storage/session';
import { setCustomLogoUrl } from '/imports/ui/components/user-list/service';
import { log, makeCall } from '/imports/ui/services/api';
import deviceInfo from '/imports/utils/deviceInfo';
@ -7,7 +6,6 @@ import logger from '/imports/startup/client/logger';
// disconnected and trying to open a new connection
const STATUS_CONNECTING = 'connecting';
const METADATA_KEY = 'metadata';
export function joinRouteHandler(nextState, replace, callback) {
const { sessionToken } = nextState.location.query;
@ -27,7 +25,7 @@ export function joinRouteHandler(nextState, replace, callback) {
.then(response => response.json())
.then(({ response }) => {
const {
returncode, meetingID, internalUserID, authToken, logoutUrl, customLogoURL, metadata,
returncode, meetingID, internalUserID, authToken, logoutUrl, customLogoURL,
externUserID, fullname, confname, customdata,
} = response;
@ -38,34 +36,10 @@ export function joinRouteHandler(nextState, replace, callback) {
setCustomLogoUrl(customLogoURL);
const metakeys = metadata.length
? metadata.reduce((acc, meta) => {
const key = Object.keys(meta).shift();
const handledHTML5Parameters = [
'html5autoswaplayout', 'html5autosharewebcam', 'html5hidepresentation',
];
if (handledHTML5Parameters.indexOf(key) === -1) {
return acc;
}
/* this reducer transforms array of objects in a single object and
forces the metadata a be boolean value */
let value = meta[key];
try {
value = JSON.parse(meta[key]);
} catch (e) {
log('error', `Caught: ${e.message}`);
}
return { ...acc, [key]: value };
}, {}) : {};
if (customdata.length) {
makeCall('addUserSettings', meetingID, internalUserID, customdata);
}
SessionStorage.setItem(METADATA_KEY, metakeys);
Auth.set(
meetingID, internalUserID, authToken, logoutUrl,
sessionToken, fullname, externUserID, confname,

View File

@ -1,8 +1,8 @@
import React, { Component } from 'react';
import { withTracker } from 'meteor/react-meteor-data';
import SessionStorage from '/imports/ui/services/storage/session';
import Settings from '/imports/ui/services/settings';
import { defineMessages, injectIntl } from 'react-intl';
import { defineMessages, injectIntl, intlShape } from 'react-intl';
import PropTypes from 'prop-types';
import { notify } from '/imports/ui/services/notification';
import VideoService from '/imports/ui/components/video-provider/service';
import getFromUserSettings from '/imports/ui/services/users-settings';
@ -12,6 +12,14 @@ import PresentationPodsContainer from '../presentation-pod/container';
import ScreenshareContainer from '../screenshare/container';
import DefaultContent from '../presentation/default-content/component';
const LAYOUT_CONFIG = Meteor.settings.public.layout;
const KURENTO_CONFIG = Meteor.settings.public.kurento;
const propTypes = {
isScreensharing: PropTypes.bool.isRequired,
intl: intlShape.isRequired,
};
const intlMessages = defineMessages({
screenshareStarted: {
id: 'app.media.screenshare.start',
@ -38,16 +46,13 @@ const intlMessages = defineMessages({
class MediaContainer extends Component {
componentWillMount() {
const { willMount } = this.props;
willMount && willMount();
if (willMount) {
willMount();
}
document.addEventListener('installChromeExtension', this.installChromeExtension.bind(this));
document.addEventListener('safariScreenshareNotSupported', this.safariScreenshareNotSupported.bind(this));
}
componentWillUnmount() {
document.removeEventListener('installChromeExtension', this.installChromeExtension.bind(this));
document.removeEventListener('safariScreenshareNotSupported', this.safariScreenshareNotSupported.bind(this));
}
componentWillReceiveProps(nextProps) {
const {
isScreensharing,
@ -63,19 +68,27 @@ class MediaContainer extends Component {
}
}
componentWillUnmount() {
document.removeEventListener('installChromeExtension', this.installChromeExtension.bind(this));
document.removeEventListener('safariScreenshareNotSupported', this.safariScreenshareNotSupported.bind(this));
}
installChromeExtension() {
const { intl } = this.props;
const CHROME_DEFAULT_EXTENSION_LINK = Meteor.settings.public.kurento.chromeDefaultExtensionLink;
const CHROME_CUSTOM_EXTENSION_LINK = Meteor.settings.public.kurento.chromeExtensionLink;
const CHROME_DEFAULT_EXTENSION_LINK = KURENTO_CONFIG.chromeDefaultExtensionLink;
const CHROME_CUSTOM_EXTENSION_LINK = KURENTO_CONFIG.chromeExtensionLink;
const CHROME_EXTENSION_LINK = CHROME_CUSTOM_EXTENSION_LINK === 'LINK' ? CHROME_DEFAULT_EXTENSION_LINK : CHROME_CUSTOM_EXTENSION_LINK;
notify(<div>
const chromeErrorElement = (
<div>
{intl.formatMessage(intlMessages.chromeExtensionError)}{' '}
<a href={CHROME_EXTENSION_LINK} target="_blank">
{intl.formatMessage(intlMessages.chromeExtensionErrorLink)}
</a>
</div>, 'error', 'desktop');
</div>
);
notify(chromeErrorElement, 'error', 'desktop');
}
safariScreenshareNotSupported() {
@ -92,7 +105,7 @@ export default withTracker(() => {
const { dataSaving } = Settings;
const { viewParticipantsWebcams, viewScreenshare } = dataSaving;
const hidePresentation = SessionStorage.getItem('metadata').html5hidepresentation || false;
const hidePresentation = getFromUserSettings('hidePresentation', LAYOUT_CONFIG.hidePresentation);
const data = {
children: <DefaultContent />,
};
@ -121,12 +134,13 @@ export default withTracker(() => {
data.hideOverlay = hidePresentation;
}
const enableVideo = getFromUserSettings('enableVideo', Meteor.settings.public.kurento.enableVideo);
const autoShareWebcam = SessionStorage.getItem('metadata').html5autosharewebcam || false;
const enableVideo = getFromUserSettings('enableVideo', KURENTO_CONFIG.enableVideo);
const autoShareWebcam = getFromUserSettings('autoShareWebcam', KURENTO_CONFIG.autoShareWebcam);
if (enableVideo && autoShareWebcam) {
data.willMount = VideoService.joinVideo;
}
MediaContainer.propTypes = propTypes;
return data;
})(injectIntl(MediaContainer));

View File

@ -1,4 +1,3 @@
import SessionStorage from '/imports/ui/services/storage/session';
import Presentations from '/imports/api/presentations';
import { isVideoBroadcasting } from '/imports/ui/components/screenshare/service';
import Auth from '/imports/ui/services/auth';
@ -8,6 +7,9 @@ import VideoService from '/imports/ui/components/video-provider/service';
import PollingService from '/imports/ui/components/polling/service';
import getFromUserSettings from '/imports/ui/services/users-settings';
const LAYOUT_CONFIG = Meteor.settings.public.layout;
const KURENTO_CONFIG = Meteor.settings.public.kurento;
const getPresentationInfo = () => {
const currentPresentation = Presentations.findOne({
current: true,
@ -25,11 +27,11 @@ function shouldShowWhiteboard() {
}
function shouldShowScreenshare() {
return isVideoBroadcasting() && getFromUserSettings('enableScreensharing', Meteor.settings.public.kurento.enableScreensharing);
return isVideoBroadcasting() && getFromUserSettings('enableScreensharing', KURENTO_CONFIG.enableScreensharing);
}
function shouldShowOverlay() {
return getFromUserSettings('enableVideo', Meteor.settings.public.kurento.enableVideo);
return getFromUserSettings('enableVideo', KURENTO_CONFIG.enableVideo);
}
const swapLayout = {
@ -54,8 +56,8 @@ export const shouldEnableSwapLayout = () => {
export const getSwapLayout = () => {
swapLayout.tracker.depend();
const metaAutoSwapLayout = SessionStorage.getItem('metadata').html5autoswaplayout || false;
return metaAutoSwapLayout || (swapLayout.value && shouldEnableSwapLayout());
const autoSwapLayout = getFromUserSettings('autoSwapLayout', LAYOUT_CONFIG.autoSwapLayout);
return autoSwapLayout || (swapLayout.value && shouldEnableSwapLayout());
};
export default {

View File

@ -1,16 +1,9 @@
import React, { Component } from 'react';
import { FormattedMessage, FormattedDate } from 'react-intl';
import React from 'react';
import { FormattedMessage } from 'react-intl';
import { TransitionGroup, CSSTransition } from 'react-transition-group';
import { styles } from './styles.scss';
import Button from '../../button/component';
export default class DefaultContent extends Component {
static handleClick() {
console.log('dummy handler');
}
render() {
return (
export default () => (
<TransitionGroup>
<CSSTransition
classNames={{
@ -23,153 +16,18 @@ export default class DefaultContent extends Component {
timeout={{ enter: 400 }}
className={styles.contentWrapper}
>
<div className={styles.contentRatio}>
<div className={styles.content}>
<div className={styles.defaultContent}>
<p>
<FormattedMessage
id="app.home.greeting"
description="Message to greet the user."
defaultMessage="Welcome {0}! Your presentation will begin shortly..."
values={{ 0: 'James Bond' }}
defaultMessage="Your presentation will begin shortly..."
/>
<br />
Today is {' '}<FormattedDate value={Date.now()} />
<br />
Here is some button examples
<br />
</p>
<p>
<Button
label="Small"
onClick={DefaultContent.handleClick}
size="sm"
/>&nbsp;
<Button
label="Medium"
onClick={DefaultContent.handleClick}
/>&nbsp;
<Button
label="Large"
onClick={DefaultContent.handleClick}
size="lg"
/>
</p>
<p>
<Button
label="Default"
onClick={DefaultContent.handleClick}
/>&nbsp;
<Button
label="Primary"
onClick={DefaultContent.handleClick}
color="primary"
/>&nbsp;
<Button
label="Danger"
onClick={DefaultContent.handleClick}
color="danger"
/>&nbsp;
<Button
label="Success"
onClick={DefaultContent.handleClick}
color="success"
/>
</p>
<p>
<Button
label="Default"
onClick={DefaultContent.handleClick}
ghost
/>&nbsp;
<Button
label="Primary"
onClick={DefaultContent.handleClick}
color="primary"
ghost
/>&nbsp;
<Button
label="Danger"
onClick={DefaultContent.handleClick}
color="danger"
ghost
/>&nbsp;
<Button
label="Success"
onClick={DefaultContent.handleClick}
color="success"
ghost
/>
</p>
<p>
<Button
label="With Icon"
onClick={DefaultContent.handleClick}
icon="add"
/>&nbsp;
<Button
label="Ghost With Icon"
onClick={DefaultContent.handleClick}
color="primary"
icon="add"
ghost
/>&nbsp;
<Button
label="Icon Right"
onClick={DefaultContent.handleClick}
color="danger"
icon="add"
ghost
iconRight
/>&nbsp;
<Button
label="Icon Right"
onClick={DefaultContent.handleClick}
color="success"
icon="add"
iconRight
/>
</p>
<p>
<Button
label="Medium"
onClick={DefaultContent.handleClick}
color="primary"
icon="unmute"
ghost
circle
/>&nbsp;
<Button
label="Large"
onClick={DefaultContent.handleClick}
color="danger"
icon="unmute"
size="lg"
ghost
circle
/><br />
<Button
label="Small"
onClick={DefaultContent.handleClick}
icon="unmute"
size="sm"
circle
/>&nbsp;
<Button
label="Icon Right"
onClick={DefaultContent.handleClick}
color="success"
icon="unmute"
size="sm"
iconRight
circle
/>
</p>
</div>
</div>
</div>
</CSSTransition>
</TransitionGroup>
);
}
}
);

View File

@ -98,6 +98,7 @@ public:
enableVideo: false
enableVideoStats: false
enableListenOnly: false
autoShareWebcam: false
acl:
viewer:
subscriptions:
@ -170,6 +171,9 @@ public:
path_route: users/chat/
system_messages_keys:
chat_clear: PUBLIC_CHAT_CLEAR
layout:
autoSwapLayout: false
hidePresentation: false
media:
WebRTCHangupRetryInterval: 2000
vertoServerAddress: HOST

View File

@ -1,5 +1,5 @@
{
"app.home.greeting": "Welcome {0}! Your presentation will begin shortly...",
"app.home.greeting": "Your presentation will begin shortly...",
"app.chat.submitLabel": "Send Message",
"app.chat.errorMinMessageLength": "The message is {0} characters(s) too short",
"app.chat.errorMaxMessageLength": "The message is {0} characters(s) too long",