Make web use the redux settings/profile

This commit is contained in:
zbettenbuk
2018-05-09 15:20:22 +02:00
committed by Saúl Ibarra Corretgé
parent ab7e572162
commit 959db3a665
29 changed files with 455 additions and 434 deletions
+12 -22
View File
@@ -12,7 +12,6 @@ import {
localParticipantJoined,
localParticipantLeft
} from '../../base/participants';
import '../../base/profile';
import { Fragment, RouteRegistry } from '../../base/react';
import { MiddlewareRegistry, ReducerRegistry } from '../../base/redux';
import { SoundCollection } from '../../base/sounds';
@@ -26,6 +25,9 @@ import { appNavigate, appWillMount, appWillUnmount } from '../actions';
/**
* The default URL to open if no other was specified to {@code AbstractApp}
* via props.
*
* FIXME: This is not at the best place here. This should be either in the
* base/settings feature or a default in base/config.
*/
const DEFAULT_URL = 'https://meet.jit.si';
@@ -133,26 +135,14 @@ export class AbstractApp extends Component {
// actions is important, not the call site. Moreover, we've got
// localParticipant business logic in the React Component
// (i.e. UI) AbstractApp now.
let localParticipant = {};
if (typeof APP === 'object') {
localParticipant = {
avatarID: APP.settings.getAvatarId(),
avatarURL: APP.settings.getAvatarUrl(),
email: APP.settings.getEmail(),
name: APP.settings.getDisplayName()
};
}
// Profile is the new React compatible settings.
const profile = getState()['features/base/profile'];
if (profile) {
localParticipant.email
= profile.email || localParticipant.email;
localParticipant.name
= profile.displayName || localParticipant.name;
}
const settings = getState()['features/base/settings'];
const localParticipant = {
avatarID: settings.avatarID,
avatarURL: settings.avatarURL,
email: settings.email,
name: settings.displayName
};
// We set the initialized state here and not in the contructor to
// make sure that {@code componentWillMount} gets invoked before
@@ -383,8 +373,8 @@ export class AbstractApp extends Component {
return (
this.props.defaultURL
|| this._getStore().getState()['features/base/profile']
.serverURL
|| this._getStore().getState()['features/base/settings']
.serverURL
|| DEFAULT_URL);
}