jiti-meet/modules/UI/gum_overlay/UserMediaPermissionsGuidanc...

90 lines
2.3 KiB
JavaScript
Raw Normal View History

2016-10-31 16:23:28 +00:00
/* global interfaceConfig */
2016-10-21 18:01:30 +00:00
import Overlay from '../overlay/Overlay';
/**
2016-10-21 18:01:30 +00:00
* An overlay with guidance how to proceed with gUM prompt.
*/
2016-10-21 18:01:30 +00:00
class GUMOverlayImpl extends Overlay {
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-10-21 18:01:30 +00:00
/**
* Stores GUM overlay instance.
* @type {GUMOverlayImpl}
*/
let overlay;
export default {
/**
* 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();
},
/**
* Shows browser-specific overlay with guidance how to proceed with
* gUM prompt.
* @param {string} browser - name of browser for which to show the
* guidance overlay.
*/
show(browser) {
2016-10-21 18:01:30 +00:00
if (!overlay) {
overlay = new GUMOverlayImpl(browser);
}
overlay.show();
},
/**
* Hides browser-specific overlay with guidance how to proceed with
* gUM prompt.
*/
hide() {
2016-10-21 18:01:30 +00:00
overlay && overlay.hide();
}
};