Browse Source

feat(overlay): native page reload dialog (#12667)

feat(overlay): native feature removal + replaced PageReloadOverlay with PageReloadDialog
factor2
Calinteodor 2 years ago
parent
commit
3cb0df579c
No account linked to committer's email address
40 changed files with 415 additions and 538 deletions
  1. 1
    1
      conference.js
  2. 0
    3
      react/features/app/actions.native.ts
  3. 0
    2
      react/features/app/actions.web.ts
  4. 2
    21
      react/features/app/components/AbstractApp.js
  5. 20
    3
      react/features/app/components/App.web.js
  6. 0
    43
      react/features/base/dialog/components/DialogContent.js
  7. 0
    2
      react/features/base/dialog/components/index.js
  8. 226
    0
      react/features/base/dialog/components/native/PageReloadDialog.tsx
  9. 1
    0
      react/features/base/dialog/components/native/index.js
  10. 0
    14
      react/features/base/dialog/components/styles.native.js
  11. 0
    5
      react/features/base/dialog/components/styles.web.js
  12. 3
    0
      react/features/base/lib-jitsi-meet/functions.any.ts
  13. 10
    1
      react/features/conference/components/web/Conference.js
  14. 2
    5
      react/features/conference/functions.any.ts
  15. 0
    11
      react/features/mobile/external-api/middleware.js
  16. 6
    2
      react/features/mobile/navigation/components/ConnectingPage.tsx
  17. 16
    6
      react/features/mobile/navigation/components/RootNavigationContainer.tsx
  18. 0
    23
      react/features/overlay/actionTypes.ts
  19. 31
    0
      react/features/overlay/actions.native.ts
  20. 0
    62
      react/features/overlay/actions.ts
  21. 32
    0
      react/features/overlay/actions.web.ts
  22. 0
    3
      react/features/overlay/components/_.native.js
  23. 0
    3
      react/features/overlay/components/_.web.js
  24. 0
    4
      react/features/overlay/components/index.js
  25. 0
    38
      react/features/overlay/components/native/OverlayFrame.js
  26. 0
    95
      react/features/overlay/components/native/PageReloadOverlay.js
  27. 0
    4
      react/features/overlay/components/native/index.js
  28. 0
    24
      react/features/overlay/components/native/styles.js
  29. 16
    31
      react/features/overlay/components/web/AbstractPageReloadOverlay.js
  30. 1
    1
      react/features/overlay/components/web/AbstractSuspendedOverlay.js
  31. 6
    8
      react/features/overlay/components/web/OverlayContainer.tsx
  32. 4
    8
      react/features/overlay/components/web/OverlayFrame.tsx
  33. 4
    4
      react/features/overlay/components/web/PageReloadOverlay.js
  34. 0
    7
      react/features/overlay/components/web/index.js
  35. 15
    13
      react/features/overlay/functions.web.ts
  36. 0
    5
      react/features/overlay/index.js
  37. 16
    8
      react/features/overlay/middleware.ts
  38. 0
    15
      react/features/overlay/overlays.native.ts
  39. 0
    20
      react/features/overlay/overlays.web.ts
  40. 3
    43
      react/features/overlay/reducer.ts

+ 1
- 1
conference.js View File

@@ -141,7 +141,7 @@ import {
141 141
     showNotification,
142 142
     showWarningNotification
143 143
 } from './react/features/notifications';
144
-import { mediaPermissionPromptVisibilityChanged } from './react/features/overlay';
144
+import { mediaPermissionPromptVisibilityChanged } from './react/features/overlay/actions';
145 145
 import { suspendDetected } from './react/features/power-monitor';
146 146
 import { initPrejoin, makePrecallTest, setJoiningInProgress } from './react/features/prejoin/actions';
147 147
 import { isPrejoinPageVisible } from './react/features/prejoin/functions';

+ 0
- 3
react/features/app/actions.native.ts View File

@@ -30,8 +30,6 @@ import {
30 30
 // @ts-ignore
31 31
 import { screen } from '../mobile/navigation/routes';
32 32
 import { clearNotifications } from '../notifications/actions';
33
-// @ts-ignore
34
-import { setFatalError } from '../overlay';
35 33
 
36 34
 import { addTrackStateToURL, getDefaultURL } from './functions.native';
37 35
 import logger from './logger';
@@ -177,7 +175,6 @@ export function maybeRedirectToWelcomePage(options: any) { // eslint-disable-lin
177 175
  */
178 176
 export function reloadNow() {
179 177
     return (dispatch: IStore['dispatch'], getState: IStore['getState']) => {
180
-        dispatch(setFatalError(undefined));
181 178
 
182 179
         const state = getState();
183 180
         const { locationURL } = state['features/base/connection'];

+ 0
- 2
react/features/app/actions.web.ts View File

@@ -20,7 +20,6 @@ import {
20 20
 import { isVpaasMeeting } from '../jaas/functions';
21 21
 import { clearNotifications, showNotification } from '../notifications/actions';
22 22
 import { NOTIFICATION_TIMEOUT_TYPE } from '../notifications/constants';
23
-import { setFatalError } from '../overlay/actions';
24 23
 import { isWelcomePageEnabled } from '../welcome/functions';
25 24
 
26 25
 import {
@@ -222,7 +221,6 @@ export function maybeRedirectToWelcomePage(options: { feedbackSubmitted?: boolea
222 221
  */
223 222
 export function reloadNow() {
224 223
     return (dispatch: IStore['dispatch'], getState: IStore['getState']) => {
225
-        dispatch(setFatalError(undefined));
226 224
 
227 225
         const state = getState();
228 226
         const { locationURL } = state['features/base/connection'];

+ 2
- 21
react/features/app/components/AbstractApp.js View File

@@ -1,10 +1,7 @@
1
-// @flow
2
-
3
-import React, { Fragment } from 'react';
1
+import React from 'react';
4 2
 
5 3
 import { BaseApp } from '../../base/app';
6 4
 import { toURLString } from '../../base/util';
7
-import { OverlayContainer } from '../../overlay';
8 5
 import { appNavigate } from '../actions';
9 6
 import { getDefaultURL } from '../functions';
10 7
 
@@ -73,23 +70,7 @@ export class AbstractApp extends BaseApp<Props, *> {
73 70
         }
74 71
     }
75 72
 
76
-    /**
77
-     * Creates an extra {@link ReactElement}s to be added (unconditionally)
78
-     * alongside the main element.
79
-     *
80
-     * @abstract
81
-     * @protected
82
-     * @returns {ReactElement}
83
-     */
84
-    _createExtraElement() {
85
-        return (
86
-            <Fragment>
87
-                <OverlayContainer />
88
-            </Fragment>
89
-        );
90
-    }
91
-
92
-    _createMainElement: (React$Element<*>, Object) => ?React$Element<*>;
73
+    _createMainElement: (React.ReactElement, Object) => ?React.ReactElement;
93 74
 
94 75
     /**
95 76
      * Gets the default URL to be opened when this {@code App} mounts.

+ 20
- 3
react/features/app/components/App.web.js View File

@@ -1,12 +1,11 @@
1
-// @flow
2
-
3 1
 import { AtlasKitThemeProvider } from '@atlaskit/theme';
4
-import React from 'react';
2
+import React, { Fragment } from 'react';
5 3
 
6 4
 import GlobalStyles from '../../base/ui/components/GlobalStyles.web';
7 5
 import JitsiThemeProvider from '../../base/ui/components/JitsiThemeProvider.web';
8 6
 import DialogContainer from '../../base/ui/components/web/DialogContainer';
9 7
 import { ChromeExtensionBanner } from '../../chrome-extension-banner';
8
+import OverlayContainer from '../../overlay/components/web/OverlayContainer';
10 9
 
11 10
 import { AbstractApp } from './AbstractApp';
12 11
 
@@ -14,12 +13,30 @@ import { AbstractApp } from './AbstractApp';
14 13
 import '../middlewares';
15 14
 import '../reducers';
16 15
 
16
+
17 17
 /**
18 18
  * Root app {@code Component} on Web/React.
19 19
  *
20 20
  * @augments AbstractApp
21 21
  */
22 22
 export class App extends AbstractApp {
23
+
24
+    /**
25
+     * Creates an extra {@link ReactElement}s to be added (unconditionally)
26
+     * alongside the main element.
27
+     *
28
+     * @abstract
29
+     * @protected
30
+     * @returns {ReactElement}
31
+     */
32
+    _createExtraElement() {
33
+        return (
34
+            <Fragment>
35
+                <OverlayContainer />
36
+            </Fragment>
37
+        );
38
+    }
39
+
23 40
     /**
24 41
      * Overrides the parent method to inject {@link AtlasKitThemeProvider} as
25 42
      * the top most component.

+ 0
- 43
react/features/base/dialog/components/DialogContent.js View File

@@ -1,43 +0,0 @@
1
-// @flow
2
-
3
-import React, { Component } from 'react';
4
-
5
-import { Container, Text } from '../../react';
6
-import { type StyleType } from '../../styles';
7
-
8
-import styles from './styles';
9
-
10
-type Props = {
11
-
12
-    /**
13
-     * Children of the component.
14
-     */
15
-    children: string | React$Node,
16
-
17
-    style: ?StyleType
18
-};
19
-
20
-/**
21
- * Generic dialog content container to provide the same styling for all custom
22
- * dialogs.
23
- */
24
-export default class DialogContent extends Component<Props> {
25
-    /**
26
-     * Implements {@code Component#render}.
27
-     *
28
-     * @inheritdoc
29
-     */
30
-    render() {
31
-        const { children, style } = this.props;
32
-
33
-        const childrenComponent = typeof children === 'string'
34
-            ? <Text style = { style }>{ children }</Text>
35
-            : children;
36
-
37
-        return (
38
-            <Container style = { styles.dialogContainer }>
39
-                { childrenComponent }
40
-            </Container>
41
-        );
42
-    }
43
-}

+ 0
- 2
react/features/base/dialog/components/index.js View File

@@ -1,5 +1,3 @@
1 1
 // @flow
2 2
 
3 3
 export * from './_';
4
-
5
-export { default as DialogContent } from './DialogContent';

+ 226
- 0
react/features/base/dialog/components/native/PageReloadDialog.tsx View File

@@ -0,0 +1,226 @@
1
+/* eslint-disable lines-around-comment */
2
+
3
+// @ts-ignore
4
+import { randomInt } from '@jitsi/js-utils/random';
5
+import React, { Component } from 'react';
6
+import { WithTranslation } from 'react-i18next';
7
+import type { Dispatch } from 'redux';
8
+
9
+import { appNavigate, reloadNow } from '../../../../app/actions.native';
10
+import { IReduxState } from '../../../../app/types';
11
+import { translate } from '../../../i18n/functions';
12
+import { isFatalJitsiConnectionError } from '../../../lib-jitsi-meet/functions.native';
13
+import { connect } from '../../../redux/functions';
14
+// @ts-ignore
15
+import logger from '../../logger';
16
+
17
+// @ts-ignore
18
+import ConfirmDialog from './ConfirmDialog';
19
+
20
+
21
+/**
22
+ * The type of the React {@code Component} props of
23
+ * {@link PageReloadDialog}.
24
+ */
25
+interface IPageReloadDialogProps extends WithTranslation {
26
+    dispatch: Dispatch<any>;
27
+    isNetworkFailure: boolean;
28
+    reason: string;
29
+}
30
+
31
+/**
32
+ * The type of the React {@code Component} state of
33
+ * {@link PageReloadDialog}.
34
+ */
35
+interface IPageReloadDialogState {
36
+    message: string;
37
+    timeLeft: number;
38
+    timeoutSeconds: number;
39
+    title: string;
40
+}
41
+
42
+/**
43
+ * Implements a React Component that is shown before the
44
+ * conference is reloaded.
45
+ * Shows a warning message and counts down towards the re-load.
46
+ */
47
+class PageReloadDialog extends Component<IPageReloadDialogProps, IPageReloadDialogState> {
48
+
49
+    // @ts-ignore
50
+    _interval: IntervalID;
51
+
52
+    /**
53
+     * Initializes a new PageReloadOverlay instance.
54
+     *
55
+     * @param {Object} props - The read-only properties with which the new
56
+     * instance is to be initialized.
57
+     * @public
58
+     */
59
+    constructor(props: IPageReloadDialogProps) {
60
+        super(props);
61
+
62
+        const timeoutSeconds = 10 + randomInt(0, 20);
63
+
64
+        let message, title;
65
+
66
+        if (this.props.isNetworkFailure) {
67
+            title = 'dialog.conferenceDisconnectTitle';
68
+            message = 'dialog.conferenceDisconnectMsg';
69
+        } else {
70
+            title = 'dialog.conferenceReloadTitle';
71
+            message = 'dialog.conferenceReloadMsg';
72
+        }
73
+
74
+        this.state = {
75
+            message,
76
+            timeLeft: timeoutSeconds,
77
+            timeoutSeconds,
78
+            title
79
+        };
80
+
81
+        this._onCancel = this._onCancel.bind(this);
82
+        this._onReloadNow = this._onReloadNow.bind(this);
83
+    }
84
+
85
+    /**
86
+     * React Component method that executes once component is mounted.
87
+     *
88
+     * @inheritdoc
89
+     * @returns {void}
90
+     */
91
+    componentDidMount() {
92
+        const { dispatch } = this.props;
93
+        const { timeLeft } = this.state;
94
+
95
+        logger.info(
96
+            `The conference will be reloaded after ${
97
+                this.state.timeoutSeconds} seconds.`);
98
+
99
+        this._interval
100
+            = setInterval(
101
+            () => {
102
+                if (timeLeft === 0) {
103
+                    if (this._interval) {
104
+                        clearInterval(this._interval);
105
+                        this._interval = undefined;
106
+                    }
107
+
108
+                    dispatch(reloadNow());
109
+                } else {
110
+                    this.setState(prevState => {
111
+                        return {
112
+                            timeLeft: prevState.timeLeft - 1
113
+                        };
114
+                    });
115
+                }
116
+            },
117
+            1000);
118
+    }
119
+
120
+    /**
121
+     * Clears the timer interval.
122
+     *
123
+     * @inheritdoc
124
+     * @returns {void}
125
+     */
126
+    componentWillUnmount() {
127
+        if (this._interval) {
128
+            clearInterval(this._interval);
129
+            this._interval = undefined;
130
+        }
131
+    }
132
+
133
+    /**
134
+     * Handle clicking of the "Cancel" button. It will navigate back to the
135
+     * welcome page.
136
+     *
137
+     * @private
138
+     * @returns {boolean}
139
+     */
140
+    _onCancel() {
141
+        clearInterval(this._interval);
142
+        this.props.dispatch(appNavigate(undefined));
143
+
144
+        return true;
145
+    }
146
+
147
+    /**
148
+     * Handle clicking on the "Reload Now" button. It will navigate to the same
149
+     * conference URL as before immediately, without waiting for the timer to
150
+     * kick in.
151
+     *
152
+     * @private
153
+     * @returns {boolean}
154
+     */
155
+    _onReloadNow() {
156
+        clearInterval(this._interval);
157
+        this.props.dispatch(reloadNow());
158
+
159
+        return true;
160
+    }
161
+
162
+    /**
163
+     * Implements React's {@link Component#render()}.
164
+     *
165
+     * @inheritdoc
166
+     * @returns {ReactElement}
167
+     */
168
+    render() {
169
+        const { t } = this.props;
170
+        const { message, timeLeft, title } = this.state;
171
+
172
+        return (
173
+            <ConfirmDialog
174
+                cancelLabel = 'dialog.Cancel'
175
+                confirmLabel = 'dialog.rejoinNow'
176
+                descriptionKey = { `${t(message, { seconds: timeLeft })}` }
177
+                onCancel = { this._onCancel }
178
+                onSubmit = { this._onReloadNow }
179
+                title = { title } />
180
+        );
181
+    }
182
+}
183
+
184
+/**
185
+ * Maps (parts of) the redux state to the associated component's props.
186
+ *
187
+ * @param {Object} state - The redux state.
188
+ * @protected
189
+ * @returns {{
190
+ *     message: string,
191
+ *     reason: string,
192
+ *     title: string
193
+ * }}
194
+ */
195
+function mapStateToProps(state: IReduxState) {
196
+    const { error: conferenceError } = state['features/base/conference'];
197
+    const { error: configError } = state['features/base/config'];
198
+    const { error: connectionError } = state['features/base/connection'];
199
+    const { fatalError } = state['features/overlay'];
200
+
201
+    const fatalConnectionError
202
+        // @ts-ignore
203
+        = connectionError && isFatalJitsiConnectionError(connectionError);
204
+    const fatalConfigError = fatalError === configError;
205
+
206
+    const isNetworkFailure = fatalConfigError || fatalConnectionError;
207
+
208
+    let reason;
209
+
210
+    if (conferenceError) {
211
+        reason = `error.conference.${conferenceError.name}`;
212
+    } else if (connectionError) {
213
+        reason = `error.conference.${connectionError.name}`;
214
+    } else if (configError) {
215
+        reason = `error.config.${configError.name}`;
216
+    } else {
217
+        logger.error('No reload reason defined!');
218
+    }
219
+
220
+    return {
221
+        isNetworkFailure,
222
+        reason
223
+    };
224
+}
225
+
226
+export default translate(connect(mapStateToProps)(PageReloadDialog));

+ 1
- 0
react/features/base/dialog/components/native/index.js View File

@@ -5,6 +5,7 @@ export { default as ConfirmDialog } from './ConfirmDialog';
5 5
 export { default as DialogContainer } from './DialogContainer';
6 6
 export { default as AlertDialog } from './AlertDialog';
7 7
 export { default as InputDialog } from './InputDialog';
8
+export { default as PageReloadDialog } from './PageReloadDialog';
8 9
 
9 10
 // NOTE: Some dialogs reuse the style of these base classes for consistency
10 11
 // and as we're in a /native namespace, it's safe to export the styles.

+ 0
- 14
react/features/base/dialog/components/styles.native.js View File

@@ -1,14 +0,0 @@
1
-import { BoxModel, createStyleSheet } from '../../styles';
2
-
3
-/**
4
- * The React {@code Component} styles of {@code Dialog}.
5
- */
6
-export default createStyleSheet({
7
-    /**
8
-     * Unified container for a consistent Dialog style.
9
-     */
10
-    dialogContainer: {
11
-        paddingHorizontal: BoxModel.padding,
12
-        paddingVertical: 1.5 * BoxModel.padding
13
-    }
14
-});

+ 0
- 5
react/features/base/dialog/components/styles.web.js View File

@@ -1,5 +0,0 @@
1
-/**
2
- * Placeholder styles for web to be able to use cross platform components
3
- * unmodified such as {@code DialogContent}.
4
- */
5
-export default {};

+ 3
- 0
react/features/base/lib-jitsi-meet/functions.any.ts View File

@@ -1,9 +1,12 @@
1
+/* eslint-disable lines-around-comment */
2
+
1 3
 import { IStateful } from '../app/types';
2 4
 import { toState } from '../redux/functions';
3 5
 
4 6
 // @ts-ignore
5 7
 import JitsiMeetJS from './_';
6 8
 
9
+
7 10
 const JitsiConferenceErrors = JitsiMeetJS.errors.conference;
8 11
 const JitsiConnectionErrors = JitsiMeetJS.errors.connection;
9 12
 

+ 10
- 1
react/features/conference/components/web/Conference.js View File

@@ -16,6 +16,7 @@ import { CalleeInfoContainer } from '../../../invite';
16 16
 import { LargeVideo } from '../../../large-video';
17 17
 import { LobbyScreen } from '../../../lobby';
18 18
 import { getIsLobbyVisible } from '../../../lobby/functions';
19
+import { getOverlayToRender } from '../../../overlay/functions.web';
19 20
 import { ParticipantsPane } from '../../../participants-pane/components/web';
20 21
 import Prejoin from '../../../prejoin/components/web/Prejoin';
21 22
 import { isPrejoinPageVisible } from '../../../prejoin/functions';
@@ -33,6 +34,7 @@ import type { AbstractProps } from '../AbstractConference';
33 34
 import ConferenceInfo from './ConferenceInfo';
34 35
 import { default as Notice } from './Notice';
35 36
 
37
+
36 38
 declare var APP: Object;
37 39
 declare var interfaceConfig: Object;
38 40
 
@@ -59,6 +61,11 @@ type Props = AbstractProps & {
59 61
      */
60 62
     _backgroundAlpha: number,
61 63
 
64
+    /**
65
+     * Are any overlays visible?
66
+     */
67
+    _isAnyOverlayVisible: boolean,
68
+
62 69
     /**
63 70
      * The CSS class to apply to the root of {@link Conference} to modify the
64 71
      * application layout.
@@ -198,6 +205,7 @@ class Conference extends AbstractConference<Props, *> {
198 205
      */
199 206
     render() {
200 207
         const {
208
+            _isAnyOverlayVisible,
201 209
             _layoutClassName,
202 210
             _notificationsVisible,
203 211
             _overflowDrawer,
@@ -234,7 +242,7 @@ class Conference extends AbstractConference<Props, *> {
234 242
 
235 243
                     { _showPrejoin || _showLobby || <Toolbox /> }
236 244
 
237
-                    {_notificationsVisible && (_overflowDrawer
245
+                    {_notificationsVisible && !_isAnyOverlayVisible && (_overflowDrawer
238 246
                         ? <JitsiPortal className = 'notification-portal'>
239 247
                             {this.renderNotificationsContainer({ portal: true })}
240 248
                         </JitsiPortal>
@@ -383,6 +391,7 @@ function _mapStateToProps(state) {
383 391
     return {
384 392
         ...abstractMapStateToProps(state),
385 393
         _backgroundAlpha: backgroundAlpha,
394
+        _isAnyOverlayVisible: Boolean(getOverlayToRender(state)),
386 395
         _layoutClassName: LAYOUT_CLASSNAMES[getCurrentLayout(state)],
387 396
         _mouseMoveCallbackInterval: mouseMoveCallbackInterval,
388 397
         _overflowDrawer: overflowDrawer,

+ 2
- 5
react/features/conference/functions.any.ts View File

@@ -1,7 +1,7 @@
1 1
 import { IStateful } from '../base/app/types';
2 2
 import { toState } from '../base/redux/functions';
3 3
 import { areThereNotifications } from '../notifications/functions';
4
-import { getOverlayToRender } from '../overlay/functions';
4
+
5 5
 
6 6
 /**
7 7
  * Tells whether or not the notifications should be displayed within
@@ -12,10 +12,7 @@ import { getOverlayToRender } from '../overlay/functions';
12 12
  */
13 13
 export function shouldDisplayNotifications(stateful: IStateful) {
14 14
     const state = toState(stateful);
15
-    const isAnyOverlayVisible = Boolean(getOverlayToRender(state));
16 15
     const { calleeInfoVisible } = state['features/invite'];
17 16
 
18
-    return areThereNotifications(state)
19
-      && !isAnyOverlayVisible
20
-      && !calleeInfoVisible;
17
+    return areThereNotifications(state) && !calleeInfoVisible;
21 18
 }

+ 0
- 11
react/features/mobile/external-api/middleware.js View File

@@ -40,7 +40,6 @@ import { getLocalTracks, isLocalTrackMuted, toggleScreensharing } from '../../ba
40 40
 import { CLOSE_CHAT, OPEN_CHAT } from '../../chat';
41 41
 import { openChat } from '../../chat/actions';
42 42
 import { closeChat, sendMessage, setPrivateMessageRecipient } from '../../chat/actions.any';
43
-import { SET_PAGE_RELOAD_OVERLAY_CANCELED } from '../../overlay/actionTypes';
44 43
 import { setRequestingSubtitles } from '../../subtitles';
45 44
 import { muteLocal } from '../../video-menu/actions';
46 45
 import { ENTER_PICTURE_IN_PICTURE } from '../picture-in-picture';
@@ -214,16 +213,6 @@ MiddlewareRegistry.register(store => next => action => {
214 213
         }
215 214
         break;
216 215
 
217
-    case SET_PAGE_RELOAD_OVERLAY_CANCELED:
218
-        sendEvent(
219
-            store,
220
-            CONFERENCE_TERMINATED,
221
-            /* data */ {
222
-                error: _toErrorString(action.error),
223
-                url: _normalizeUrl(store.getState()['features/base/connection'].locationURL)
224
-            });
225
-
226
-        break;
227 216
     case SET_VIDEO_MUTED:
228 217
         sendEvent(
229 218
             store,

react/features/mobile/navigation/components/ConnectingPage.js → react/features/mobile/navigation/components/ConnectingPage.tsx View File

@@ -1,14 +1,18 @@
1
-// @flow
1
+/* eslint-disable lines-around-comment */
2 2
 
3 3
 import React from 'react';
4 4
 import { useTranslation } from 'react-i18next';
5 5
 import { SafeAreaView, Text, View } from 'react-native';
6 6
 
7
+// @ts-ignore
7 8
 import JitsiScreen from '../../../base/modal/components/JitsiScreen';
8
-import { LoadingIndicator } from '../../../base/react';
9
+// @ts-ignore
10
+import LoadingIndicator from '../../../base/react/components/native/LoadingIndicator';
9 11
 
12
+// @ts-ignore
10 13
 import { TEXT_COLOR, navigationStyles } from './styles';
11 14
 
15
+
12 16
 const ConnectingPage = () => {
13 17
     const { t } = useTranslation();
14 18
 

react/features/mobile/navigation/components/RootNavigationContainer.js → react/features/mobile/navigation/components/RootNavigationContainer.tsx View File

@@ -1,16 +1,25 @@
1
+/* eslint-disable lines-around-comment */
2
+
1 3
 import { NavigationContainer } from '@react-navigation/native';
2 4
 import { createStackNavigator } from '@react-navigation/stack';
3 5
 import React, { useCallback } from 'react';
4 6
 import { StatusBar } from 'react-native';
5 7
 
6
-import { connect } from '../../../base/redux';
7
-import { DialInSummary } from '../../../invite';
8
+import { IReduxState } from '../../../app/types';
9
+import { connect } from '../../../base/redux/functions';
10
+// @ts-ignore
11
+import DialInSummary from '../../../invite/components/dial-in-summary/native/DialInSummary';
8 12
 import Prejoin from '../../../prejoin/components/native/Prejoin';
13
+// @ts-ignore
9 14
 import WelcomePage from '../../../welcome/components/WelcomePage';
10 15
 import { isWelcomePageEnabled } from '../../../welcome/functions';
16
+// @ts-ignore
11 17
 import { _ROOT_NAVIGATION_READY } from '../actionTypes';
18
+// @ts-ignore
12 19
 import { rootNavigationRef } from '../rootNavigationContainerRef';
20
+// @ts-ignore
13 21
 import { screen } from '../routes';
22
+// @ts-ignore
14 23
 import {
15 24
     conferenceNavigationContainerScreenOptions,
16 25
     connectingScreenOptions,
@@ -18,6 +27,7 @@ import {
18 27
     navigationContainerTheme,
19 28
     preJoinScreenOptions,
20 29
     welcomeScreenOptions
30
+    // @ts-ignore
21 31
 } from '../screenOptions';
22 32
 
23 33
 import ConnectingPage from './ConnectingPage';
@@ -32,13 +42,13 @@ type Props = {
32 42
     /**
33 43
      * Redux dispatch function.
34 44
      */
35
-    dispatch: Function,
45
+    dispatch: Function;
36 46
 
37 47
     /**
38 48
     * Is welcome page available?
39 49
     */
40
-    isWelcomePageAvailable: boolean
41
-}
50
+    isWelcomePageAvailable: boolean;
51
+};
42 52
 
43 53
 
44 54
 const RootNavigationContainer = ({ dispatch, isWelcomePageAvailable }: Props) => {
@@ -100,7 +110,7 @@ const RootNavigationContainer = ({ dispatch, isWelcomePageAvailable }: Props) =>
100 110
  * @param {Object} state - The Redux state.
101 111
  * @returns {Props}
102 112
  */
103
-function mapStateToProps(state: Object) {
113
+function mapStateToProps(state: IReduxState) {
104 114
     return {
105 115
         isWelcomePageAvailable: isWelcomePageEnabled(state)
106 116
     };

+ 0
- 23
react/features/overlay/actionTypes.ts View File

@@ -13,26 +13,3 @@
13 13
  */
14 14
 export const MEDIA_PERMISSION_PROMPT_VISIBILITY_CHANGED
15 15
     = 'MEDIA_PERMISSION_PROMPT_VISIBILITY_CHANGED';
16
-
17
-/**
18
- * Adjust the state of the fatal error which shows/hides the reload screen. See
19
- * action methods's description for more info about each of the fields.
20
- *
21
- * {
22
- *     type: SET_FATAL_ERROR,
23
- *     fatalError: ?Object
24
- * }
25
- * @public
26
- */
27
-export const SET_FATAL_ERROR = 'SET_FATAL_ERROR';
28
-
29
-/**
30
- * The type of the Redux action which signals that the overlay was canceled.
31
- *
32
- * {
33
- *     type: export const SET_PAGE_RELOAD_OVERLAY_CANCELED
34
- * }
35
- * @public
36
- */
37
-export const SET_PAGE_RELOAD_OVERLAY_CANCELED
38
-    = 'SET_PAGE_RELOAD_OVERLAY_CANCELED';

+ 31
- 0
react/features/overlay/actions.native.ts View File

@@ -0,0 +1,31 @@
1
+/* eslint-disable max-len */
2
+
3
+// @ts-ignore
4
+import { PageReloadDialog, openDialog } from '../base/dialog';
5
+
6
+
7
+/**
8
+ * Signals that the prompt for media permission is visible or not.
9
+ *
10
+ * @param {boolean} _isVisible - If the value is true - the prompt for media
11
+ * permission is visible otherwise the value is false/undefined.
12
+ * @param {string} _browser - The name of the current browser.
13
+ * @public
14
+ * @returns {{
15
+ *     type: MEDIA_PERMISSION_PROMPT_VISIBILITY_CHANGED,
16
+ *     browser: {string},
17
+ *     isVisible: {boolean}
18
+ * }}
19
+ */
20
+export function mediaPermissionPromptVisibilityChanged(_isVisible: boolean, _browser: string) {
21
+    // Dummy.
22
+}
23
+
24
+/**
25
+ * Opens {@link PageReloadDialog}.
26
+ *
27
+ * @returns {Function}
28
+ */
29
+export function openPageReloadDialog() {
30
+    return openDialog(PageReloadDialog);
31
+}

+ 0
- 62
react/features/overlay/actions.ts View File

@@ -1,62 +0,0 @@
1
-import {
2
-    MEDIA_PERMISSION_PROMPT_VISIBILITY_CHANGED,
3
-    SET_FATAL_ERROR,
4
-    SET_PAGE_RELOAD_OVERLAY_CANCELED
5
-} from './actionTypes';
6
-
7
-/**
8
- * Signals that the prompt for media permission is visible or not.
9
- *
10
- * @param {boolean} isVisible - If the value is true - the prompt for media
11
- * permission is visible otherwise the value is false/undefined.
12
- * @param {string} browser - The name of the current browser.
13
- * @public
14
- * @returns {{
15
- *     type: MEDIA_PERMISSION_PROMPT_VISIBILITY_CHANGED,
16
- *     browser: {string},
17
- *     isVisible: {boolean}
18
- * }}
19
- */
20
-export function mediaPermissionPromptVisibilityChanged(isVisible: boolean, browser: string) {
21
-    return {
22
-        type: MEDIA_PERMISSION_PROMPT_VISIBILITY_CHANGED,
23
-        browser,
24
-        isVisible
25
-    };
26
-}
27
-
28
-/**
29
- * The action indicates that an unrecoverable error has occurred and the reload
30
- * screen will be displayed or hidden.
31
- *
32
- * @param {Object} fatalError - A critical error which was not claimed by any
33
- * feature for error recovery (the recoverable flag was not set). If
34
- * {@code undefined} then any fatal error currently stored will be discarded.
35
- * @returns {{
36
- *     type: SET_FATAL_ERROR,
37
- *     fatalError: ?Error
38
- * }}
39
- */
40
-export function setFatalError(fatalError?: Object) {
41
-    return {
42
-        type: SET_FATAL_ERROR,
43
-        fatalError
44
-    };
45
-}
46
-
47
-/**
48
- * The action indicates that the overlay was canceled.
49
- *
50
- * @param {Object} error - The error that caused the display of the overlay.
51
- *
52
- * @returns {{
53
-    *     type: SET_PAGE_RELOAD_OVERLAY_CANCELED,
54
-    *     error: ?Error
55
-    * }}
56
-    */
57
-export function setPageReloadOverlayCanceled(error: Object) {
58
-    return {
59
-        type: SET_PAGE_RELOAD_OVERLAY_CANCELED,
60
-        error
61
-    };
62
-}

+ 32
- 0
react/features/overlay/actions.web.ts View File

@@ -0,0 +1,32 @@
1
+import { MEDIA_PERMISSION_PROMPT_VISIBILITY_CHANGED } from './actionTypes';
2
+
3
+
4
+/**
5
+ * Signals that the prompt for media permission is visible or not.
6
+ *
7
+ * @param {boolean} isVisible - If the value is true - the prompt for media
8
+ * permission is visible otherwise the value is false/undefined.
9
+ * @param {string} browser - The name of the current browser.
10
+ * @public
11
+ * @returns {{
12
+ *     type: MEDIA_PERMISSION_PROMPT_VISIBILITY_CHANGED,
13
+ *     browser: {string},
14
+ *     isVisible: {boolean}
15
+ * }}
16
+ */
17
+export function mediaPermissionPromptVisibilityChanged(isVisible: boolean, browser: string) {
18
+    return {
19
+        type: MEDIA_PERMISSION_PROMPT_VISIBILITY_CHANGED,
20
+        browser,
21
+        isVisible
22
+    };
23
+}
24
+
25
+/**
26
+ * Opens {@link PageReloadDialog}.
27
+ *
28
+ * @returns {Function}
29
+ */
30
+export function openPageReloadDialog() {
31
+    // Dummy
32
+}

+ 0
- 3
react/features/overlay/components/_.native.js View File

@@ -1,3 +0,0 @@
1
-// @flow
2
-
3
-export * from './native';

+ 0
- 3
react/features/overlay/components/_.web.js View File

@@ -1,3 +0,0 @@
1
-// @flow
2
-
3
-export * from './web';

+ 0
- 4
react/features/overlay/components/index.js View File

@@ -1,4 +0,0 @@
1
-// @flow
2
-
3
-export { default as OverlayContainer } from './OverlayContainer';
4
-export * from './_';

+ 0
- 38
react/features/overlay/components/native/OverlayFrame.js View File

@@ -1,38 +0,0 @@
1
-// @flow
2
-
3
-import React, { Component, type Node } from 'react';
4
-import { SafeAreaView, View } from 'react-native';
5
-
6
-import styles from './styles';
7
-
8
-/**
9
- * The type of the React {@code Component} props of {@code OverlayFrame}.
10
- */
11
-type Props = {
12
-
13
-    /**
14
-     * The children components to be displayed into the overlay frame.
15
-     */
16
-    children: Node,
17
-};
18
-
19
-/**
20
- * Implements a React component to act as the frame for overlays.
21
- */
22
-export default class OverlayFrame extends Component<Props> {
23
-    /**
24
-     * Implements React's {@link Component#render()}.
25
-     *
26
-     * @inheritdoc
27
-     * @returns {ReactElement}
28
-     */
29
-    render() {
30
-        return (
31
-            <View style = { styles.container }>
32
-                <SafeAreaView style = { styles.safeContainer } >
33
-                    { this.props.children }
34
-                </SafeAreaView>
35
-            </View>
36
-        );
37
-    }
38
-}

+ 0
- 95
react/features/overlay/components/native/PageReloadOverlay.js View File

@@ -1,95 +0,0 @@
1
-// @flow
2
-
3
-import React from 'react';
4
-
5
-import { appNavigate, reloadNow } from '../../../app/actions';
6
-import { ConfirmDialog } from '../../../base/dialog';
7
-import { translate } from '../../../base/i18n';
8
-import { connect } from '../../../base/redux';
9
-import { setFatalError, setPageReloadOverlayCanceled } from '../../actions';
10
-import AbstractPageReloadOverlay, {
11
-    type Props,
12
-    abstractMapStateToProps
13
-} from '../AbstractPageReloadOverlay';
14
-
15
-import OverlayFrame from './OverlayFrame';
16
-
17
-
18
-/**
19
- * Implements a React Component for page reload overlay. Shown before the
20
- * conference is reloaded. Shows a warning message and counts down towards the
21
- * reload.
22
- */
23
-class PageReloadOverlay extends AbstractPageReloadOverlay<Props> {
24
-    _interval: IntervalID;
25
-
26
-    /**
27
-     * Initializes a new PageReloadOverlay instance.
28
-     *
29
-     * @param {Object} props - The read-only properties with which the new
30
-     * instance is to be initialized.
31
-     * @public
32
-     */
33
-    constructor(props) {
34
-        super(props);
35
-
36
-        this._onCancel = this._onCancel.bind(this);
37
-        this._onReloadNow = this._onReloadNow.bind(this);
38
-    }
39
-
40
-    _onCancel: () => void;
41
-
42
-    /**
43
-     * Handle clicking of the "Cancel" button. It will navigate back to the
44
-     * welcome page.
45
-     *
46
-     * @private
47
-     * @returns {void}
48
-     */
49
-    _onCancel() {
50
-        clearInterval(this._interval);
51
-        this.props.dispatch(setPageReloadOverlayCanceled(this.props.error));
52
-        this.props.dispatch(setFatalError(undefined));
53
-        this.props.dispatch(appNavigate(undefined));
54
-    }
55
-
56
-    _onReloadNow: () => void;
57
-
58
-    /**
59
-     * Handle clicking on the "Reload Now" button. It will navigate to the same
60
-     * conference URL as before immediately, without waiting for the timer to
61
-     * kick in.
62
-     *
63
-     * @private
64
-     * @returns {void}
65
-     */
66
-    _onReloadNow() {
67
-        clearInterval(this._interval);
68
-        this.props.dispatch(reloadNow());
69
-    }
70
-
71
-    /**
72
-     * Implements React's {@link Component#render()}.
73
-     *
74
-     * @inheritdoc
75
-     * @returns {ReactElement}
76
-     */
77
-    render() {
78
-        const { t } = this.props;
79
-        const { message, timeLeft, title } = this.state;
80
-
81
-        return (
82
-            <OverlayFrame>
83
-                <ConfirmDialog
84
-                    cancelLabel = 'dialog.Cancel'
85
-                    confirmLabel = 'dialog.rejoinNow'
86
-                    descriptionKey = { `${t(message, { seconds: timeLeft })}` }
87
-                    onCancel = { this._onCancel }
88
-                    onSubmit = { this._onReloadNow }
89
-                    title = { title } />
90
-            </OverlayFrame>
91
-        );
92
-    }
93
-}
94
-
95
-export default translate(connect(abstractMapStateToProps)(PageReloadOverlay));

+ 0
- 4
react/features/overlay/components/native/index.js View File

@@ -1,4 +0,0 @@
1
-// @flow
2
-
3
-export { default as OverlayFrame } from './OverlayFrame';
4
-export { default as PageReloadOverlay } from './PageReloadOverlay';

+ 0
- 24
react/features/overlay/components/native/styles.js View File

@@ -1,24 +0,0 @@
1
-// @flow
2
-
3
-import { StyleSheet } from 'react-native';
4
-
5
-import BaseTheme from '../../../base/ui/components/BaseTheme.native';
6
-
7
-
8
-/**
9
- * The React {@code Component} styles of the overlay feature.
10
- */
11
-export default {
12
-    /**
13
-     * Style for a backdrop overlay covering the screen the the overlay is
14
-     * rendered.
15
-     */
16
-    container: {
17
-        ...StyleSheet.absoluteFillObject,
18
-        backgroundColor: BaseTheme.palette.ui00
19
-    },
20
-
21
-    safeContainer: {
22
-        flex: 1
23
-    }
24
-};

react/features/overlay/components/AbstractPageReloadOverlay.js → react/features/overlay/components/web/AbstractPageReloadOverlay.js View File

@@ -7,15 +7,15 @@ import type { Dispatch } from 'redux';
7 7
 import {
8 8
     createPageReloadScheduledEvent,
9 9
     sendAnalytics
10
-} from '../../analytics';
11
-import { reloadNow } from '../../app/actions';
10
+} from '../../../analytics';
11
+import { reloadNow } from '../../../app/actions';
12 12
 import {
13 13
     isFatalJitsiConferenceError,
14 14
     isFatalJitsiConnectionError
15
-} from '../../base/lib-jitsi-meet/functions';
16
-import logger from '../logger';
15
+} from '../../../base/lib-jitsi-meet/functions';
16
+import logger from '../../logger';
17 17
 
18
-import ReloadButton from './web/ReloadButton';
18
+import ReloadButton from './ReloadButton';
19 19
 
20 20
 declare var APP: Object;
21 21
 
@@ -91,6 +91,7 @@ type State = {
91 91
  */
92 92
 export default class AbstractPageReloadOverlay<P: Props>
93 93
     extends Component<P, State> {
94
+
94 95
     /**
95 96
      * Determines whether this overlay needs to be rendered (according to a
96 97
      * specific redux state). Called by {@link OverlayContainer}.
@@ -100,34 +101,18 @@ export default class AbstractPageReloadOverlay<P: Props>
100 101
      * {@code false}, otherwise.
101 102
      */
102 103
     static needsRender(state: Object) {
103
-        // FIXME web does not rely on the 'recoverable' flag set on an error
104
-        // action, but on a predefined list of fatal errors. Because of that
105
-        // the value of 'fatalError' which relies on the flag should not be used
106
-        // on web yet (until conference/connection and their errors handling is
107
-        // not unified).
108
-        return typeof APP === 'undefined'
109
-            ? Boolean(state['features/overlay'].fatalError)
110
-            : this.needsRenderWeb(state);
111
-    }
104
+        const { error: conferenceError } = state['features/base/conference'];
105
+        const { error: configError } = state['features/base/config'];
106
+        const { error: connectionError } = state['features/base/connection'];
112 107
 
113
-    /**
114
-     * Determines whether this overlay needs to be rendered (according to a
115
-     * specific redux state). Called by {@link OverlayContainer}.
116
-     *
117
-     * @param {Object} state - The redux state.
118
-     * @returns {boolean} - If this overlay needs to be rendered, {@code true};
119
-     * {@code false}, otherwise.
120
-     */
121
-    static needsRenderWeb(state: Object) {
122
-        const conferenceError = state['features/base/conference'].error;
123
-        const configError = state['features/base/config'].error;
124
-        const connectionError = state['features/base/connection'].error;
108
+        const jitsiConnectionError
125 109
 
126
-        return (
127
-            (connectionError && isFatalJitsiConnectionError(connectionError))
128
-                || (conferenceError
129
-                    && isFatalJitsiConferenceError(conferenceError))
130
-                || configError);
110
+            // @ts-ignore
111
+            = connectionError && isFatalJitsiConnectionError(connectionError);
112
+        const jitsiConferenceError
113
+            = conferenceError && isFatalJitsiConferenceError(conferenceError);
114
+
115
+        return jitsiConnectionError || jitsiConferenceError || configError;
131 116
     }
132 117
 
133 118
     _interval: ?IntervalID;

+ 1
- 1
react/features/overlay/components/web/AbstractSuspendedOverlay.js View File

@@ -28,6 +28,6 @@ export default class AbstractSuspendedOverlay extends Component<Props> {
28 28
      * {@code false}, otherwise.
29 29
      */
30 30
     static needsRender(state: Object) {
31
-        return state['features/power-monitor'].suspendDetected;
31
+        return state['features/power-monitor']?.suspendDetected;
32 32
     }
33 33
 }

react/features/overlay/components/OverlayContainer.js → react/features/overlay/components/web/OverlayContainer.tsx View File

@@ -1,11 +1,9 @@
1
-// @flow
2
-
3 1
 import React, { Component } from 'react';
4 2
 
5
-import { connect } from '../../base/redux';
6
-import { getOverlayToRender } from '../functions';
3
+import { IReduxState } from '../../../app/types';
4
+import { connect } from '../../../base/redux/functions';
5
+import { getOverlayToRender } from '../../functions.web';
7 6
 
8
-declare var interfaceConfig: Object;
9 7
 
10 8
 /**
11 9
  * The type of the React {@link Component} props of {@code OverlayContainer}.
@@ -16,8 +14,8 @@ type Props = {
16 14
      * The React {@link Component} type of overlay to be rendered by the
17 15
      * associated {@code OverlayContainer}.
18 16
      */
19
-    overlay: ?React$ComponentType<*>
20
-}
17
+    overlay: any;
18
+};
21 19
 
22 20
 /**
23 21
  * Implements a React {@link Component} that will display the correct overlay
@@ -48,7 +46,7 @@ class OverlayContainer extends Component<Props> {
48 46
  *     overlay: ?Object
49 47
  * }}
50 48
  */
51
-function _mapStateToProps(state) {
49
+function _mapStateToProps(state: IReduxState) {
52 50
     return {
53 51
         /**
54 52
          * The React {@link Component} type of overlay to be rendered by the

react/features/overlay/components/web/OverlayFrame.js → react/features/overlay/components/web/OverlayFrame.tsx View File

@@ -1,8 +1,4 @@
1
-// @flow
2
-
3
-import React, { Component } from 'react';
4
-
5
-declare var interfaceConfig: Object;
1
+import React, { Component, ReactChildren } from 'react';
6 2
 
7 3
 /**
8 4
  * The type of the React {@code Component} props of {@link OverlayFrame}.
@@ -12,18 +8,18 @@ type Props = {
12 8
     /**
13 9
      * The children components to be displayed into the overlay frame.
14 10
      */
15
-    children: React$Node,
11
+    children: ReactChildren;
16 12
 
17 13
     /**
18 14
      * Indicates the css style of the overlay. If true, then lighter; darker,
19 15
      * otherwise.
20 16
      */
21
-    isLightOverlay?: boolean,
17
+    isLightOverlay?: boolean;
22 18
 
23 19
     /**
24 20
      * The style property.
25 21
      */
26
-    style: Object
22
+    style: Object;
27 23
 };
28 24
 
29 25
 /**

+ 4
- 4
react/features/overlay/components/web/PageReloadOverlay.js View File

@@ -2,13 +2,13 @@
2 2
 
3 3
 import React from 'react';
4 4
 
5
-import { translate } from '../../../base/i18n';
6
-import { connect } from '../../../base/redux';
5
+import { translate } from '../../../base/i18n/functions';
6
+import { connect } from '../../../base/redux/functions';
7
+
7 8
 import AbstractPageReloadOverlay, {
8 9
     type Props,
9 10
     abstractMapStateToProps
10
-} from '../AbstractPageReloadOverlay';
11
-
11
+} from './AbstractPageReloadOverlay';
12 12
 import OverlayFrame from './OverlayFrame';
13 13
 
14 14
 /**

+ 0
- 7
react/features/overlay/components/web/index.js View File

@@ -1,7 +0,0 @@
1
-// @flow
2
-
3
-export { default as OverlayFrame } from './OverlayFrame';
4
-
5
-export { default as PageReloadOverlay } from './PageReloadOverlay';
6
-export { default as SuspendedOverlay } from './SuspendedOverlay';
7
-export { default as UserMediaPermissionsOverlay } from './UserMediaPermissionsOverlay';

react/features/overlay/functions.ts → react/features/overlay/functions.web.ts View File

@@ -1,7 +1,13 @@
1
-import { IReduxState } from '../app/types';
1
+/* eslint-disable lines-around-comment */
2 2
 
3
-import { getOverlays } from './overlays';
3
+import { IReduxState } from '../app/types';
4 4
 
5
+// @ts-ignore
6
+import PageReloadOverlay from './components/web/PageReloadOverlay';
7
+// @ts-ignore
8
+import SuspendedOverlay from './components/web/SuspendedOverlay';
9
+// @ts-ignore
10
+import UserMediaPermissionsOverlay from './components/web/UserMediaPermissionsOverlay';
5 11
 /**
6 12
  * Returns the overlay to be currently rendered.
7 13
  *
@@ -9,7 +15,13 @@ import { getOverlays } from './overlays';
9 15
  * @returns {?React$ComponentType<*>}
10 16
  */
11 17
 export function getOverlayToRender(state: IReduxState) {
12
-    for (const overlay of getOverlays()) {
18
+    const overlays = [
19
+        PageReloadOverlay,
20
+        SuspendedOverlay,
21
+        UserMediaPermissionsOverlay
22
+    ];
23
+
24
+    for (const overlay of overlays) {
13 25
         // react-i18n / react-redux wrap components and thus we cannot access
14 26
         // the wrapped component's static methods directly.
15 27
         // @ts-ignore
@@ -22,13 +34,3 @@ export function getOverlayToRender(state: IReduxState) {
22 34
 
23 35
     return undefined;
24 36
 }
25
-
26
-/**
27
- * Returns the visibility of the media permissions prompt.
28
- *
29
- * @param {IReduxState} state - The Redux state.
30
- * @returns {boolean}
31
- */
32
-export function getMediaPermissionPromptVisibility(state: IReduxState) {
33
-    return state['features/overlay'].isMediaPermissionPromptVisible;
34
-}

+ 0
- 5
react/features/overlay/index.js View File

@@ -1,5 +0,0 @@
1
-// @flow
2
-
3
-export * from './actions';
4
-export * from './components';
5
-export * from './functions';

+ 16
- 8
react/features/overlay/middleware.ts View File

@@ -1,12 +1,15 @@
1
+/* eslint-disable lines-around-comment */
2
+
1 3
 import { IStore } from '../app/types';
2 4
 import { JitsiConferenceErrors } from '../base/lib-jitsi-meet';
3 5
 import {
4 6
     isFatalJitsiConferenceError,
5 7
     isFatalJitsiConnectionError
6
-} from '../base/lib-jitsi-meet/functions';
8
+} from '../base/lib-jitsi-meet/functions.any';
7 9
 import StateListenerRegistry from '../base/redux/StateListenerRegistry';
8 10
 
9
-import { setFatalError } from './actions';
11
+import { openPageReloadDialog } from './actions';
12
+
10 13
 
11 14
 /**
12 15
  * Error type. Basically like Error, but augmented with a recoverable property.
@@ -47,12 +50,11 @@ const ERROR_TYPES = {
47 50
 /**
48 51
  * Gets the error type and whether it's fatal or not.
49 52
  *
50
- * @param {Function} getState - The redux function for fetching the current state.
53
+ * @param {Object} state - The redux state.
51 54
  * @param {Object|string} error - The error to process.
52 55
  * @returns {void}
53 56
  */
54
-const getErrorExtraInfo = (getState: IStore['getState'], error: ErrorType) => {
55
-    const state = getState();
57
+const getErrorExtraInfo = (state: any, error: ErrorType) => {
56 58
     const { error: conferenceError } = state['features/base/conference'];
57 59
     const { error: configError } = state['features/base/config'];
58 60
     const { error: connectionError } = state['features/base/connection'];
@@ -92,20 +94,26 @@ StateListenerRegistry.register(
92 94
 
93 95
         return configError || connectionError || conferenceError;
94 96
     },
95
-    /* listener */ (error: ErrorType, { dispatch, getState }) => {
97
+    /* listener */ (error: ErrorType, store: IStore) => {
98
+        const state = store.getState();
99
+
96 100
         if (!error) {
97 101
             return;
98 102
         }
99 103
 
104
+        // eslint-disable-next-line no-negated-condition
100 105
         if (typeof APP !== 'undefined') {
101 106
             APP.API.notifyError({
102 107
                 ...error,
103
-                ...getErrorExtraInfo(getState, error)
108
+                ...getErrorExtraInfo(state, error)
104 109
             });
105 110
         }
106 111
 
107 112
         if (NON_OVERLAY_ERRORS.indexOf(error.name) === -1 && typeof error.recoverable === 'undefined') {
108
-            dispatch(setFatalError(error));
113
+            setTimeout(() => {
114
+                // @ts-ignore
115
+                store.dispatch(openPageReloadDialog());
116
+            }, 500);
109 117
         }
110 118
     }
111 119
 );

+ 0
- 15
react/features/overlay/overlays.native.ts View File

@@ -1,15 +0,0 @@
1
-import { ReactElement } from 'react';
2
-
3
-// @ts-ignore
4
-import { PageReloadOverlay } from './components/native';
5
-
6
-/**
7
- * Returns the list of available platform specific overlays.
8
- *
9
- * @returns {Array<ReactElement>}
10
- */
11
-export function getOverlays(): Array<ReactElement> {
12
-    return [
13
-        PageReloadOverlay
14
-    ];
15
-}

+ 0
- 20
react/features/overlay/overlays.web.ts View File

@@ -1,20 +0,0 @@
1
-import {
2
-    PageReloadOverlay,
3
-    SuspendedOverlay,
4
-    UserMediaPermissionsOverlay
5
-
6
-    // @ts-ignore
7
-} from './components/web';
8
-
9
-/**
10
- * Returns the list of available platform specific overlays.
11
- *
12
- * @returns {Array<Object>}
13
- */
14
-export function getOverlays(): Array<Object> {
15
-    return [
16
-        PageReloadOverlay,
17
-        SuspendedOverlay,
18
-        UserMediaPermissionsOverlay
19
-    ];
20
-}

+ 3
- 43
react/features/overlay/reducer.ts View File

@@ -1,17 +1,13 @@
1
-import { CONFIG_WILL_LOAD, LOAD_CONFIG_ERROR, SET_CONFIG } from '../base/config/actionTypes';
2 1
 import ReducerRegistry from '../base/redux/ReducerRegistry';
3
-import { assign, set } from '../base/redux/functions';
2
+import { assign } from '../base/redux/functions';
3
+
4
+import { MEDIA_PERMISSION_PROMPT_VISIBILITY_CHANGED } from './actionTypes';
4 5
 
5
-import {
6
-    MEDIA_PERMISSION_PROMPT_VISIBILITY_CHANGED,
7
-    SET_FATAL_ERROR
8
-} from './actionTypes';
9 6
 
10 7
 export interface IOverlayState {
11 8
     browser?: string;
12 9
     fatalError?: Error;
13 10
     isMediaPermissionPromptVisible?: boolean;
14
-    loadConfigOverlayVisible?: boolean;
15 11
 }
16 12
 
17 13
 /**
@@ -21,18 +17,8 @@ export interface IOverlayState {
21 17
  */
22 18
 ReducerRegistry.register<IOverlayState>('features/overlay', (state = {}, action): IOverlayState => {
23 19
     switch (action.type) {
24
-    case CONFIG_WILL_LOAD:
25
-        return _setShowLoadConfigOverlay(state, Boolean(action.room));
26
-
27
-    case LOAD_CONFIG_ERROR:
28
-    case SET_CONFIG:
29
-        return _setShowLoadConfigOverlay(state, false);
30
-
31 20
     case MEDIA_PERMISSION_PROMPT_VISIBILITY_CHANGED:
32 21
         return _mediaPermissionPromptVisibilityChanged(state, action);
33
-
34
-    case SET_FATAL_ERROR:
35
-        return _setFatalError(state, action);
36 22
     }
37 23
 
38 24
     return state;
@@ -56,29 +42,3 @@ function _mediaPermissionPromptVisibilityChanged(
56 42
         isMediaPermissionPromptVisible: isVisible
57 43
     });
58 44
 }
59
-
60
-/**
61
- * Sets the {@code LoadConfigOverlay} overlay visible or not.
62
- *
63
- * @param {Object} state - The redux state of the feature overlay.
64
- * @param {boolean} show - Whether to show or not the overlay.
65
- * @returns {Object} The new state of the feature overlay after the reduction of
66
- * the specified action.
67
- */
68
-function _setShowLoadConfigOverlay(state: IOverlayState, show?: boolean) {
69
-    return set(state, 'loadConfigOverlayVisible', show);
70
-}
71
-
72
-/**
73
- * Reduces a specific redux action {@code SET_FATAL_ERROR} of the feature
74
- * overlay.
75
- *
76
- * @param {Object} state - The redux state of the feature overlay.
77
- * @param {Error} fatalError - If the value is set it indicates that a fatal
78
- * error has occurred and that the reload screen is to be displayed.
79
- * @returns {Object}
80
- * @private
81
- */
82
-function _setFatalError(state: IOverlayState, { fatalError }: { fatalError?: Error; }) {
83
-    return set(state, 'fatalError', fatalError);
84
-}

Loading…
Cancel
Save