jiti-meet/react/features/overlay/functions.js

34 lines
881 B
JavaScript
Raw Normal View History

2018-06-14 09:14:32 +00:00
// @flow
2019-04-09 15:53:12 +00:00
import { getOverlays } from './overlays';
2018-06-14 09:14:32 +00:00
/**
* Returns the overlay to be currently rendered.
*
* @param {Object} state - The Redux state.
* @returns {?React$ComponentType<*>}
*/
export function getOverlayToRender(state: Object) {
2019-04-09 15:53:12 +00:00
for (const overlay of getOverlays()) {
2018-06-14 09:14:32 +00:00
// react-i18n / react-redux wrap components and thus we cannot access
// the wrapped component's static methods directly.
const component = overlay.WrappedComponent || overlay;
if (component.needsRender(state)) {
return overlay;
}
}
return undefined;
}
/**
* Returns the visibility of the media permissions prompt.
*
* @param {Object} state - The Redux state.
* @returns {boolean}
*/
export function getMediaPermissionPromptVisibility(state: Object) {
return state['features/overlay'].isMediaPermissionPromptVisible;
}