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 15:35:22 +00:00
|
|
|
// `<span data-i18n='[html]userMedia.${this.browser}GrantPermissions'
|
|
|
|
// class='inlay__text'></span>`
|
|
|
|
let title = 'HipChat Video needs to use your microphone and camera.';
|
|
|
|
let text;
|
|
|
|
text = 'Select "Allow" when your browser asks for these permissions.';
|
2016-10-31 16:23:28 +00:00
|
|
|
let content = (
|
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>
|
|
|
|
<h3 class="inlay__title">${title}</h3>
|
|
|
|
<span class='inlay__text'>${text}</span>
|
|
|
|
</div>`
|
|
|
|
);
|
2016-10-31 16:23:28 +00:00
|
|
|
|
|
|
|
if (interfaceConfig.HAS_POLICY) {
|
|
|
|
content += (
|
|
|
|
`<div class="policy overlay__policy">
|
|
|
|
<p class="policy__text" data-i18n="policyText"></p>
|
|
|
|
<div class="policy__logo">
|
|
|
|
<img src=""/>
|
|
|
|
</div>
|
|
|
|
</div>`
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
return content;
|
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
|
|
|
};
|