2018-10-30 05:02:23 +00:00
|
|
|
/* @flow */
|
|
|
|
|
2017-11-09 13:34:42 +00:00
|
|
|
import { Component } from 'react';
|
|
|
|
|
|
|
|
/**
|
2018-10-30 05:02:23 +00:00
|
|
|
* The type of the React {@code Component} props of
|
|
|
|
* {@link AbstractUserMediaPermissionsOverlay}.
|
2017-11-09 13:34:42 +00:00
|
|
|
*/
|
2018-10-30 05:02:23 +00:00
|
|
|
type Props = {
|
|
|
|
|
2017-11-09 13:34:42 +00:00
|
|
|
/**
|
2018-10-30 05:02:23 +00:00
|
|
|
* The browser which is used currently. The text is different for every
|
|
|
|
* browser.
|
2017-11-09 13:34:42 +00:00
|
|
|
*/
|
2018-10-30 05:02:23 +00:00
|
|
|
browser: string,
|
2017-11-09 13:34:42 +00:00
|
|
|
|
2018-10-30 05:02:23 +00:00
|
|
|
/**
|
|
|
|
* The function to translate human-readable text.
|
|
|
|
*/
|
|
|
|
t: Function
|
|
|
|
};
|
2017-11-09 13:34:42 +00:00
|
|
|
|
2018-10-30 05:02:23 +00:00
|
|
|
/**
|
|
|
|
* Implements a React {@link Component} for overlay with guidance how to proceed
|
|
|
|
* with gUM prompt.
|
|
|
|
*/
|
|
|
|
export default class AbstractUserMediaPermissionsOverlay
|
|
|
|
extends Component<Props> {
|
2017-11-09 13:34:42 +00:00
|
|
|
/**
|
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
|
|
|
*/
|
2018-10-30 05:02:23 +00:00
|
|
|
static needsRender(state: Object) {
|
2017-11-09 13:34:42 +00:00
|
|
|
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
|
|
|
* }}
|
|
|
|
*/
|
2018-10-30 05:02:23 +00:00
|
|
|
export function abstractMapStateToProps(state: Object) {
|
2017-11-09 13:34:42 +00:00
|
|
|
const { browser } = state['features/overlay'];
|
|
|
|
|
|
|
|
return {
|
|
|
|
browser
|
|
|
|
};
|
|
|
|
}
|