ソースを参照

ref(DeviceSelectionPopup): remove.

master
Hristo Terezov 4年前
コミット
7dc899ace1

+ 0
- 2
Makefile ファイルの表示

@@ -42,8 +42,6 @@ deploy-appbundle:
42 42
 		$(BUILD_DIR)/external_api.min.map \
43 43
 		$(BUILD_DIR)/flacEncodeWorker.min.js \
44 44
 		$(BUILD_DIR)/flacEncodeWorker.min.map \
45
-		$(BUILD_DIR)/device_selection_popup_bundle.min.js \
46
-		$(BUILD_DIR)/device_selection_popup_bundle.min.map \
47 45
 		$(BUILD_DIR)/dial_in_info_bundle.min.js \
48 46
 		$(BUILD_DIR)/dial_in_info_bundle.min.map \
49 47
 		$(BUILD_DIR)/alwaysontop.min.js \

+ 0
- 1
react/features/app/reducers.any.js ファイルの表示

@@ -29,7 +29,6 @@ import '../blur/reducer';
29 29
 import '../calendar-sync/reducer';
30 30
 import '../chat/reducer';
31 31
 import '../deep-linking/reducer';
32
-import '../device-selection/reducer';
33 32
 import '../dropbox/reducer';
34 33
 import '../dynamic-branding/reducer';
35 34
 import '../etherpad/reducer';

+ 0
- 10
react/features/device-selection/actionTypes.js ファイルの表示

@@ -1,10 +0,0 @@
1
-/**
2
- * The type of Redux action which Sets information about device selection popup.
3
- *
4
- * {{
5
- *     type: SET_DEVICE_SELECTION_POPUP_DATA,
6
- *     popupDialogData: Object
7
- * }}
8
- */
9
-export const SET_DEVICE_SELECTION_POPUP_DATA
10
-    = 'SET_DEVICE_SELECTION_POPUP_DATA';

+ 1
- 88
react/features/device-selection/actions.js ファイルの表示

@@ -1,8 +1,3 @@
1
-import { API_ID } from '../../../modules/API/constants';
2
-import {
3
-    PostMessageTransportBackend,
4
-    Transport
5
-} from '../../../modules/transport';
6 1
 import { createDeviceChangedEvent, sendAnalytics } from '../analytics';
