Procházet zdrojové kódy

Fix reload regression

j8
Ilya Daynatovich před 8 roky
rodič
revize
b409c8cc2f

+ 20
- 7
react/features/base/connection/actions.web.js Zobrazit soubor

@@ -9,6 +9,7 @@ import UIEvents from '../../../../service/UI/UIEvents';
9 9
 import { SET_DOMAIN } from './actionTypes';
10 10
 
11 11
 import { appNavigate } from '../../app';
12
+import { setUnsupportedBrowser } from '../../unsupported-browser';
12 13
 
13 14
 declare var APP: Object;
14 15
 
@@ -34,13 +35,6 @@ export function connect() {
34 35
         // XXX For web based version we use conference initialization logic
35 36
         // from the old app (at the moment of writing).
36 37
         return APP.conference.init({ roomName: room }).then(() => {
37
-            // If during the conference initialization was defined that browser
38
-            // doesn't support WebRTC then we should define which route
39
-            // to render.
40
-            if (APP.unsupportedBrowser) {
41
-                dispatch(appNavigate(room));
42
-            }
43
-
44 38
             if (APP.logCollector) {
45 39
                 // Start the LogCollector's periodic "store logs" task
46 40
                 APP.logCollector.start();
@@ -82,6 +76,25 @@ export function connect() {
82 76
                 APP.UI.hideRingOverLay();
83 77
                 APP.API.notifyConferenceLeft(APP.conference.roomName);
84 78
                 logger.error(err);
79
+
80
+                dispatch(setUnsupportedBrowser(err));
81
+
82
+                // If during the conference initialization was defined that
83
+                // browser doesn't support WebRTC then we should define
84
+                // which route to render.
85
+                dispatch(appNavigate(room));
86
+
87
+                // Force reinitialization of the conference if WebRTC is ready.
88
+                if (err.webRTCReadyPromise) {
89
+                    err.webRTCReadyPromise.then(() => {
90
+                        // Setting plugin required flag to false because
91
+                        // it's already been installed.
92
+                        dispatch(setUnsupportedBrowser({
93
+                            isPluginRequired: false
94
+                        }));
95
+                        dispatch(appNavigate(room));
96
+                    });
97
+                }
85 98
             });
86 99
     };
87 100
 }

+ 11
- 6
react/features/base/util/interceptComponent.js Zobrazit soubor

@@ -16,6 +16,7 @@ declare var interfaceConfig: Object;
16 16
  * or not.
17 17
  *
18 18
  * @private
19
+ * @param {Object} state - Object containing current Redux state.
19 20
  * @returns {ReactElement|void}
20 21
  * @type {Function[]}
21 22
  */
@@ -27,6 +28,7 @@ const _RULES = [
27 28
      * app even if the browser supports the app (e.g. Google Chrome with
28 29
      * WebRTC support on Android).
29 30
      *
31
+     * @param {Object} state - Redux state of the app.
30 32
      * @returns {UnsupportedMobileBrowser|void} If the rule is satisfied then
31 33
      * we should intercept existing component by UnsupportedMobileBrowser.
32 34
      */
@@ -40,14 +42,17 @@ const _RULES = [
40 42
                     : NoMobileApp);
41 43
         }
42 44
     },
43
-    () => {
44
-        if (APP.unsupportedBrowser) {
45
-            const { isOldBrowser } = APP.unsupportedBrowser;
45
+    state => {
46
+        const {
47
+            isOldBrowser,
48
+            isPluginRequired
49
+        } = state['features/unsupported-browser'];
46 50
 
47
-            if (isOldBrowser) {
48
-                return UnsupportedDesktopBrowser;
49
-            }
51
+        if (isOldBrowser) {
52
+            return UnsupportedDesktopBrowser;
53
+        }
50 54
 
55
+        if (isPluginRequired) {
51 56
             return PluginRequiredBrowser;
52 57
         }
53 58
     }

+ 11
- 0
react/features/unsupported-browser/actionTypes.js Zobrazit soubor

@@ -16,3 +16,14 @@ import { Symbol } from '../base/react';
16 16
  * }
17 17
  */
18 18
 export const DISMISS_MOBILE_APP_PROMO = Symbol('DISMISS_MOBILE_APP_PROMO');
19
+
20
+/**
21
+ * The type of Redux action which signals to change information about
22
+ * unsupported browser in Redux store.
23
+ *
24
+ * {
25
+ *      type: SET_UNSUPPORTED_BROWSER,
26
+ *      unsupportedBrowser: Object
27
+ * }
28
+ */
29
+export const SET_UNSUPPORTED_BROWSER = Symbol('SET_UNSUPPORTED_BROWSER');

+ 21
- 1
react/features/unsupported-browser/actions.js Zobrazit soubor

@@ -1,4 +1,7 @@
1
-import { DISMISS_MOBILE_APP_PROMO } from './actionTypes';
1
+import {
2
+    DISMISS_MOBILE_APP_PROMO,
3
+    SET_UNSUPPORTED_BROWSER
4
+} from './actionTypes';
2 5
 
3 6
 /**
4 7
  * Returns a Redux action which signals that the UnsupportedMobileBrowser which
@@ -19,3 +22,20 @@ export function dismissMobileAppPromo() {
19 22
         type: DISMISS_MOBILE_APP_PROMO
20 23
     };
21 24
 }
25
+
26
+/**
27
+ * Sets unsupported browser object.
28
+ *
29
+ * @param {Object} unsupportedBrowser - Object describing the unsupported
30
+ * browser.
31
+ * @returns {{
32
+ *      type: SET_UNSUPPORTED_BROWSER,
33
+ *      unsupportedBrowser: Object
34
+ *  }}
35
+ */
36
+export function setUnsupportedBrowser(unsupportedBrowser) {
37
+    return {
38
+        type: SET_UNSUPPORTED_BROWSER,
39
+        unsupportedBrowser
40
+    };
41
+}

+ 9
- 1
react/features/unsupported-browser/reducer.js Zobrazit soubor

@@ -1,6 +1,9 @@
1 1
 import { ReducerRegistry } from '../base/redux';
2 2
 
3
-import { DISMISS_MOBILE_APP_PROMO } from './actionTypes';
3
+import {
4
+    DISMISS_MOBILE_APP_PROMO,
5
+    SET_UNSUPPORTED_BROWSER
6
+} from './actionTypes';
4 7
 
5 8
 ReducerRegistry.register(
6 9
         'features/unsupported-browser',
@@ -21,6 +24,11 @@ ReducerRegistry.register(
21 24
                      */
22 25
                     mobileAppPromoDismissed: true
23 26
                 };
27
+            case SET_UNSUPPORTED_BROWSER:
28
+                return {
29
+                    ...state,
30
+                    ...action.unsupportedBrowser
31
+                };
24 32
             }
25 33
 
26 34
             return state;

Načítá se…
Zrušit
Uložit