Fix reload regression

This commit is contained in:
Ilya Daynatovich 2017-02-14 16:28:15 -06:00 committed by Lyubo Marinov
parent 905212b109
commit b409c8cc2f
5 changed files with 72 additions and 15 deletions

View File

@ -9,6 +9,7 @@ import UIEvents from '../../../../service/UI/UIEvents';
import { SET_DOMAIN } from './actionTypes';
import { appNavigate } from '../../app';
import { setUnsupportedBrowser } from '../../unsupported-browser';
declare var APP: Object;
@ -34,13 +35,6 @@ export function connect() {
// XXX For web based version we use conference initialization logic
// from the old app (at the moment of writing).
return APP.conference.init({ roomName: room }).then(() => {
// If during the conference initialization was defined that browser
// doesn't support WebRTC then we should define which route
// to render.
if (APP.unsupportedBrowser) {
dispatch(appNavigate(room));
}
if (APP.logCollector) {
// Start the LogCollector's periodic "store logs" task
APP.logCollector.start();
@ -82,6 +76,25 @@ export function connect() {
APP.UI.hideRingOverLay();
APP.API.notifyConferenceLeft(APP.conference.roomName);
logger.error(err);
dispatch(setUnsupportedBrowser(err));
// If during the conference initialization was defined that
// browser doesn't support WebRTC then we should define
// which route to render.
dispatch(appNavigate(room));
// Force reinitialization of the conference if WebRTC is ready.
if (err.webRTCReadyPromise) {
err.webRTCReadyPromise.then(() => {
// Setting plugin required flag to false because
// it's already been installed.
dispatch(setUnsupportedBrowser({
isPluginRequired: false
}));
dispatch(appNavigate(room));
});
}
});
};
}

View File

@ -16,6 +16,7 @@ declare var interfaceConfig: Object;
* or not.
*
* @private
* @param {Object} state - Object containing current Redux state.
* @returns {ReactElement|void}
* @type {Function[]}
*/
@ -27,6 +28,7 @@ const _RULES = [
* app even if the browser supports the app (e.g. Google Chrome with
* WebRTC support on Android).
*
* @param {Object} state - Redux state of the app.
* @returns {UnsupportedMobileBrowser|void} If the rule is satisfied then
* we should intercept existing component by UnsupportedMobileBrowser.
*/
@ -40,14 +42,17 @@ const _RULES = [
: NoMobileApp);
}
},
() => {
if (APP.unsupportedBrowser) {
const { isOldBrowser } = APP.unsupportedBrowser;
state => {
const {
isOldBrowser,
isPluginRequired
} = state['features/unsupported-browser'];
if (isOldBrowser) {
return UnsupportedDesktopBrowser;
}
if (isOldBrowser) {
return UnsupportedDesktopBrowser;
}
if (isPluginRequired) {
return PluginRequiredBrowser;
}
}

View File

@ -16,3 +16,14 @@ import { Symbol } from '../base/react';
* }
*/
export const DISMISS_MOBILE_APP_PROMO = Symbol('DISMISS_MOBILE_APP_PROMO');
/**
* The type of Redux action which signals to change information about
* unsupported browser in Redux store.
*
* {
* type: SET_UNSUPPORTED_BROWSER,
* unsupportedBrowser: Object
* }
*/
export const SET_UNSUPPORTED_BROWSER = Symbol('SET_UNSUPPORTED_BROWSER');

View File

@ -1,4 +1,7 @@
import { DISMISS_MOBILE_APP_PROMO } from './actionTypes';
import {
DISMISS_MOBILE_APP_PROMO,
SET_UNSUPPORTED_BROWSER
} from './actionTypes';
/**
* Returns a Redux action which signals that the UnsupportedMobileBrowser which
@ -19,3 +22,20 @@ export function dismissMobileAppPromo() {
type: DISMISS_MOBILE_APP_PROMO
};
}
/**
* Sets unsupported browser object.
*
* @param {Object} unsupportedBrowser - Object describing the unsupported
* browser.
* @returns {{
* type: SET_UNSUPPORTED_BROWSER,
* unsupportedBrowser: Object
* }}
*/
export function setUnsupportedBrowser(unsupportedBrowser) {
return {
type: SET_UNSUPPORTED_BROWSER,
unsupportedBrowser
};
}

View File

@ -1,6 +1,9 @@
import { ReducerRegistry } from '../base/redux';
import { DISMISS_MOBILE_APP_PROMO } from './actionTypes';
import {
DISMISS_MOBILE_APP_PROMO,
SET_UNSUPPORTED_BROWSER
} from './actionTypes';
ReducerRegistry.register(
'features/unsupported-browser',
@ -21,6 +24,11 @@ ReducerRegistry.register(
*/
mobileAppPromoDismissed: true
};
case SET_UNSUPPORTED_BROWSER:
return {
...state,
...action.unsupportedBrowser
};
}
return state;