|
@@ -1,50 +0,0 @@
|
1
|
|
-/* @flow */
|
2
|
|
-// FIXME: Using '../config/actionTypes' instead of '../config' is a quick fix
|
3
|
|
-// for the dial-in info page. Importing '../config' results in JitsiMeetJS
|
4
|
|
-// undefined error (/base/config imports /app which import /lib-jitsi-meet/).
|
5
|
|
-import { SET_CONFIG } from '../config/actionTypes';
|
6
|
|
-import { MiddlewareRegistry } from '../redux';
|
7
|
|
-
|
8
|
|
-declare var APP: Object;
|
9
|
|
-
|
10
|
|
-/**
|
11
|
|
- * The redux middleware of the feature base/i18n.
|
12
|
|
- *
|
13
|
|
- * @param {Store} store - The redux store.
|
14
|
|
- * @returns {Function}
|
15
|
|
- * @private
|
16
|
|
- */
|
17
|
|
-MiddlewareRegistry.register(store => next => action => {
|
18
|
|
- switch (action.type) {
|
19
|
|
- case SET_CONFIG:
|
20
|
|
- return _setConfig(store, next, action);
|
21
|
|
- }
|
22
|
|
-
|
23
|
|
- return next(action);
|
24
|
|
-});
|
25
|
|
-
|
26
|
|
-/**
|
27
|
|
- * Notifies the feature base/i18n that the action SET_CONFIG is being dispatched
|
28
|
|
- * within a specific redux store.
|
29
|
|
- *
|
30
|
|
- * @param {Store} store - The redux store in which the specified action is being
|
31
|
|
- * dispatched.
|
32
|
|
- * @param {Dispatch} next - The redux dispatch function to dispatch the
|
33
|
|
- * specified action to the specified store.
|
34
|
|
- * @param {Action} action - The redux action SET_CONFIG which is being
|
35
|
|
- * dispatched in the specified store.
|
36
|
|
- * @private
|
37
|
|
- * @returns {Object} The new state that is the result of the reduction of the
|
38
|
|
- * specified action.
|
39
|
|
- */
|
40
|
|
-function _setConfig({ getState }, next, action) {
|
41
|
|
- const oldValue = getState()['features/base/config'];
|
42
|
|
- const result = next(action);
|
43
|
|
- const newValue = getState()['features/base/config'];
|
44
|
|
-
|
45
|
|
- if (oldValue !== newValue && typeof APP === 'object') {
|
46
|
|
- APP.translation.init();
|
47
|
|
- }
|
48
|
|
-
|
49
|
|
- return result;
|
50
|
|
-}
|