|
@@ -4,12 +4,10 @@ import { jitsiLocalStorage } from '@jitsi/js-utils';
|
4
|
4
|
import _ from 'lodash';
|
5
|
5
|
|
6
|
6
|
import { APP_WILL_MOUNT } from '../app/actionTypes';
|
7
|
|
-import { browser } from '../lib-jitsi-meet';
|
8
|
7
|
import { PersistenceRegistry, ReducerRegistry } from '../redux';
|
9
|
8
|
import { assignIfDefined } from '../util';
|
10
|
9
|
|
11
|
10
|
import { SETTINGS_UPDATED } from './actionTypes';
|
12
|
|
-import logger from './logger';
|
13
|
11
|
|
14
|
12
|
/**
|
15
|
13
|
* The default/initial redux state of the feature {@code base/settings}.
|
|
@@ -75,41 +73,10 @@ ReducerRegistry.register(STORE_NAME, (state = DEFAULT_STATE, action) => {
|
75
|
73
|
return state;
|
76
|
74
|
});
|
77
|
75
|
|
78
|
|
-/**
|
79
|
|
- * Retrieves the legacy profile values regardless of it's being in pre or
|
80
|
|
- * post-flattening format.
|
81
|
|
- *
|
82
|
|
- * FIXME: Let's remove this after a predefined time (e.g. By July 2018) to avoid
|
83
|
|
- * garbage in the source.
|
84
|
|
- *
|
85
|
|
- * @private
|
86
|
|
- * @returns {Object}
|
87
|
|
- */
|
88
|
|
-function _getLegacyProfile() {
|
89
|
|
- let persistedProfile = jitsiLocalStorage.getItem('features/base/profile');
|
90
|
|
-
|
91
|
|
- if (persistedProfile) {
|
92
|
|
- try {
|
93
|
|
- persistedProfile = JSON.parse(persistedProfile);
|
94
|
|
-
|
95
|
|
- if (persistedProfile && typeof persistedProfile === 'object') {
|
96
|
|
- const preFlattenedProfile = persistedProfile.profile;
|
97
|
|
-
|
98
|
|
- return preFlattenedProfile || persistedProfile;
|
99
|
|
- }
|
100
|
|
- } catch (e) {
|
101
|
|
- logger.warn('Error parsing persisted legacy profile', e);
|
102
|
|
- }
|
103
|
|
- }
|
104
|
|
-
|
105
|
|
- return {};
|
106
|
|
-}
|
107
|
|
-
|
108
|
76
|
/**
|
109
|
77
|
* Inits the settings object based on what information we have available.
|
110
|
78
|
* Info taken into consideration:
|
111
|
|
- * - Old Settings.js style data
|
112
|
|
- * - Things that we stored in profile earlier but belong here.
|
|
79
|
+ * - Old Settings.js style data.
|
113
|
80
|
*
|
114
|
81
|
* @private
|
115
|
82
|
* @param {Object} featureState - The current state of the feature.
|
|
@@ -138,28 +105,5 @@ function _initSettings(featureState) {
|
138
|
105
|
email
|
139
|
106
|
}, settings);
|
140
|
107
|
|
141
|
|
- if (!browser.isReactNative()) {
|
142
|
|
- // Browser only
|
143
|
|
- const localFlipX = JSON.parse(jitsiLocalStorage.getItem('localFlipX') || 'true');
|
144
|
|
- const cameraDeviceId = jitsiLocalStorage.getItem('cameraDeviceId') || '';
|
145
|
|
- const micDeviceId = jitsiLocalStorage.getItem('micDeviceId') || '';
|
146
|
|
-
|
147
|
|
- // Currently audio output device change is supported only in Chrome and
|
148
|
|
- // default output always has 'default' device ID
|
149
|
|
- const audioOutputDeviceId = jitsiLocalStorage.getItem('audioOutputDeviceId') || 'default';
|
150
|
|
-
|
151
|
|
- settings = assignIfDefined({
|
152
|
|
- audioOutputDeviceId,
|
153
|
|
- cameraDeviceId,
|
154
|
|
- localFlipX,
|
155
|
|
- micDeviceId
|
156
|
|
- }, settings);
|
157
|
|
- }
|
158
|
|
-
|
159
|
|
- // Things we stored in profile earlier
|
160
|
|
- const legacyProfile = _getLegacyProfile();
|
161
|
|
-
|
162
|
|
- settings = assignIfDefined(legacyProfile, settings);
|
163
|
|
-
|
164
|
108
|
return settings;
|
165
|
109
|
}
|