Fixed screenshare extension toast and removed dock leftover code

This commit is contained in:
prlanzarin 2018-04-27 15:11:40 +00:00
parent 35fae897fb
commit 95506e50d9
5 changed files with 29 additions and 88 deletions

View File

@ -17,6 +17,7 @@ const defaultProps = {
hideOverlay: true,
};
export default class Media extends Component {
componentWillUpdate() {
window.dispatchEvent(new Event('resize'));

View File

@ -20,12 +20,25 @@ const intlMessages = defineMessages({
id: 'app.media.screenshare.end',
description: 'toast to show when a screenshare has ended',
},
chromeExtensionError: {
id: 'app.video.chromeExtensionError',
description: 'Error message for Chrome Extension not installed',
},
chromeExtensionErrorLink: {
id: 'app.video.chromeExtensionErrorLink',
description: 'Error message for Chrome Extension not installed',
},
});
class MediaContainer extends Component {
componentWillMount() {
const { willMount } = this.props;
willMount && willMount();
document.addEventListener('installChromeExtension', this.installChromeExtension.bind(this));
}
componentWillUnmount() {
document.removeEventListener('installChromeExtension', this.installChromeExtension.bind(this));
}
componentWillReceiveProps(nextProps) {
@ -43,6 +56,21 @@ class MediaContainer extends Component {
}
}
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_EXTENSION_LINK = CHROME_CUSTOM_EXTENSION_LINK === 'LINK' ? CHROME_DEFAULT_EXTENSION_LINK : CHROME_CUSTOM_EXTENSION_LINK;
notify(<div>
{intl.formatMessage(intlMessages.chromeExtensionError)}{' '}
<a href={CHROME_EXTENSION_LINK} target="_blank">
{intl.formatMessage(intlMessages.chromeExtensionErrorLink)}
</a>
</div>, 'error', 'desktop');
}
render() {
return <Media {...this.props} />;
}

View File

@ -1,77 +0,0 @@
import React, { Component } from 'react';
import { defineMessages, injectIntl } from 'react-intl';
import { notify } from '/imports/ui/services/notification';
import VideoList from '../video-list/component';
const intlMessages = defineMessages({
chromeExtensionError: {
id: 'app.video.chromeExtensionError',
description: 'Error message for Chrome Extension not installed',
},
chromeExtensionErrorLink: {
id: 'app.video.chromeExtensionErrorLink',
description: 'Error message for Chrome Extension not installed',
},
});
class VideoDock extends Component {
constructor(props) {
super(props);
this.state = {};
}
componentDidMount() {
document.addEventListener('installChromeExtension', this.installChromeExtension.bind(this));
}
componentWillUnmount() {
document.removeEventListener('installChromeExtension', this.installChromeExtension.bind(this));
}
notifyError(message) {
notify(message, 'error', 'video');
}
installChromeExtension() {
console.log(intlMessages);
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_EXTENSION_LINK = CHROME_CUSTOM_EXTENSION_LINK === 'LINK' ? CHROME_DEFAULT_EXTENSION_LINK : CHROME_CUSTOM_EXTENSION_LINK;
this.notifyError(<div>
{intl.formatMessage(intlMessages.chromeExtensionError)}{' '}
<a href={CHROME_EXTENSION_LINK} target="_blank">
{intl.formatMessage(intlMessages.chromeExtensionErrorLink)}
</a>
</div>);
}
render() {
const {
socketOpen,
users,
onStart,
onStop
} = this.props;
if (!socketOpen) {
// TODO: return something when disconnected
return null;
}
return (
<VideoList
users={users}
onMount={onStart}
onUnmount={onStop}
/>
);
}
}
export default injectIntl(VideoDock);

View File

@ -1,11 +0,0 @@
import React from 'react';
import { withTracker } from 'meteor/react-meteor-data';
import VideoDock from './component';
import VideoService from '../service';
const VideoDockContainer = ({ children, ...props }) => <VideoDock {...props}>{children}</VideoDock>;
export default withTracker(() => ({
users: VideoService.getAllUsersVideo(),
userId: VideoService.userId(),
}))(VideoDockContainer);