2017-11-09 13:34:42 +00:00
|
|
|
import PropTypes from 'prop-types';
|
|
|
|
import { Component } from 'react';
|
|
|
|
|
|
|
|
/**
|
2017-11-27 22:08:12 +00:00
|
|
|
* Implements a React {@link Component} for overlay with guidance how to proceed
|
|
|
|
* with gUM prompt.
|
2017-11-09 13:34:42 +00:00
|
|
|
*/
|
|
|
|
export default class AbstractUserMediaPermissionsOverlay extends Component {
|
|
|
|
/**
|
2017-11-27 22:08:12 +00:00
|
|
|
* {@code AbstractUserMediaPermissionsOverlay} component's property types.
|
2017-11-09 13:34:42 +00:00
|
|
|
*
|
|
|
|
* @static
|
|
|
|
*/
|
|
|
|
static propTypes = {
|
|
|
|
/**
|
|
|
|
* The browser which is used currently. The text is different for every
|
|
|
|
* browser.
|
|
|
|
*
|
|
|
|
* @public
|
|
|
|
* @type {string}
|
|
|
|
*/
|
|
|
|
browser: PropTypes.string,
|
|
|
|
|
|
|
|
/**
|
|
|
|
* The function to translate human-readable text.
|
|
|
|
*
|
|
|
|
* @public
|
|
|
|
* @type {Function}
|
|
|
|
*/
|
|
|
|
t: PropTypes.func
|
|
|
|
};
|
|
|
|
|
|
|
|
/**
|
2017-11-27 22:08:12 +00:00
|
|
|
* Determines whether this overlay needs to be rendered (according to a
|
|
|
|
* specific redux state). Called by {@link OverlayContainer}.
|
2017-11-09 13:34:42 +00:00
|
|
|
*
|
|
|
|
* @param {Object} state - The redux state.
|
2017-11-27 22:08:12 +00:00
|
|
|
* @returns {boolean} - If this overlay needs to be rendered, {@code true};
|
|
|
|
* {@code false}, otherwise.
|
2017-11-09 13:34:42 +00:00
|
|
|
*/
|
|
|
|
static needsRender(state) {
|
|
|
|
return state['features/overlay'].isMediaPermissionPromptVisible;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Maps (parts of) the redux state to the associated component's props.
|
|
|
|
*
|
|
|
|
* @param {Object} state - The redux state.
|
2017-11-27 22:08:12 +00:00
|
|
|
* @protected
|
2017-11-09 13:34:42 +00:00
|
|
|
* @returns {{
|
2017-11-27 22:08:12 +00:00
|
|
|
* browser: string
|
2017-11-09 13:34:42 +00:00
|
|
|
* }}
|
|
|
|
*/
|
|
|
|
export function abstractMapStateToProps(state) {
|
|
|
|
const { browser } = state['features/overlay'];
|
|
|
|
|
|
|
|
return {
|
|
|
|
browser
|
|
|
|
};
|
|
|
|
}
|