2017-01-31 20:58:48 +00:00
|
|
|
/* global interfaceConfig */
|
|
|
|
|
2017-03-06 22:03:50 +00:00
|
|
|
import React, { Component } from 'react';
|
2017-01-31 20:58:48 +00:00
|
|
|
|
2017-03-01 02:55:12 +00:00
|
|
|
import { translate, translateToHTML } from '../../base/i18n';
|
2017-01-31 20:58:48 +00:00
|
|
|
|
2017-03-06 22:03:50 +00:00
|
|
|
import OverlayFrame from './OverlayFrame';
|
2017-02-23 16:56:25 +00:00
|
|
|
|
2017-01-31 20:58:48 +00:00
|
|
|
/**
|
|
|
|
* Implements a React Component for overlay with guidance how to proceed with
|
|
|
|
* gUM prompt.
|
|
|
|
*/
|
2017-03-06 22:03:50 +00:00
|
|
|
class UserMediaPermissionsOverlay extends Component {
|
2017-01-31 20:58:48 +00:00
|
|
|
/**
|
|
|
|
* UserMediaPermissionsOverlay component's property types.
|
|
|
|
*
|
|
|
|
* @static
|
|
|
|
*/
|
|
|
|
static propTypes = {
|
|
|
|
/**
|
|
|
|
* The browser which is used currently. The text is different for every
|
|
|
|
* browser.
|
2017-02-19 00:42:11 +00:00
|
|
|
*
|
2017-01-31 20:58:48 +00:00
|
|
|
* @public
|
|
|
|
* @type {string}
|
|
|
|
*/
|
2017-03-06 22:03:50 +00:00
|
|
|
browser: React.PropTypes.string,
|
|
|
|
|
|
|
|
/**
|
|
|
|
* The function to translate human-readable text.
|
|
|
|
*
|
|
|
|
* @public
|
|
|
|
* @type {Function}
|
|
|
|
*/
|
|
|
|
t: React.PropTypes.func
|
2017-01-31 20:58:48 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Initializes a new SuspendedOverlay instance.
|
|
|
|
*
|
|
|
|
* @param {Object} props - The read-only properties with which the new
|
|
|
|
* instance is to be initialized.
|
|
|
|
* @public
|
|
|
|
*/
|
|
|
|
constructor(props) {
|
|
|
|
super(props);
|
|
|
|
|
|
|
|
this.state = {
|
|
|
|
/**
|
|
|
|
* The src value of the image for the policy logo.
|
2017-02-19 00:42:11 +00:00
|
|
|
*
|
2017-01-31 20:58:48 +00:00
|
|
|
* @type {string}
|
|
|
|
*/
|
|
|
|
policyLogoSrc: interfaceConfig.POLICY_LOGO
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2017-03-06 22:03:50 +00:00
|
|
|
* Implements React's {@link Component#render()}.
|
2017-01-31 20:58:48 +00:00
|
|
|
*
|
2017-03-06 22:03:50 +00:00
|
|
|
* @inheritdoc
|
2017-01-31 20:58:48 +00:00
|
|
|
* @returns {ReactElement|null}
|
|
|
|
*/
|
2017-03-06 22:03:50 +00:00
|
|
|
render() {
|
2017-03-01 02:55:12 +00:00
|
|
|
const { browser, t } = this.props;
|
2017-01-31 20:58:48 +00:00
|
|
|
|
|
|
|
return (
|
2017-03-06 22:03:50 +00:00
|
|
|
<OverlayFrame>
|
2017-01-31 20:58:48 +00:00
|
|
|
<div className = 'inlay'>
|
|
|
|
<span className = 'inlay__icon icon-microphone' />
|
|
|
|
<span className = 'inlay__icon icon-camera' />
|
2017-02-23 16:56:25 +00:00
|
|
|
<h3 className = 'inlay__title'>
|
2017-03-01 02:55:12 +00:00
|
|
|
{
|
2017-03-09 00:16:53 +00:00
|
|
|
t('startupoverlay.title',
|
2017-03-01 02:55:12 +00:00
|
|
|
{ postProcess: 'resolveAppName' })
|
|
|
|
}
|
2017-02-23 16:56:25 +00:00
|
|
|
</h3>
|
|
|
|
<span className = 'inlay__text'>
|
2017-03-01 02:55:12 +00:00
|
|
|
{
|
2017-03-09 00:16:53 +00:00
|
|
|
translateToHTML(t,
|
2017-03-01 02:55:12 +00:00
|
|
|
`userMedia.${browser}GrantPermissions`)
|
|
|
|
}
|
2017-02-23 16:56:25 +00:00
|
|
|
</span>
|
2017-01-31 20:58:48 +00:00
|
|
|
</div>
|
|
|
|
<div className = 'policy overlay__policy'>
|
2017-02-23 16:56:25 +00:00
|
|
|
<p className = 'policy__text'>
|
2017-03-06 22:03:50 +00:00
|
|
|
{ translateToHTML(t, 'startupoverlay.policyText') }
|
2017-02-23 16:56:25 +00:00
|
|
|
</p>
|
2017-02-19 00:42:11 +00:00
|
|
|
{
|
|
|
|
this._renderPolicyLogo()
|
|
|
|
}
|
2017-01-31 20:58:48 +00:00
|
|
|
</div>
|
2017-03-06 22:03:50 +00:00
|
|
|
</OverlayFrame>
|
2017-01-31 20:58:48 +00:00
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Renders the policy logo.
|
|
|
|
*
|
|
|
|
* @returns {ReactElement|null}
|
|
|
|
* @private
|
|
|
|
*/
|
|
|
|
_renderPolicyLogo() {
|
2017-02-19 00:42:11 +00:00
|
|
|
const { policyLogoSrc } = this.state;
|
|
|
|
|
|
|
|
if (policyLogoSrc) {
|
2017-01-31 20:58:48 +00:00
|
|
|
return (
|
|
|
|
<div className = 'policy__logo'>
|
2017-02-19 00:42:11 +00:00
|
|
|
<img src = { policyLogoSrc } />
|
2017-01-31 20:58:48 +00:00
|
|
|
</div>
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
}
|
2017-02-23 16:56:25 +00:00
|
|
|
|
|
|
|
export default translate(UserMediaPermissionsOverlay);
|