7 2
 import {
8 3
     getDeviceLabelById,
@@ -10,93 +5,11 @@ import {
10 5
     setAudioOutputDeviceId,
11 6
     setVideoInputDevice
12 7
 } from '../base/devices';
13
-import { i18next } from '../base/i18n';
14 8
 import { updateSettings } from '../base/settings';
15 9
 
16
-import { SET_DEVICE_SELECTION_POPUP_DATA } from './actionTypes';
17
-import { getDeviceSelectionDialogProps, processExternalDeviceRequest } from './functions';
10
+import { getDeviceSelectionDialogProps } from './functions';
18 11
 import logger from './logger';
19 12
 
20
-/**
21
- * Opens a popup window with the device selection dialog in it.
22
- *
23
- * @returns {Function}
24
- */
25
-export function openDeviceSelectionPopup() {
26
-    return (dispatch, getState) => {
27
-        const { popupDialogData } = getState()['features/device-selection'];
28
-
29
-        if (popupDialogData) {
30
-            popupDialogData.popup.focus();
31
-
32
-            return;
33
-        }
34
-
35
-        // API_ID will always be defined because the iframe api is enabled
36
-        const scope = `dialog_${API_ID}`;
37
-        const url = `${
38
-            window.location.origin}/static/deviceSelectionPopup.html#scope=${
39
-            encodeURIComponent(JSON.stringify(scope))}`;
40
-        const popup
41
-            = window.open(
42
-                url,
43
-                'device-selection-popup',
44
-                'toolbar=no,scrollbars=no,resizable=no,width=720,height=458');
45
-
46
-        popup.addEventListener('DOMContentLoaded', () => {
47
-            popup.init(i18next);
48
-        });
49
-
50
-        const transport = new Transport({
51
-            backend: new PostMessageTransportBackend({
52
-                postisOptions: {
53
-                    scope,
54
-                    window: popup
55
-                }
56
-            })
57
-        });
58
-
59
-        transport.on('request',
60
-            processExternalDeviceRequest.bind(undefined, dispatch, getState));
61
-        transport.on('event', event => {
62
-            if (event.type === 'devices-dialog' && event.name === 'close') {
63
-                popup.close();
64
-                transport.dispose();
65
-                dispatch(_setDeviceSelectionPopupData());
66
-
67
-                return true;
68
-            }
69
-
70
-            return false;
71
-        });
72
-
73
-        dispatch(_setDeviceSelectionPopupData({
74
-            popup,
75
-            transport
76
-        }));
77
-    };
78
-}
79
-
80
-/**
81
- * Sets information about device selection popup in the store.
82
- *
83
- * @param {Object} popupDialogData - Information about the popup.
84
- * @param {Object} popupDialog.popup - The popup object returned from
85
- * window.open.
86
- * @param {Object} popupDialogData.transport - The transport instance used for
87
- * communication with the popup window.
88
- * @returns {{
89
- *     type: SET_DEVICE_SELECTION_POPUP_DATA,
90
- *     popupDialogData: Object
91
- * }}
92
- */
93
-function _setDeviceSelectionPopupData(popupDialogData) {
94
-    return {
95
-        type: SET_DEVICE_SELECTION_POPUP_DATA,
96
-        popupDialogData
97
-    };
98
-}
99
-
100 13
 /**
101 14
  * Submits the settings related to device selection.
102 15
  *

+ 0
- 1
react/features/device-selection/index.js ファイルの表示

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

+ 0
- 8
react/features/device-selection/middleware.js ファイルの表示

@@ -17,16 +17,8 @@ MiddlewareRegistry.register(store => next => action => {
17 17
 
18 18
     if (action.type === UPDATE_DEVICE_LIST) {
19 19
         const state = store.getState();
20
-        const { popupDialogData } = state['features/device-selection'];
21 20
         const { availableDevices } = state['features/base/devices'] || {};
22 21
 
23
-        if (popupDialogData) {
24
-            popupDialogData.transport.sendEvent({
25
-                name: 'deviceListChanged',
26
-                devices: availableDevices
27
-            });
28
-        }
29
-
30 22
         if (typeof APP !== 'undefined') {
31 23
             APP.API.notifyDeviceListChanged(availableDevices);
32 24
         }

+ 0
- 28
react/features/device-selection/reducer.js ファイルの表示

@@ -1,28 +0,0 @@
1
-import { ReducerRegistry } from '../base/redux';
2
-
3
-import { SET_DEVICE_SELECTION_POPUP_DATA } from './actionTypes';
4
-
5
-/**
6
- * Listen for actions which changes the state of the popup window for the device
7
- * selection.
8
- *
9
- * @param {Object} state - The Redux state of the feature
10
- * features/device-selection.
11
- * @param {Object} action - Action object.
12
- * @param {string} action.type - Type of action.
13
- * @param {Object} action.popupDialogData - Object that stores the current
14
- * Window object of the popup and the Transport instance. If no popup is shown
15
- * the value will be undefined.
16
- * @returns {Object}
17
- */
18
-ReducerRegistry.register('features/device-selection',
19
-    (state = {}, action) => {
20
-        if (action.type === SET_DEVICE_SELECTION_POPUP_DATA) {
21
-            return {
22
-                ...state,
23
-                popupDialogData: action.popupDialogData
24
-            };
25
-        }
26
-
27
-        return state;
28
-    });

+ 0
- 299
react/features/settings/components/web/DeviceSelectionPopup.js ファイルの表示

@@ -1,299 +0,0 @@
1
-/* global JitsiMeetJS */
2
-
3
-import { AtlasKitThemeProvider } from '@atlaskit/theme';
4
-import React from 'react';
5
-import ReactDOM from 'react-dom';
6
-import { I18nextProvider } from 'react-i18next';
7
-
8
-import {
9
-    getAvailableDevices,
10
-    getCurrentDevices,
11
-    isDeviceChangeAvailable,
12
-    isDeviceListAvailable,
13
-    isMultipleAudioInputSupported,
14
-    setAudioInputDevice,
15
-    setAudioOutputDevice,
16
-    setVideoInputDevice
17
-} from '../../../../../modules/API/external/functions';
18
-import {
19
-    PostMessageTransportBackend,
20
-    Transport
21
-} from '../../../../../modules/transport';
22
-import DialogWithTabs from '../../../base/dialog/components/web/DialogWithTabs';
23
-import { parseURLParams } from '../../../base/util/parseURLParams';
24
-import DeviceSelection from '../../../device-selection/components/DeviceSelection';
25
-
26
-/**
27
- * Implements a class that renders the React components for the device selection
28
- * popup page and handles the communication between the components and Jitsi
29
- * Meet.
30
- */
31
-export default class DeviceSelectionPopup {
32
-    /**
33
-     * Initializes a new DeviceSelectionPopup instance.
34
-     *
35
-     * @param {Object} i18next - The i18next instance used for translation.
36
-     */
37
-    constructor(i18next) {
38
-        this.close = this.close.bind(this);
39
-        this._i18next = i18next;
40
-        this._onSubmit = this._onSubmit.bind(this);
41
-
42
-        const { scope } = parseURLParams(window.location);
43
-
44
-        this._transport = new Transport({
45
-            backend: new PostMessageTransportBackend({
46
-                postisOptions: {
47
-                    scope,
48
-                    window: window.opener
49
-                }
50
-            })
51
-        });
52
-
53
-        this._transport.on('event', event => {
54
-            if (event.name === 'deviceListChanged') {
55
-                this._updateAvailableDevices();
56
-
57
-                return true;
58
-            }
59
-
60
-            return false;
61
-        });
62
-
63
-        this._dialogProps = {
64
-            availableDevices: {},
65
-            selectedAudioInputId: '',
66
-            selectedAudioOutputId: '',
67
-            selectedVideoInputId: '',
68
-            disableAudioInputChange: true,
69
-            disableBlanketClickDismiss: true,
70
-            disableDeviceChange: true,
71
-            hideAudioInputPreview: !JitsiMeetJS.isCollectingLocalStats(),
72
-            hideAudioOutputSelect: true
73
-
74
-        };
75
-        this._initState();
76
-    }
77
-
78
-    /**
79
-     * Sends event to Jitsi Meet to close the popup dialog.
80
-     *
81
-     * @returns {void}
82
-     */
83
-    close() {
84
-        this._transport.sendEvent({
85
-            type: 'devices-dialog',
86
-            name: 'close'
87
-        });
88
-    }
89
-
90
-    /**
91
-     * Changes the properties of the react component and re-renders it.
92
-     *
93
-     * @param {Object} newProps - The new properties that will be assigned to
94
-     * the current ones.
95
-     * @returns {void}
96
-     */
97
-    _changeDialogProps(newProps) {
98
-        this._dialogProps = {
99
-            ...this._dialogProps,
100
-            ...newProps
101
-        };
102
-        this._render();
103
-    }
104
-
105
-    /**
106
-     * Returns Promise that resolves with result an list of available devices.
107
-     *
108
-     * @returns {Promise}
109
-     */
110
-    _getAvailableDevices() {
111
-        return getAvailableDevices(this._transport);
112
-    }
113
-
114
-    /**
115
-     * Returns Promise that resolves with current selected devices.
116
-     *
117
-     * @returns {Promise}
118
-     */
119
-    _getCurrentDevices() {
120
-        return getCurrentDevices(this._transport).then(currentDevices => {
121
-            const {
122
-                audioInput = {},
123
-                audioOutput = {},
124
-                videoInput = {}
125
-            } = currentDevices;
126
-
127
-            return {
128
-                audioInput: audioInput.deviceId,
129
-                audioOutput: audioOutput.deviceId,
130
-                videoInput: videoInput.deviceId
131
-            };
132
-        });
133
-    }
134
-
135
-    /**
136
-     * Initializes the state.
137
-     *
138
-     * @returns {void}
139
-     */
140
-    _initState() {
141
-        return Promise.all([
142
-            this._getAvailableDevices(),
143
-            this._isDeviceListAvailable(),
144
-            this._isDeviceChangeAvailable(),
145
-            this._isDeviceChangeAvailable('output'),
146
-            this._getCurrentDevices(),
147
-            this._isMultipleAudioInputSupported()
148
-        ]).then(([
149
-            availableDevices,
150
-            listAvailable,
151
-            changeAvailable,
152
-            changeOutputAvailable,
153
-            currentDevices,
154
-            multiAudioInputSupported
155
-        ]) => {
156
-            this._changeDialogProps({
157
-                availableDevices,
158
-                selectedAudioInputId: currentDevices.audioInput,
159
-                selectedAudioOutputId: currentDevices.audioOutput,
160
-                selectedVideoInputId: currentDevices.videoInput,
161
-                disableAudioInputChange: !multiAudioInputSupported,
162
-                disableDeviceChange: !listAvailable || !changeAvailable,
163
-                hideAudioOutputSelect: !changeOutputAvailable
164
-            });
165
-        });
166
-    }
167
-
168
-    /**
169
-     * Returns Promise that resolves with true if the device change is available
170
-     * and with false if not.
171
-     *
172
-     * @param {string} [deviceType] - Values - 'output', 'input' or undefined.
173
-     * Default - 'input'.
174
-     * @returns {Promise}
175
-     */
176
-    _isDeviceChangeAvailable(deviceType) {
177
-        return isDeviceChangeAvailable(this._transport, deviceType).catch(() => false);
178
-    }
179
-
180
-    /**
181
-     * Returns Promise that resolves with true if the device list is available
182
-     * and with false if not.
183
-     *
184
-     * @returns {Promise}
185
-     */
186
-    _isDeviceListAvailable() {
187
-        return isDeviceListAvailable(this._transport).catch(() => false);
188
-    }
189
-
190
-    /**
191
-     * Returns Promise that resolves with true if multiple audio input is supported
192
-     * and with false if not.
193
-     *
194
-     * @returns {Promise}
195
-     */
196
-    _isMultipleAudioInputSupported() {
197
-        return isMultipleAudioInputSupported(this._transport).catch(() => false);
198
-    }
199
-
200
-    /**
201
-     * Callback invoked to save changes to selected devices and close the
202
-     * dialog.
203
-     *
204
-     * @param {Object} newSettings - The chosen device IDs.
205
-     * @private
206
-     * @returns {void}
207
-     */
208
-    _onSubmit(newSettings) {
209
-        const promises = [];
210
-
211
-        if (newSettings.selectedVideoInputId
212
-                !== this._dialogProps.selectedVideoInputId) {
213
-            promises.push(
214
-                this._setVideoInputDevice(newSettings.selectedVideoInputId));
215
-        }
216
-
217
-        if (newSettings.selectedAudioInputId
218
-                !== this._dialogProps.selectedAudioInputId) {
219
-            promises.push(
220
-                this._setAudioInputDevice(newSettings.selectedAudioInputId));
221
-        }
222
-
223
-        if (newSettings.selectedAudioOutputId
224
-                !== this._dialogProps.selectedAudioOutputId) {
225
-            promises.push(
226
-                this._setAudioOutputDevice(newSettings.selectedAudioOutputId));
227
-        }
228
-
229
-        Promise.all(promises).then(this.close, this.close);
230
-    }
231
-
232
-    /**
233
-     * Renders the React components for the popup page.
234
-     *
235
-     * @returns {void}
236
-     */
237
-    _render() {
238
-        const onSubmit = this.close;
239
-
240
-        ReactDOM.render(
241
-            <I18nextProvider i18n = { this._i18next }>
242
-                <AtlasKitThemeProvider mode = 'dark'>
243
-                    <DialogWithTabs
244
-                        closeDialog = { this.close }
245
-                        cssClassName = 'settings-dialog'
246
-                        onSubmit = { onSubmit }
247
-                        tabs = { [ {
248
-                            component: DeviceSelection,
249
-                            label: 'settings.devices',
250
-                            props: this._dialogProps,
251
-                            submit: this._onSubmit
252
-                        } ] }
253
-                        titleKey = 'settings.title' />
254
-                </AtlasKitThemeProvider>
255
-            </I18nextProvider>,
256
-            document.getElementById('react'));
257
-    }
258
-
259
-    /**
260
-     * Sets the audio input device to the one with the id that is passed.
261
-     *
262
-     * @param {string} id - The id of the new device.
263
-     * @returns {Promise}
264
-     */
265
-    _setAudioInputDevice(id) {
266
-        return setAudioInputDevice(this._transport, undefined, id);
267
-    }
268
-
269
-    /**
270
-     * Sets the audio output device to the one with the id that is passed.
271
-     *
272
-     * @param {string} id - The id of the new device.
273
-     * @returns {Promise}
274
-     */
275
-    _setAudioOutputDevice(id) {
276
-        return setAudioOutputDevice(this._transport, undefined, id);
277
-    }
278
-
279
-    /**
280
-     * Sets the video input device to the one with the id that is passed.
281
-     *
282
-     * @param {string} id - The id of the new device.
283
-     * @returns {Promise}
284
-     */
285
-    _setVideoInputDevice(id) {
286
-        return setVideoInputDevice(this._transport, undefined, id);
287
-    }
288
-
289
-    /**
290
-     * Updates the available devices.
291
-     *
292
-     * @returns {void}
293
-     */
294
-    _updateAvailableDevices() {
295
-        this._getAvailableDevices().then(devices =>
296
-            this._changeDialogProps({ availableDevices: devices })
297
-        );
298
-    }
299
-}

+ 0
- 12
react/features/settings/popup.js ファイルの表示

@@ -1,12 +0,0 @@
1
-/* global JitsiMeetJS */
2
-
3
-import DeviceSelectionPopup from './components/web/DeviceSelectionPopup';
4
-
5
-let deviceSelectionPopup;
6
-
7
-window.init = i18next => {
8
-    JitsiMeetJS.init();
9
-    deviceSelectionPopup = new DeviceSelectionPopup(i18next);
10
-};
11
-
12
-window.addEventListener('beforeunload', () => deviceSelectionPopup.close());

+ 0
- 21
static/deviceSelectionPopup.html ファイルの表示

@@ -1,21 +0,0 @@
1
-<html itemscope itemtype="http://schema.org/Product" prefix="og: http://ogp.me/ns#" xmlns="http://www.w3.org/1999/html">
2
-  <head>
3
-    <meta charset="utf-8">
4
-    <meta http-equiv="content-type" content="text/html;charset=utf-8">
5
-    <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
-    <!--#include virtual="/base.html" -->
7
-
8
-    <link rel="stylesheet" href="css/all.css">
9
-
10
-    <!--#include virtual="/title.html" -->
11
-    <script><!--#include virtual="/interface_config.js" --></script>
12
-    <script>
13
-        window.config = {};
14
-    </script>
15
-    <script src="libs/lib-jitsi-meet.min.js?v=139"></script>
16
-    <script src="libs/device_selection_popup_bundle.min.js?v=1"></script>
17
-  </head>
18
-  <body>
19
-    <div id="react"></div>
20
-  </body>
21
-</html>

+ 0
- 6
webpack.config.js ファイルの表示

@@ -196,12 +196,6 @@ module.exports = [
196 196
         },
197 197
         performance: getPerformanceHints(4 * 1024 * 1024)
198 198
     }),
199
-    Object.assign({}, config, {
200
-        entry: {
201
-            'device_selection_popup_bundle': './react/features/settings/popup.js'
202
-        },
203
-        performance: getPerformanceHints(750 * 1024)
204
-    }),
205 199
     Object.assign({}, config, {
206 200
         entry: {
207 201
             'alwaysontop': './react/features/always-on-top/index.js'

読み込み中…
キャンセル
保存