ref(join) remove overlay shown for a slow gUM flow (#12268)

This commit is contained in:
Avram Tudor 2022-09-29 16:55:31 +03:00 committed by GitHub
parent c523c07cb7
commit 3c180d3932
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
10 changed files with 7 additions and 147 deletions

View File

@ -144,7 +144,7 @@ import {
isModerationNotificationDisplayed, isModerationNotificationDisplayed,
showNotification showNotification
} from './react/features/notifications'; } from './react/features/notifications';
import { mediaPermissionPromptVisibilityChanged, toggleSlowGUMOverlay } from './react/features/overlay'; import { mediaPermissionPromptVisibilityChanged } from './react/features/overlay';
import { suspendDetected } from './react/features/power-monitor'; import { suspendDetected } from './react/features/power-monitor';
import { import {
initPrejoin, initPrejoin,
@ -519,11 +519,6 @@ export default {
); );
} }
JitsiMeetJS.mediaDevices.addEventListener(
JitsiMediaDevicesEvents.SLOW_GET_USER_MEDIA,
() => APP.store.dispatch(toggleSlowGUMOverlay(true))
);
let tryCreateLocalTracks; let tryCreateLocalTracks;
// On Electron there is no permission prompt for granting permissions. That's why we don't need to // On Electron there is no permission prompt for granting permissions. That's why we don't need to
@ -533,8 +528,7 @@ export default {
const audioOptions = { const audioOptions = {
devices: [ MEDIA_TYPE.AUDIO ], devices: [ MEDIA_TYPE.AUDIO ],
timeout, timeout,
firePermissionPromptIsShownEvent: true, firePermissionPromptIsShownEvent: true
fireSlowPromiseEvent: true
}; };
// FIXME is there any simpler way to rewrite this spaghetti below ? // FIXME is there any simpler way to rewrite this spaghetti below ?
@ -585,8 +579,7 @@ export default {
tryCreateLocalTracks = createLocalTracksF({ tryCreateLocalTracks = createLocalTracksF({
devices: initialDevices, devices: initialDevices,
timeout, timeout,
firePermissionPromptIsShownEvent: true, firePermissionPromptIsShownEvent: true
fireSlowPromiseEvent: true
}) })
.catch(err => { .catch(err => {
if (requestedAudio && requestedVideo) { if (requestedAudio && requestedVideo) {
@ -629,8 +622,7 @@ export default {
return requestedVideo return requestedVideo
? createLocalTracksF({ ? createLocalTracksF({
devices: [ MEDIA_TYPE.VIDEO ], devices: [ MEDIA_TYPE.VIDEO ],
firePermissionPromptIsShownEvent: true, firePermissionPromptIsShownEvent: true
fireSlowPromiseEvent: true
}) })
: []; : [];
}) })
@ -651,7 +643,6 @@ export default {
// the user inputs their credentials, but the dialog would be // the user inputs their credentials, but the dialog would be
// overshadowed by the overlay. // overshadowed by the overlay.
tryCreateLocalTracks.then(tracks => { tryCreateLocalTracks.then(tracks => {
APP.store.dispatch(toggleSlowGUMOverlay(false));
APP.store.dispatch(mediaPermissionPromptVisibilityChanged(false)); APP.store.dispatch(mediaPermissionPromptVisibilityChanged(false));
return tracks; return tracks;

View File

@ -132,9 +132,6 @@ export async function createLocalPresenterTrack(options: TrackOptions, desktopHe
* @param {boolean} [options.firePermissionPromptIsShownEvent] - Whether lib-jitsi-meet * @param {boolean} [options.firePermissionPromptIsShownEvent] - Whether lib-jitsi-meet
* should check for a {@code getUserMedia} permission prompt and fire a * should check for a {@code getUserMedia} permission prompt and fire a
* corresponding event. * corresponding event.
* @param {boolean} [options.fireSlowPromiseEvent] - Whether lib-jitsi-meet
* should check for a slow {@code getUserMedia} request and fire a
* corresponding event.
* @param {IStore} store - The redux store in the context of which the function * @param {IStore} store - The redux store in the context of which the function
* is to execute and from which state such as {@code config} is to be retrieved. * is to execute and from which state such as {@code config} is to be retrieved.
* @returns {Promise<JitsiLocalTrack[]>} * @returns {Promise<JitsiLocalTrack[]>}
@ -145,7 +142,6 @@ export function createLocalTracksF(options: TrackOptions = {}, store?: IStore) {
desktopSharingSourceDevice, desktopSharingSourceDevice,
desktopSharingSources, desktopSharingSources,
firePermissionPromptIsShownEvent, firePermissionPromptIsShownEvent,
fireSlowPromiseEvent,
timeout timeout
} = options; } = options;
@ -193,7 +189,6 @@ export function createLocalTracksF(options: TrackOptions = {}, store?: IStore) {
effects, effects,
firefox_fake_device, // eslint-disable-line camelcase firefox_fake_device, // eslint-disable-line camelcase
firePermissionPromptIsShownEvent, firePermissionPromptIsShownEvent,
fireSlowPromiseEvent,
micDeviceId, micDeviceId,
resolution, resolution,
timeout timeout

View File

@ -14,7 +14,6 @@ export interface TrackOptions {
devices?: string[]; devices?: string[];
facingMode?: string; facingMode?: string;
firePermissionPromptIsShownEvent?: boolean; firePermissionPromptIsShownEvent?: boolean;
fireSlowPromiseEvent?: boolean;
micDeviceId?: string | null; micDeviceId?: string | null;
timeout?: number; timeout?: number;
} }

View File

@ -14,17 +14,6 @@
export const MEDIA_PERMISSION_PROMPT_VISIBILITY_CHANGED export const MEDIA_PERMISSION_PROMPT_VISIBILITY_CHANGED
= 'MEDIA_PERMISSION_PROMPT_VISIBILITY_CHANGED'; = 'MEDIA_PERMISSION_PROMPT_VISIBILITY_CHANGED';
/**
* The type of the Redux action which signals that the overlay for slow gUM is visible or not.
*
* {
* type: TOGGLE_SLOW_GUM_OVERLAY,
* isVisible: {boolean},
* }
* @public
*/
export const TOGGLE_SLOW_GUM_OVERLAY = 'TOGGLE_SLOW_GUM_OVERLAY';
/** /**
* Adjust the state of the fatal error which shows/hides the reload screen. See * Adjust the state of the fatal error which shows/hides the reload screen. See
* action methods's description for more info about each of the fields. * action methods's description for more info about each of the fields.

View File

@ -3,8 +3,7 @@
import { import {
MEDIA_PERMISSION_PROMPT_VISIBILITY_CHANGED, MEDIA_PERMISSION_PROMPT_VISIBILITY_CHANGED,
SET_FATAL_ERROR, SET_FATAL_ERROR,
SET_PAGE_RELOAD_OVERLAY_CANCELED, SET_PAGE_RELOAD_OVERLAY_CANCELED
TOGGLE_SLOW_GUM_OVERLAY
} from './actionTypes'; } from './actionTypes';
/** /**
@ -28,24 +27,6 @@ export function mediaPermissionPromptVisibilityChanged(isVisible: boolean, brows
}; };
} }
/**
* Signals that the prompt for media permission is visible or not.
*
* @param {boolean} isVisible - If the value is true - the prompt for media
* permission is visible otherwise the value is false/undefined.
* @public
* @returns {{
* type: SLOW_GET_USER_MEDIA_OVERLAY,
* isVisible: {boolean}
* }}
*/
export function toggleSlowGUMOverlay(isVisible: boolean) {
return {
type: TOGGLE_SLOW_GUM_OVERLAY,
isVisible
};
}
/** /**
* The action indicates that an unrecoverable error has occurred and the reload * The action indicates that an unrecoverable error has occurred and the reload
* screen will be displayed or hidden. * screen will be displayed or hidden.

View File

@ -1,33 +0,0 @@
// @flow
import { Component } from 'react';
/**
* The type of the React {@code Component} props of
* {@link AbstractSlowGUMOverlay}.
*/
type Props = {
/**
* The function to translate human-readable text.
*/
t: Function
};
/**
* Implements a React {@link Component} for slow gUM overlay. Shown when
* a slow gUM promise resolution is detected.
*/
export default class AbstractSlowGUMOverlay extends Component<Props> {
/**
* Determines whether this overlay needs to be rendered (according to a
* specific redux state). Called by {@link OverlayContainer}.
*
* @param {Object} state - The redux state.
* @returns {boolean} - If this overlay needs to be rendered, {@code true};
* {@code false}, otherwise.
*/
static needsRender(state: Object) {
return state['features/overlay'].isSlowGUMOverlayVisible;
}
}

View File

@ -1,36 +0,0 @@
// @flow
import Spinner from '@atlaskit/spinner';
import React from 'react';
import { translate } from '../../../base/i18n';
import AbstractSlowGUMOverlay from './AbstractSlowGUMOverlay';
import OverlayFrame from './OverlayFrame';
/**
* Implements a React {@link Component} for slow gUM overlay. Shown when
* a slow gUM promise resolution is detected.
*/
class SlowGUMOverlay extends AbstractSlowGUMOverlay {
/**
* Implements React's {@link Component#render()}.
*
* @inheritdoc
* @returns {ReactElement}
*/
render() {
// const { t } = this.props;
return (
<OverlayFrame>
<div className = { 'overlay__spinner-container' }>
<Spinner
invertColor = { true }
size = { 'large' } />
</div>
</OverlayFrame>
);
}
}
export default translate(SlowGUMOverlay);

View File

@ -5,4 +5,3 @@ export { default as OverlayFrame } from './OverlayFrame';
export { default as PageReloadOverlay } from './PageReloadOverlay'; export { default as PageReloadOverlay } from './PageReloadOverlay';
export { default as SuspendedOverlay } from './SuspendedOverlay'; export { default as SuspendedOverlay } from './SuspendedOverlay';
export { default as UserMediaPermissionsOverlay } from './UserMediaPermissionsOverlay'; export { default as UserMediaPermissionsOverlay } from './UserMediaPermissionsOverlay';
export { default as SlowGUMOverlay } from './SlowGUMOverlay';

View File

@ -2,7 +2,6 @@
import { import {
PageReloadOverlay, PageReloadOverlay,
SlowGUMOverlay,
SuspendedOverlay, SuspendedOverlay,
UserMediaPermissionsOverlay UserMediaPermissionsOverlay
} from './components/web'; } from './components/web';
@ -16,7 +15,6 @@ export function getOverlays(): Array<Object> {
return [ return [
PageReloadOverlay, PageReloadOverlay,
SuspendedOverlay, SuspendedOverlay,
UserMediaPermissionsOverlay, UserMediaPermissionsOverlay
SlowGUMOverlay
]; ];
} }

View File

@ -4,15 +4,13 @@ import { assign, set } from '../base/redux/functions';
import { import {
MEDIA_PERMISSION_PROMPT_VISIBILITY_CHANGED, MEDIA_PERMISSION_PROMPT_VISIBILITY_CHANGED,
SET_FATAL_ERROR, SET_FATAL_ERROR
TOGGLE_SLOW_GUM_OVERLAY
} from './actionTypes'; } from './actionTypes';
export interface IOverlayState { export interface IOverlayState {
browser?: string; browser?: string;
fatalError?: Error; fatalError?: Error;
isMediaPermissionPromptVisible?: boolean; isMediaPermissionPromptVisible?: boolean;
isSlowGUMOverlayVisible?: boolean;
loadConfigOverlayVisible?: boolean; loadConfigOverlayVisible?: boolean;
} }
@ -35,9 +33,6 @@ ReducerRegistry.register<IOverlayState>('features/overlay', (state = {}, action)
case SET_FATAL_ERROR: case SET_FATAL_ERROR:
return _setFatalError(state, action); return _setFatalError(state, action);
case TOGGLE_SLOW_GUM_OVERLAY:
return _toggleSlowGUMOverlay(state, action);
} }
return state; return state;
@ -62,24 +57,6 @@ function _mediaPermissionPromptVisibilityChanged(
}); });
} }
/**
* Reduces a specific redux action TOGGLE_SLOW_GUM_OVERLAY of
* the feature overlay.
*
* @param {Object} state - The redux state of the feature overlay.
* @param {Action} action - The redux action to reduce.
* @private
* @returns {Object} The new state of the feature overlay after the reduction of
* the specified action.
*/
function _toggleSlowGUMOverlay(
state: IOverlayState,
{ isVisible }: { isVisible?: boolean; }) {
return assign(state, {
isSlowGUMOverlayVisible: isVisible
});
}
/** /**
* Sets the {@code LoadConfigOverlay} overlay visible or not. * Sets the {@code LoadConfigOverlay} overlay visible or not.
* *