ref: move 'jwt' feature to 'base'

This commit is contained in:
paweldomas 2017-10-05 17:54:13 -05:00 committed by Lyubo Marinov
parent 887e1b6828
commit 122be9e0e0
28 changed files with 42 additions and 39 deletions

View File

@ -217,7 +217,7 @@ function muteLocalVideo(muted) {
function maybeRedirectToWelcomePage(options) { function maybeRedirectToWelcomePage(options) {
// if close page is enabled redirect to it, without further action // if close page is enabled redirect to it, without further action
if (config.enableClosePage) { if (config.enableClosePage) {
const { isGuest } = APP.store.getState()['features/jwt']; const { isGuest } = APP.store.getState()['features/base/jwt'];
// save whether current user is guest or not, before navigating // save whether current user is guest or not, before navigating
// to close page // to close page

View File

@ -62,7 +62,7 @@ function checkForAttachParametersAndConnect(id, password, connection) {
*/ */
function connect(id, password, roomName) { function connect(id, password, roomName) {
const connectionConfig = Object.assign({}, config); const connectionConfig = Object.assign({}, config);
const { issuer, jwt } = APP.store.getState()['features/jwt']; const { issuer, jwt } = APP.store.getState()['features/base/jwt'];
connectionConfig.bosh += '?room=' + roomName; connectionConfig.bosh += '?room=' + roomName;
@ -147,7 +147,7 @@ export function openConnection({id, password, retry, roomName}) {
return connect(id, password, roomName).catch(err => { return connect(id, password, roomName).catch(err => {
if (retry) { if (retry) {
const { issuer, jwt } = APP.store.getState()['features/jwt']; const { issuer, jwt } = APP.store.getState()['features/base/jwt'];
if (err === ConnectionErrors.PASSWORD_REQUIRED if (err === ConnectionErrors.PASSWORD_REQUIRED
&& (!jwt || issuer === 'anonymous')) { && (!jwt || issuer === 'anonymous')) {

View File

@ -1,7 +1,7 @@
// @flow // @flow
import * as JitsiMeetConferenceEvents from '../../ConferenceEvents'; import * as JitsiMeetConferenceEvents from '../../ConferenceEvents';
import { parseJWTFromURLParams } from '../../react/features/jwt'; import { parseJWTFromURLParams } from '../../react/features/base/jwt';
import { getJitsiMeetTransport } from '../transport'; import { getJitsiMeetTransport } from '../transport';
import { API_ID } from './constants'; import { API_ID } from './constants';

View File

@ -1,7 +1,7 @@
/* global APP, config, JitsiMeetJS, Promise */ /* global APP, config, JitsiMeetJS, Promise */
import { openConnection } from '../../../connection'; import { openConnection } from '../../../connection';
import { setJWT } from '../../../react/features/jwt'; import { setJWT } from '../../../react/features/base/jwt';
import UIUtil from '../util/UIUtil'; import UIUtil from '../util/UIUtil';
import LoginDialog from './LoginDialog'; import LoginDialog from './LoginDialog';

View File

@ -43,7 +43,7 @@ export function initAnalytics({ getState }: { getState: Function }) {
roomName: state['features/base/conference'].room, roomName: state['features/base/conference'].room,
userAgent: navigator.userAgent userAgent: navigator.userAgent
}; };
const { group, server } = state['features/jwt']; const { group, server } = state['features/base/jwt'];
if (server) { if (server) {
permanentProperties.server = server; permanentProperties.server = server;

View File

@ -26,7 +26,7 @@ export function connect(id: ?string, password: ?string) {
return (dispatch: Dispatch<*>, getState: Function) => { return (dispatch: Dispatch<*>, getState: Function) => {
const state = getState(); const state = getState();
const options = _constructOptions(state); const options = _constructOptions(state);
const { issuer, jwt } = state['features/jwt']; const { issuer, jwt } = state['features/base/jwt'];
const connection const connection
= new JitsiMeetJS.JitsiConnection( = new JitsiMeetJS.JitsiConnection(
options.appId, options.appId,

View File

@ -15,7 +15,8 @@ import { SET_CALL_OVERLAY_VISIBLE, SET_JWT } from './actionTypes';
*/ */
export function setCallOverlayVisible(callOverlayVisible: boolean) { export function setCallOverlayVisible(callOverlayVisible: boolean) {
return (dispatch: Dispatch<*>, getState: Function) => { return (dispatch: Dispatch<*>, getState: Function) => {
getState()['features/jwt'].callOverlayVisible === callOverlayVisible getState()['features/base/jwt']
.callOverlayVisible === callOverlayVisible
|| dispatch({ || dispatch({
type: SET_CALL_OVERLAY_VISIBLE, type: SET_CALL_OVERLAY_VISIBLE,
callOverlayVisible callOverlayVisible

View File

@ -4,10 +4,10 @@ import PropTypes from 'prop-types';
import React, { Component } from 'react'; import React, { Component } from 'react';
import { connect } from 'react-redux'; import { connect } from 'react-redux';
import { Audio } from '../../base/media'; import { Audio } from '../../media';
import { Avatar } from '../../base/participants'; import { Avatar } from '../../participants';
import { Container, Text } from '../../base/react'; import { Container, Text } from '../../react';
import UIEvents from '../../../../service/UI/UIEvents'; import UIEvents from '../../../../../service/UI/UIEvents';
import styles from './styles'; import styles from './styles';
@ -335,7 +335,7 @@ function _mapStateToProps(state) {
* @private * @private
* @type {Object} * @type {Object}
*/ */
_callee: state['features/jwt'].callee _callee: state['features/base/jwt'].callee
}; };
} }

View File

@ -1,4 +1,4 @@
import { ColorPalette, createStyleSheet } from '../../base/styles'; import { ColorPalette, createStyleSheet } from '../../styles';
export default createStyleSheet({ export default createStyleSheet({
// XXX The names bellow were preserved for the purposes of compatibility // XXX The names bellow were preserved for the purposes of compatibility

View File

@ -1,6 +1,6 @@
/* @flow */ /* @flow */
import { parseURLParams } from '../base/config'; import { parseURLParams } from '../config';
/** /**
* Retrieves the JSON Web Token (JWT), if any, defined by a specific * Retrieves the JSON Web Token (JWT), if any, defined by a specific

View File

@ -5,16 +5,16 @@ import {
CONFERENCE_LEFT, CONFERENCE_LEFT,
CONFERENCE_WILL_LEAVE, CONFERENCE_WILL_LEAVE,
SET_ROOM SET_ROOM
} from '../base/conference'; } from '../conference';
import { SET_CONFIG } from '../base/config'; import { SET_CONFIG } from '../config';
import { SET_LOCATION_URL } from '../base/connection'; import { SET_LOCATION_URL } from '../connection';
import { LIB_INIT_ERROR } from '../base/lib-jitsi-meet'; import { LIB_INIT_ERROR } from '../lib-jitsi-meet';
import { import {
getLocalParticipant, getLocalParticipant,
getParticipantCount, getParticipantCount,
PARTICIPANT_JOINED PARTICIPANT_JOINED
} from '../base/participants'; } from '../participants';
import { MiddlewareRegistry } from '../base/redux'; import { MiddlewareRegistry } from '../redux';
import { setCallOverlayVisible, setJWT } from './actions'; import { setCallOverlayVisible, setJWT } from './actions';
import { SET_JWT } from './actionTypes'; import { SET_JWT } from './actionTypes';
@ -72,7 +72,7 @@ function _maybeSetCallOverlayVisible({ dispatch, getState }, next, action) {
const result = next(action); const result = next(action);
const state = getState(); const state = getState();
const stateFeaturesJWT = state['features/jwt']; const stateFeaturesJWT = state['features/base/jwt'];
let callOverlayVisible; let callOverlayVisible;
if (stateFeaturesJWT.callee) { if (stateFeaturesJWT.callee) {

View File

@ -1,4 +1,4 @@
import { equals, set, ReducerRegistry } from '../base/redux'; import { equals, set, ReducerRegistry } from '../redux';
import { SET_CALL_OVERLAY_VISIBLE, SET_JWT } from './actionTypes'; import { SET_CALL_OVERLAY_VISIBLE, SET_JWT } from './actionTypes';
@ -37,7 +37,8 @@ const _INITIAL_STATE = {
* @returns {Object} The next redux state which is the result of reducing the * @returns {Object} The next redux state which is the result of reducing the
* specified {@code action}. * specified {@code action}.
*/ */
ReducerRegistry.register('features/jwt', (state = _INITIAL_STATE, action) => { ReducerRegistry.register(
'features/base/jwt', (state = _INITIAL_STATE, action) => {
switch (action.type) { switch (action.type) {
case SET_CALL_OVERLAY_VISIBLE: case SET_CALL_OVERLAY_VISIBLE:
return set(state, 'callOverlayVisible', action.callOverlayVisible); return set(state, 'callOverlayVisible', action.callOverlayVisible);

View File

@ -190,7 +190,7 @@ class Watermarks extends Component {
* }} * }}
*/ */
function _mapStateToProps(state) { function _mapStateToProps(state) {
const { isGuest } = state['features/jwt']; const { isGuest } = state['features/base/jwt'];
return { return {
/** /**

View File

@ -111,7 +111,7 @@ function _obtainConfigHandler() {
*/ */
function _setTokenData() { function _setTokenData() {
const state = APP.store.getState(); const state = APP.store.getState();
const { caller } = state['features/jwt']; const { caller } = state['features/base/jwt'];
if (caller) { if (caller) {
const { avatarUrl, avatar, email, name } = caller; const { avatarUrl, avatar, email, name } = caller;

View File

@ -1,7 +1,7 @@
/* @flow */ /* @flow */
import { MiddlewareRegistry } from '../base/redux'; import { MiddlewareRegistry } from '../base/redux';
import { SET_CALL_OVERLAY_VISIBLE } from '../jwt'; import { SET_CALL_OVERLAY_VISIBLE } from '../base/jwt';
import Filmstrip from '../../../modules/UI/videolayout/Filmstrip'; import Filmstrip from '../../../modules/UI/videolayout/Filmstrip';
@ -13,10 +13,10 @@ MiddlewareRegistry.register(({ getState }) => next => action => {
case SET_CALL_OVERLAY_VISIBLE: case SET_CALL_OVERLAY_VISIBLE:
if (typeof APP !== 'undefined') { if (typeof APP !== 'undefined') {
const oldValue const oldValue
= Boolean(getState()['features/jwt'].callOverlayVisible); = Boolean(getState()['features/base/jwt'].callOverlayVisible);
const result = next(action); const result = next(action);
const newValue const newValue
= Boolean(getState()['features/jwt'].callOverlayVisible); = Boolean(getState()['features/base/jwt'].callOverlayVisible);
oldValue === newValue oldValue === newValue

View File

@ -349,7 +349,7 @@ function _mapStateToProps(state) {
_conference: conference, _conference: conference,
_inviteServiceUrl: inviteServiceUrl, _inviteServiceUrl: inviteServiceUrl,
_inviteUrl: getInviteURL(state), _inviteUrl: getInviteURL(state),
_jwt: state['features/jwt'].jwt, _jwt: state['features/base/jwt'].jwt,
_peopleSearchQueryTypes: peopleSearchQueryTypes, _peopleSearchQueryTypes: peopleSearchQueryTypes,
_peopleSearchUrl: peopleSearchUrl _peopleSearchUrl: peopleSearchUrl
}; };

View File

@ -192,7 +192,7 @@ class InfoDialog extends Component {
function _mapStateToProps(state) { function _mapStateToProps(state) {
return { return {
_inviteURL: getInviteURL(state), _inviteURL: getInviteURL(state),
_showAddPeople: !state['features/jwt'].isGuest _showAddPeople: !state['features/base/jwt'].isGuest
}; };
} }

View File

@ -219,7 +219,7 @@ class InviteButton extends Component {
function _mapStateToProps(state) { function _mapStateToProps(state) {
const { conference } = state['features/base/conference']; const { conference } = state['features/base/conference'];
const { enableUserRolesBasedOnToken } = state['features/base/config']; const { enableUserRolesBasedOnToken } = state['features/base/config'];
const { isGuest } = state['features/jwt']; const { isGuest } = state['features/base/jwt'];
return { return {
_isAddToCallAvailable: _isAddToCallAvailable:

View File

@ -220,7 +220,7 @@ function _conferenceWillJoin({ getState }, next, action) {
CallKit.startCall(conference.callUUID, url.toString(), hasVideo) CallKit.startCall(conference.callUUID, url.toString(), hasVideo)
.then(() => { .then(() => {
const { room } = state['features/base/conference']; const { room } = state['features/base/conference'];
const { callee } = state['features/jwt']; const { callee } = state['features/base/jwt'];
CallKit.updateCall( CallKit.updateCall(
conference.callUUID, conference.callUUID,

View File

@ -185,7 +185,7 @@ function _mapStateToProps(state) {
const isAnyOverlayVisible = (connectionEstablished && haveToReload) const isAnyOverlayVisible = (connectionEstablished && haveToReload)
|| isMediaPermissionPromptVisible || isMediaPermissionPromptVisible
|| suspendDetected || suspendDetected
|| state['features/jwt'].callOverlayVisible; || state['features/base/jwt'].callOverlayVisible;
const { enabled, notifications } = state['features/notifications']; const { enabled, notifications } = state['features/notifications'];

View File

@ -2,7 +2,7 @@ import PropTypes from 'prop-types';
import React, { Component } from 'react'; import React, { Component } from 'react';
import { connect } from 'react-redux'; import { connect } from 'react-redux';
import { CallOverlay } from '../../jwt'; import { CallOverlay } from '../../base/jwt';
import PageReloadFilmstripOnlyOverlay from './PageReloadFilmstripOnlyOverlay'; import PageReloadFilmstripOnlyOverlay from './PageReloadFilmstripOnlyOverlay';
import PageReloadOverlay from './PageReloadOverlay'; import PageReloadOverlay from './PageReloadOverlay';
@ -214,7 +214,8 @@ function _mapStateToProps(state) {
* @private * @private
* @type {boolean} * @type {boolean}
*/ */
_callOverlayVisible: Boolean(state['features/jwt'].callOverlayVisible), _callOverlayVisible:
Boolean(state['features/base/jwt'].callOverlayVisible),
/** /**
* The indicator which determines whether the status of the * The indicator which determines whether the status of the

View File

@ -187,7 +187,7 @@ export function hideToolbox(force: boolean = false): Function {
if (!force if (!force
&& (hovered && (hovered
|| state['features/jwt'].callOverlayVisible || state['features/base/jwt'].callOverlayVisible
|| SideContainerToggler.isVisible())) { || SideContainerToggler.isVisible())) {
dispatch( dispatch(
setToolboxTimeout( setToolboxTimeout(

View File

@ -120,7 +120,7 @@ class ProfileButton extends Component {
*/ */
function _mapStateToProps(state) { function _mapStateToProps(state) {
return { return {
_unclickable: !state['features/jwt'].isGuest _unclickable: !state['features/base/jwt'].isGuest
}; };
} }

View File

@ -147,7 +147,7 @@ function _mapDispatchToProps(dispatch: Function): Object {
* @private * @private
*/ */
function _mapStateToProps(state: Object): Object { function _mapStateToProps(state: Object): Object {
const { isGuest } = state['features/jwt']; const { isGuest } = state['features/base/jwt'];
const { secondaryToolbarButtons, visible } = state['features/toolbox']; const { secondaryToolbarButtons, visible } = state['features/toolbox'];
const { callStatsID } = state['features/base/config']; const { callStatsID } = state['features/base/config'];