2016-10-31 16:23:28 +00:00
|
|
|
/* global interfaceConfig */
|
2016-06-21 09:08:32 +00:00
|
|
|
|
2016-10-21 18:01:30 +00:00
|
|
|
import Overlay from '../overlay/Overlay';
|
2016-06-21 09:08:32 +00:00
|
|
|
|
|
|
|
/**
|
2016-10-21 18:01:30 +00:00
|
|
|
* An overlay with guidance how to proceed with gUM prompt.
|
2016-06-21 09:08:32 +00:00
|
|
|
*/
|
2016-10-21 18:01:30 +00:00
|
|
|
class GUMOverlayImpl extends Overlay {
|
2016-06-21 09:08:32 +00:00
|
|
|
|
2016-10-21 18:01:30 +00:00
|
|
|
/**
|
|
|
|
* Constructs overlay with guidance how to proceed with gUM prompt.
|
|
|
|
* @param {string} browser - name of browser for which to construct the
|
|
|
|
* guidance overlay.
|
|
|
|
* @override
|
|
|
|
*/
|
|
|
|
constructor(browser) {
|
|
|
|
super();
|
|
|
|
this.browser = browser;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @inheritDoc
|
|
|
|
*/
|
|
|
|
_buildOverlayContent() {
|
2016-10-31 17:02:32 +00:00
|
|
|
let textKey = `userMedia.${this.browser}GrantPermissions`;
|
|
|
|
let titleKey = 'startupoverlay.title';
|
2016-11-01 09:30:01 +00:00
|
|
|
let titleOptions = '{ "postProcess": "resolveAppName" }';
|
2016-10-31 17:02:32 +00:00
|
|
|
let policyTextKey = 'startupoverlay.policyText';
|
|
|
|
let policyLogo = '';
|
|
|
|
let policyLogoSrc = interfaceConfig.POLICY_LOGO;
|
|
|
|
if (policyLogoSrc) {
|
|
|
|
policyLogo += (
|
|
|
|
`<div class="policy__logo">
|
|
|
|
<img src="${policyLogoSrc}"/>
|
|
|
|
</div>`
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
return (
|
2016-10-31 15:35:22 +00:00
|
|
|
`<div class="inlay">
|
|
|
|
<span class="inlay__icon icon-microphone"></span>
|
|
|
|
<span class="inlay__icon icon-camera"></span>
|
2016-11-01 09:30:01 +00:00
|
|
|
<h3 class="inlay__title" data-i18n="${titleKey}"
|
|
|
|
data-i18n-options='${titleOptions}'></h3>
|
2016-10-31 17:02:32 +00:00
|
|
|
<span class='inlay__text'data-i18n='[html]${textKey}'></span>
|
|
|
|
</div>
|
|
|
|
<div class="policy overlay__policy">
|
|
|
|
<p class="policy__text" data-i18n="[html]${policyTextKey}"></p>
|
|
|
|
${policyLogo}
|
2016-10-31 15:35:22 +00:00
|
|
|
</div>`
|
|
|
|
);
|
2016-10-21 18:01:30 +00:00
|
|
|
}
|
2016-06-21 09:08:32 +00:00
|
|
|
}
|
|
|
|
|
2016-10-21 18:01:30 +00:00
|
|
|
/**
|
|
|
|
* Stores GUM overlay instance.
|
|
|
|
* @type {GUMOverlayImpl}
|
|
|
|
*/
|
|
|
|
let overlay;
|
|
|
|
|
2016-06-21 09:08:32 +00:00
|
|
|
export default {
|
2016-10-13 16:14:56 +00:00
|
|
|
/**
|
|
|
|
* Checks whether the overlay is currently visible.
|
|
|
|
* @return {boolean} <tt>true</tt> if the overlay is visible
|
|
|
|
* or <tt>false</tt> otherwise.
|
|
|
|
*/
|
|
|
|
isVisible () {
|
2016-10-21 18:01:30 +00:00
|
|
|
return overlay && overlay.isVisible();
|
2016-10-13 16:14:56 +00:00
|
|
|
},
|
2016-06-21 09:08:32 +00:00
|
|
|
/**
|
|
|
|
* Shows browser-specific overlay with guidance how to proceed with
|
|
|
|
* gUM prompt.
|
2016-06-24 09:47:13 +00:00
|
|
|
* @param {string} browser - name of browser for which to show the
|
|
|
|
* guidance overlay.
|
2016-06-21 09:08:32 +00:00
|
|
|
*/
|
2016-06-24 09:47:13 +00:00
|
|
|
show(browser) {
|
2016-10-21 18:01:30 +00:00
|
|
|
if (!overlay) {
|
|
|
|
overlay = new GUMOverlayImpl(browser);
|
|
|
|
}
|
|
|
|
overlay.show();
|
2016-06-21 09:08:32 +00:00
|
|
|
},
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Hides browser-specific overlay with guidance how to proceed with
|
|
|
|
* gUM prompt.
|
|
|
|
*/
|
|
|
|
hide() {
|
2016-10-21 18:01:30 +00:00
|
|
|
overlay && overlay.hide();
|
2016-06-21 09:08:32 +00:00
|
|
|
}
|
2016-10-03 16:12:04 +00:00
|
|
|
};
|