bugfix(rn) sends CONFERENCE_TERMINATED to native after dismissing the ReloadOverlay
This commit is contained in:
parent
2d27195652
commit
243aa20912
|
@ -17,15 +17,16 @@ import {
|
|||
getCurrentConference,
|
||||
isRoomValid
|
||||
} from '../../base/conference';
|
||||
import { LOAD_CONFIG_ERROR } from '../../base/config';
|
||||
import {
|
||||
CONNECTION_DISCONNECTED,
|
||||
CONNECTION_FAILED,
|
||||
JITSI_CONNECTION_CONFERENCE_KEY,
|
||||
JITSI_CONNECTION_URL_KEY,
|
||||
getURLWithoutParams
|
||||
} from '../../base/connection';
|
||||
import { JitsiConferenceEvents } from '../../base/lib-jitsi-meet';
|
||||
import {
|
||||
isFatalJitsiConferenceError,
|
||||
isFatalJitsiConnectionError,
|
||||
JitsiConferenceEvents } from '../../base/lib-jitsi-meet';
|
||||
import { MEDIA_TYPE } from '../../base/media';
|
||||
import { SET_AUDIO_MUTED, SET_VIDEO_MUTED } from '../../base/media/actionTypes';
|
||||
import {
|
||||
|
@ -40,6 +41,7 @@ import { toggleScreensharing } from '../../base/tracks';
|
|||
import { OPEN_CHAT, CLOSE_CHAT } from '../../chat';
|
||||
import { openChat } from '../../chat/actions';
|
||||
import { sendMessage, setPrivateMessageRecipient, closeChat } from '../../chat/actions.any';
|
||||
import { SET_PAGE_RELOAD_OVERLAY_CANCELED } from '../../overlay/actionTypes';
|
||||
import { muteLocal } from '../../video-menu/actions';
|
||||
import { ENTER_PICTURE_IN_PICTURE } from '../picture-in-picture';
|
||||
|
||||
|
@ -114,7 +116,7 @@ MiddlewareRegistry.register(store => next => action => {
|
|||
// counterpart of the External API (or at least not in the
|
||||
// fatality/finality semantics attributed to
|
||||
// conferenceFailed:/onConferenceFailed).
|
||||
if (!error.recoverable) {
|
||||
if (!error.recoverable && !isFatalJitsiConnectionError(error) && !isFatalJitsiConferenceError(error)) {
|
||||
_sendConferenceEvent(store, /* action */ {
|
||||
error: _toErrorString(error),
|
||||
...data
|
||||
|
@ -154,28 +156,10 @@ MiddlewareRegistry.register(store => next => action => {
|
|||
break;
|
||||
}
|
||||
|
||||
case CONNECTION_FAILED:
|
||||
!action.error.recoverable
|
||||
&& _sendConferenceFailedOnConnectionError(store, action);
|
||||
break;
|
||||
|
||||
case ENTER_PICTURE_IN_PICTURE:
|
||||
sendEvent(store, type, /* data */ {});
|
||||
break;
|
||||
|
||||
case LOAD_CONFIG_ERROR: {
|
||||
const { error, locationURL } = action;
|
||||
|
||||
sendEvent(
|
||||
store,
|
||||
CONFERENCE_TERMINATED,
|
||||
/* data */ {
|
||||
error: _toErrorString(error),
|
||||
url: _normalizeUrl(locationURL)
|
||||
});
|
||||
break;
|
||||
}
|
||||
|
||||
case OPEN_CHAT:
|
||||
case CLOSE_CHAT: {
|
||||
sendEvent(
|
||||
|
@ -219,6 +203,16 @@ MiddlewareRegistry.register(store => next => action => {
|
|||
});
|
||||
break;
|
||||
|
||||
case SET_PAGE_RELOAD_OVERLAY_CANCELED:
|
||||
sendEvent(
|
||||
store,
|
||||
CONFERENCE_TERMINATED,
|
||||
/* data */ {
|
||||
error: _toErrorString(action.error),
|
||||
url: _normalizeUrl(store.getState()['features/base/connection'].locationURL)
|
||||
});
|
||||
|
||||
break;
|
||||
case SET_VIDEO_MUTED:
|
||||
sendEvent(
|
||||
store,
|
||||
|
@ -551,36 +545,6 @@ function _sendConferenceEvent(
|
|||
sendEvent(store, type_, data);
|
||||
}
|
||||
|
||||
/**
|
||||
* Sends {@link CONFERENCE_TERMINATED} event when the {@link CONNECTION_FAILED}
|
||||
* occurs. It should be done only if the connection fails before the conference
|
||||
* instance is created. Otherwise the eventual failure event is supposed to be
|
||||
* emitted by the base/conference feature.
|
||||
*
|
||||
* @param {Store} store - The redux store.
|
||||
* @param {Action} action - The redux action.
|
||||
* @returns {void}
|
||||
*/
|
||||
function _sendConferenceFailedOnConnectionError(store, action) {
|
||||
const { locationURL } = store.getState()['features/base/connection'];
|
||||
const { connection } = action;
|
||||
|
||||
locationURL
|
||||
&& forEachConference(
|
||||
store,
|
||||
|
||||
// If there's any conference in the base/conference state then the
|
||||
// base/conference feature is supposed to emit a failure.
|
||||
conference => conference.getConnection() !== connection)
|
||||
&& sendEvent(
|
||||
store,
|
||||
CONFERENCE_TERMINATED,
|
||||
/* data */ {
|
||||
url: _normalizeUrl(locationURL),
|
||||
error: action.error.name
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Determines whether to not send a {@code CONFERENCE_LEFT} event to the native
|
||||
* counterpart of the External API.
|
||||
|
|
|
@ -36,3 +36,14 @@ export const TOGGLE_SLOW_GUM_OVERLAY = 'TOGGLE_SLOW_GUM_OVERLAY';
|
|||
* @public
|
||||
*/
|
||||
export const SET_FATAL_ERROR = 'SET_FATAL_ERROR';
|
||||
|
||||
/**
|
||||
* The type of the Redux action which signals that the overlay was canceled.
|
||||
*
|
||||
* {
|
||||
* type: export const SET_PAGE_RELOAD_OVERLAY_CANCELED
|
||||
* }
|
||||
* @public
|
||||
*/
|
||||
export const SET_PAGE_RELOAD_OVERLAY_CANCELED
|
||||
= 'SET_PAGE_RELOAD_OVERLAY_CANCELED';
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
import {
|
||||
MEDIA_PERMISSION_PROMPT_VISIBILITY_CHANGED,
|
||||
SET_FATAL_ERROR,
|
||||
SET_PAGE_RELOAD_OVERLAY_CANCELED,
|
||||
TOGGLE_SLOW_GUM_OVERLAY
|
||||
} from './actionTypes';
|
||||
|
||||
|
@ -63,3 +64,20 @@ export function setFatalError(fatalError: Object) {
|
|||
fatalError
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* The action indicates that the overlay was canceled.
|
||||
*
|
||||
* @param {Object} error - The error that caused the display of the overlay.
|
||||
*
|
||||
* @returns {{
|
||||
* type: SET_PAGE_RELOAD_OVERLAY_CANCELED,
|
||||
* error: ?Error
|
||||
* }}
|
||||
*/
|
||||
export function setPageReloadOverlayCanceled(error: Object) {
|
||||
return {
|
||||
type: SET_PAGE_RELOAD_OVERLAY_CANCELED,
|
||||
error
|
||||
};
|
||||
}
|
||||
|
|
|
@ -33,6 +33,11 @@ export type Props = {
|
|||
|
||||
dispatch: Dispatch<any>,
|
||||
|
||||
/**
|
||||
* The error that caused the display of the overlay.
|
||||
*/
|
||||
error: Error,
|
||||
|
||||
/**
|
||||
* The indicator which determines whether the reload was caused by network
|
||||
* failure.
|
||||
|
@ -273,6 +278,7 @@ export default class AbstractPageReloadOverlay<P: Props>
|
|||
* @protected
|
||||
* @returns {{
|
||||
* details: Object,
|
||||
* error: ?Error,
|
||||
* isNetworkFailure: boolean,
|
||||
* reason: string
|
||||
* }}
|
||||
|
@ -284,6 +290,7 @@ export function abstractMapStateToProps(state: Object) {
|
|||
|
||||
return {
|
||||
details: fatalError && fatalError.details,
|
||||
error: fatalError,
|
||||
isNetworkFailure:
|
||||
fatalError === configError || fatalError === connectionError,
|
||||
reason: fatalError && (fatalError.message || fatalError.name)
|
||||
|
|
|
@ -9,7 +9,7 @@ import { ConfirmDialog } from '../../../base/dialog';
|
|||
import { translate } from '../../../base/i18n';
|
||||
import { connect } from '../../../base/redux';
|
||||
import { StyleType } from '../../../base/styles';
|
||||
import { setFatalError } from '../../actions';
|
||||
import { setFatalError, setPageReloadOverlayCanceled } from '../../actions';
|
||||
import AbstractPageReloadOverlay, {
|
||||
abstractMapStateToProps,
|
||||
type Props as AbstractProps
|
||||
|
@ -58,6 +58,7 @@ class PageReloadOverlay extends AbstractPageReloadOverlay<Props> {
|
|||
*/
|
||||
_onCancel() {
|
||||
clearInterval(this._interval);
|
||||
this.props.dispatch(setPageReloadOverlayCanceled(this.props.error));
|
||||
this.props.dispatch(setFatalError(undefined));
|
||||
this.props.dispatch(appNavigate(undefined));
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue