From 122be9e0e07989b5aeabdb9eca95470be314c084 Mon Sep 17 00:00:00 2001 From: paweldomas Date: Thu, 5 Oct 2017 17:54:13 -0500 Subject: [PATCH] ref: move 'jwt' feature to 'base' --- conference.js | 2 +- connection.js | 4 ++-- modules/API/API.js | 2 +- modules/UI/authentication/AuthHandler.js | 2 +- react/features/analytics/functions.js | 2 +- react/features/base/connection/actions.native.js | 2 +- react/features/{ => base}/jwt/actionTypes.js | 0 react/features/{ => base}/jwt/actions.js | 3 ++- .../{ => base}/jwt/components/CallOverlay.js | 10 +++++----- react/features/{ => base}/jwt/components/index.js | 0 .../{ => base}/jwt/components/styles.native.js | 2 +- .../{ => base}/jwt/components/styles.web.js | 0 react/features/{ => base}/jwt/functions.js | 2 +- react/features/{ => base}/jwt/index.js | 0 react/features/{ => base}/jwt/middleware.js | 14 +++++++------- react/features/{ => base}/jwt/reducer.js | 5 +++-- .../base/react/components/web/Watermarks.js | 2 +- react/features/conference/route.js | 2 +- react/features/filmstrip/middleware.js | 6 +++--- .../invite/components/AddPeopleDialog.web.js | 2 +- react/features/invite/components/InfoDialog.web.js | 2 +- .../features/invite/components/InviteButton.web.js | 2 +- react/features/mobile/callkit/middleware.js | 2 +- .../components/NotificationsContainer.web.js | 2 +- .../overlay/components/OverlayContainer.js | 5 +++-- react/features/toolbox/actions.web.js | 2 +- .../toolbox/components/ProfileButton.web.js | 2 +- .../toolbox/components/SecondaryToolbar.web.js | 2 +- 28 files changed, 42 insertions(+), 39 deletions(-) rename react/features/{ => base}/jwt/actionTypes.js (100%) rename react/features/{ => base}/jwt/actions.js (91%) rename react/features/{ => base}/jwt/components/CallOverlay.js (97%) rename react/features/{ => base}/jwt/components/index.js (100%) rename react/features/{ => base}/jwt/components/styles.native.js (94%) rename react/features/{ => base}/jwt/components/styles.web.js (100%) rename react/features/{ => base}/jwt/functions.js (90%) rename react/features/{ => base}/jwt/index.js (100%) rename react/features/{ => base}/jwt/middleware.js (95%) rename react/features/{ => base}/jwt/reducer.js (90%) diff --git a/conference.js b/conference.js index 6cd0442e2..9f53cb2aa 100644 --- a/conference.js +++ b/conference.js @@ -217,7 +217,7 @@ function muteLocalVideo(muted) { function maybeRedirectToWelcomePage(options) { // if close page is enabled redirect to it, without further action 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 // to close page diff --git a/connection.js b/connection.js index c6213b8f2..d54a425ee 100644 --- a/connection.js +++ b/connection.js @@ -62,7 +62,7 @@ function checkForAttachParametersAndConnect(id, password, connection) { */ function connect(id, password, roomName) { 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; @@ -147,7 +147,7 @@ export function openConnection({id, password, retry, roomName}) { return connect(id, password, roomName).catch(err => { if (retry) { - const { issuer, jwt } = APP.store.getState()['features/jwt']; + const { issuer, jwt } = APP.store.getState()['features/base/jwt']; if (err === ConnectionErrors.PASSWORD_REQUIRED && (!jwt || issuer === 'anonymous')) { diff --git a/modules/API/API.js b/modules/API/API.js index 7c105132e..7962a5bf5 100644 --- a/modules/API/API.js +++ b/modules/API/API.js @@ -1,7 +1,7 @@ // @flow import * as JitsiMeetConferenceEvents from '../../ConferenceEvents'; -import { parseJWTFromURLParams } from '../../react/features/jwt'; +import { parseJWTFromURLParams } from '../../react/features/base/jwt'; import { getJitsiMeetTransport } from '../transport'; import { API_ID } from './constants'; diff --git a/modules/UI/authentication/AuthHandler.js b/modules/UI/authentication/AuthHandler.js index 6c029858a..75e34c0e2 100644 --- a/modules/UI/authentication/AuthHandler.js +++ b/modules/UI/authentication/AuthHandler.js @@ -1,7 +1,7 @@ /* global APP, config, JitsiMeetJS, Promise */ import { openConnection } from '../../../connection'; -import { setJWT } from '../../../react/features/jwt'; +import { setJWT } from '../../../react/features/base/jwt'; import UIUtil from '../util/UIUtil'; import LoginDialog from './LoginDialog'; diff --git a/react/features/analytics/functions.js b/react/features/analytics/functions.js index 24a831ab0..ce7ab8970 100644 --- a/react/features/analytics/functions.js +++ b/react/features/analytics/functions.js @@ -43,7 +43,7 @@ export function initAnalytics({ getState }: { getState: Function }) { roomName: state['features/base/conference'].room, userAgent: navigator.userAgent }; - const { group, server } = state['features/jwt']; + const { group, server } = state['features/base/jwt']; if (server) { permanentProperties.server = server; diff --git a/react/features/base/connection/actions.native.js b/react/features/base/connection/actions.native.js index 28b2ba705..12b2d2867 100644 --- a/react/features/base/connection/actions.native.js +++ b/react/features/base/connection/actions.native.js @@ -26,7 +26,7 @@ export function connect(id: ?string, password: ?string) { return (dispatch: Dispatch<*>, getState: Function) => { const state = getState(); const options = _constructOptions(state); - const { issuer, jwt } = state['features/jwt']; + const { issuer, jwt } = state['features/base/jwt']; const connection = new JitsiMeetJS.JitsiConnection( options.appId, diff --git a/react/features/jwt/actionTypes.js b/react/features/base/jwt/actionTypes.js similarity index 100% rename from react/features/jwt/actionTypes.js rename to react/features/base/jwt/actionTypes.js diff --git a/react/features/jwt/actions.js b/react/features/base/jwt/actions.js similarity index 91% rename from react/features/jwt/actions.js rename to react/features/base/jwt/actions.js index 53d374833..de2ba7707 100644 --- a/react/features/jwt/actions.js +++ b/react/features/base/jwt/actions.js @@ -15,7 +15,8 @@ import { SET_CALL_OVERLAY_VISIBLE, SET_JWT } from './actionTypes'; */ export function setCallOverlayVisible(callOverlayVisible: boolean) { return (dispatch: Dispatch<*>, getState: Function) => { - getState()['features/jwt'].callOverlayVisible === callOverlayVisible + getState()['features/base/jwt'] + .callOverlayVisible === callOverlayVisible || dispatch({ type: SET_CALL_OVERLAY_VISIBLE, callOverlayVisible diff --git a/react/features/jwt/components/CallOverlay.js b/react/features/base/jwt/components/CallOverlay.js similarity index 97% rename from react/features/jwt/components/CallOverlay.js rename to react/features/base/jwt/components/CallOverlay.js index 0aad00456..7aeb3f057 100644 --- a/react/features/jwt/components/CallOverlay.js +++ b/react/features/base/jwt/components/CallOverlay.js @@ -4,10 +4,10 @@ import PropTypes from 'prop-types'; import React, { Component } from 'react'; import { connect } from 'react-redux'; -import { Audio } from '../../base/media'; -import { Avatar } from '../../base/participants'; -import { Container, Text } from '../../base/react'; -import UIEvents from '../../../../service/UI/UIEvents'; +import { Audio } from '../../media'; +import { Avatar } from '../../participants'; +import { Container, Text } from '../../react'; +import UIEvents from '../../../../../service/UI/UIEvents'; import styles from './styles'; @@ -335,7 +335,7 @@ function _mapStateToProps(state) { * @private * @type {Object} */ - _callee: state['features/jwt'].callee + _callee: state['features/base/jwt'].callee }; } diff --git a/react/features/jwt/components/index.js b/react/features/base/jwt/components/index.js similarity index 100% rename from react/features/jwt/components/index.js rename to react/features/base/jwt/components/index.js diff --git a/react/features/jwt/components/styles.native.js b/react/features/base/jwt/components/styles.native.js similarity index 94% rename from react/features/jwt/components/styles.native.js rename to react/features/base/jwt/components/styles.native.js index 8fa3b0cfd..db6f45470 100644 --- a/react/features/jwt/components/styles.native.js +++ b/react/features/base/jwt/components/styles.native.js @@ -1,4 +1,4 @@ -import { ColorPalette, createStyleSheet } from '../../base/styles'; +import { ColorPalette, createStyleSheet } from '../../styles'; export default createStyleSheet({ // XXX The names bellow were preserved for the purposes of compatibility diff --git a/react/features/jwt/components/styles.web.js b/react/features/base/jwt/components/styles.web.js similarity index 100% rename from react/features/jwt/components/styles.web.js rename to react/features/base/jwt/components/styles.web.js diff --git a/react/features/jwt/functions.js b/react/features/base/jwt/functions.js similarity index 90% rename from react/features/jwt/functions.js rename to react/features/base/jwt/functions.js index 8a88a41ce..22aa59f34 100644 --- a/react/features/jwt/functions.js +++ b/react/features/base/jwt/functions.js @@ -1,6 +1,6 @@ /* @flow */ -import { parseURLParams } from '../base/config'; +import { parseURLParams } from '../config'; /** * Retrieves the JSON Web Token (JWT), if any, defined by a specific diff --git a/react/features/jwt/index.js b/react/features/base/jwt/index.js similarity index 100% rename from react/features/jwt/index.js rename to react/features/base/jwt/index.js diff --git a/react/features/jwt/middleware.js b/react/features/base/jwt/middleware.js similarity index 95% rename from react/features/jwt/middleware.js rename to react/features/base/jwt/middleware.js index 0bcc37d6d..c4b7caccb 100644 --- a/react/features/jwt/middleware.js +++ b/react/features/base/jwt/middleware.js @@ -5,16 +5,16 @@ import { CONFERENCE_LEFT, CONFERENCE_WILL_LEAVE, SET_ROOM -} from '../base/conference'; -import { SET_CONFIG } from '../base/config'; -import { SET_LOCATION_URL } from '../base/connection'; -import { LIB_INIT_ERROR } from '../base/lib-jitsi-meet'; +} from '../conference'; +import { SET_CONFIG } from '../config'; +import { SET_LOCATION_URL } from '../connection'; +import { LIB_INIT_ERROR } from '../lib-jitsi-meet'; import { getLocalParticipant, getParticipantCount, PARTICIPANT_JOINED -} from '../base/participants'; -import { MiddlewareRegistry } from '../base/redux'; +} from '../participants'; +import { MiddlewareRegistry } from '../redux'; import { setCallOverlayVisible, setJWT } from './actions'; import { SET_JWT } from './actionTypes'; @@ -72,7 +72,7 @@ function _maybeSetCallOverlayVisible({ dispatch, getState }, next, action) { const result = next(action); const state = getState(); - const stateFeaturesJWT = state['features/jwt']; + const stateFeaturesJWT = state['features/base/jwt']; let callOverlayVisible; if (stateFeaturesJWT.callee) { diff --git a/react/features/jwt/reducer.js b/react/features/base/jwt/reducer.js similarity index 90% rename from react/features/jwt/reducer.js rename to react/features/base/jwt/reducer.js index 38c679998..d6b759dea 100644 --- a/react/features/jwt/reducer.js +++ b/react/features/base/jwt/reducer.js @@ -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'; @@ -37,7 +37,8 @@ const _INITIAL_STATE = { * @returns {Object} The next redux state which is the result of reducing the * specified {@code action}. */ -ReducerRegistry.register('features/jwt', (state = _INITIAL_STATE, action) => { +ReducerRegistry.register( +'features/base/jwt', (state = _INITIAL_STATE, action) => { switch (action.type) { case SET_CALL_OVERLAY_VISIBLE: return set(state, 'callOverlayVisible', action.callOverlayVisible); diff --git a/react/features/base/react/components/web/Watermarks.js b/react/features/base/react/components/web/Watermarks.js index e38e293d9..5f7f3daf1 100644 --- a/react/features/base/react/components/web/Watermarks.js +++ b/react/features/base/react/components/web/Watermarks.js @@ -190,7 +190,7 @@ class Watermarks extends Component { * }} */ function _mapStateToProps(state) { - const { isGuest } = state['features/jwt']; + const { isGuest } = state['features/base/jwt']; return { /** diff --git a/react/features/conference/route.js b/react/features/conference/route.js index bd5eb125c..883f59eac 100644 --- a/react/features/conference/route.js +++ b/react/features/conference/route.js @@ -111,7 +111,7 @@ function _obtainConfigHandler() { */ function _setTokenData() { const state = APP.store.getState(); - const { caller } = state['features/jwt']; + const { caller } = state['features/base/jwt']; if (caller) { const { avatarUrl, avatar, email, name } = caller; diff --git a/react/features/filmstrip/middleware.js b/react/features/filmstrip/middleware.js index 637b8d941..e26295b48 100644 --- a/react/features/filmstrip/middleware.js +++ b/react/features/filmstrip/middleware.js @@ -1,7 +1,7 @@ /* @flow */ 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'; @@ -13,10 +13,10 @@ MiddlewareRegistry.register(({ getState }) => next => action => { case SET_CALL_OVERLAY_VISIBLE: if (typeof APP !== 'undefined') { const oldValue - = Boolean(getState()['features/jwt'].callOverlayVisible); + = Boolean(getState()['features/base/jwt'].callOverlayVisible); const result = next(action); const newValue - = Boolean(getState()['features/jwt'].callOverlayVisible); + = Boolean(getState()['features/base/jwt'].callOverlayVisible); oldValue === newValue diff --git a/react/features/invite/components/AddPeopleDialog.web.js b/react/features/invite/components/AddPeopleDialog.web.js index 554be117a..f52a79871 100644 --- a/react/features/invite/components/AddPeopleDialog.web.js +++ b/react/features/invite/components/AddPeopleDialog.web.js @@ -349,7 +349,7 @@ function _mapStateToProps(state) { _conference: conference, _inviteServiceUrl: inviteServiceUrl, _inviteUrl: getInviteURL(state), - _jwt: state['features/jwt'].jwt, + _jwt: state['features/base/jwt'].jwt, _peopleSearchQueryTypes: peopleSearchQueryTypes, _peopleSearchUrl: peopleSearchUrl }; diff --git a/react/features/invite/components/InfoDialog.web.js b/react/features/invite/components/InfoDialog.web.js index 5b81fe51c..4d669cb5e 100644 --- a/react/features/invite/components/InfoDialog.web.js +++ b/react/features/invite/components/InfoDialog.web.js @@ -192,7 +192,7 @@ class InfoDialog extends Component { function _mapStateToProps(state) { return { _inviteURL: getInviteURL(state), - _showAddPeople: !state['features/jwt'].isGuest + _showAddPeople: !state['features/base/jwt'].isGuest }; } diff --git a/react/features/invite/components/InviteButton.web.js b/react/features/invite/components/InviteButton.web.js index 223ae96ac..4940e1859 100644 --- a/react/features/invite/components/InviteButton.web.js +++ b/react/features/invite/components/InviteButton.web.js @@ -219,7 +219,7 @@ class InviteButton extends Component { function _mapStateToProps(state) { const { conference } = state['features/base/conference']; const { enableUserRolesBasedOnToken } = state['features/base/config']; - const { isGuest } = state['features/jwt']; + const { isGuest } = state['features/base/jwt']; return { _isAddToCallAvailable: diff --git a/react/features/mobile/callkit/middleware.js b/react/features/mobile/callkit/middleware.js index 734539e03..778cbd62f 100644 --- a/react/features/mobile/callkit/middleware.js +++ b/react/features/mobile/callkit/middleware.js @@ -220,7 +220,7 @@ function _conferenceWillJoin({ getState }, next, action) { CallKit.startCall(conference.callUUID, url.toString(), hasVideo) .then(() => { const { room } = state['features/base/conference']; - const { callee } = state['features/jwt']; + const { callee } = state['features/base/jwt']; CallKit.updateCall( conference.callUUID, diff --git a/react/features/notifications/components/NotificationsContainer.web.js b/react/features/notifications/components/NotificationsContainer.web.js index 2d186c53b..f7f8a3a93 100644 --- a/react/features/notifications/components/NotificationsContainer.web.js +++ b/react/features/notifications/components/NotificationsContainer.web.js @@ -185,7 +185,7 @@ function _mapStateToProps(state) { const isAnyOverlayVisible = (connectionEstablished && haveToReload) || isMediaPermissionPromptVisible || suspendDetected - || state['features/jwt'].callOverlayVisible; + || state['features/base/jwt'].callOverlayVisible; const { enabled, notifications } = state['features/notifications']; diff --git a/react/features/overlay/components/OverlayContainer.js b/react/features/overlay/components/OverlayContainer.js index aec08391e..a93831d22 100644 --- a/react/features/overlay/components/OverlayContainer.js +++ b/react/features/overlay/components/OverlayContainer.js @@ -2,7 +2,7 @@ import PropTypes from 'prop-types'; import React, { Component } from 'react'; import { connect } from 'react-redux'; -import { CallOverlay } from '../../jwt'; +import { CallOverlay } from '../../base/jwt'; import PageReloadFilmstripOnlyOverlay from './PageReloadFilmstripOnlyOverlay'; import PageReloadOverlay from './PageReloadOverlay'; @@ -214,7 +214,8 @@ function _mapStateToProps(state) { * @private * @type {boolean} */ - _callOverlayVisible: Boolean(state['features/jwt'].callOverlayVisible), + _callOverlayVisible: + Boolean(state['features/base/jwt'].callOverlayVisible), /** * The indicator which determines whether the status of the diff --git a/react/features/toolbox/actions.web.js b/react/features/toolbox/actions.web.js index 1a83c2839..064d5a96d 100644 --- a/react/features/toolbox/actions.web.js +++ b/react/features/toolbox/actions.web.js @@ -187,7 +187,7 @@ export function hideToolbox(force: boolean = false): Function { if (!force && (hovered - || state['features/jwt'].callOverlayVisible + || state['features/base/jwt'].callOverlayVisible || SideContainerToggler.isVisible())) { dispatch( setToolboxTimeout( diff --git a/react/features/toolbox/components/ProfileButton.web.js b/react/features/toolbox/components/ProfileButton.web.js index 2c2e50ac8..9bf38a302 100644 --- a/react/features/toolbox/components/ProfileButton.web.js +++ b/react/features/toolbox/components/ProfileButton.web.js @@ -120,7 +120,7 @@ class ProfileButton extends Component { */ function _mapStateToProps(state) { return { - _unclickable: !state['features/jwt'].isGuest + _unclickable: !state['features/base/jwt'].isGuest }; } diff --git a/react/features/toolbox/components/SecondaryToolbar.web.js b/react/features/toolbox/components/SecondaryToolbar.web.js index fe1100242..d65b7a19e 100644 --- a/react/features/toolbox/components/SecondaryToolbar.web.js +++ b/react/features/toolbox/components/SecondaryToolbar.web.js @@ -147,7 +147,7 @@ function _mapDispatchToProps(dispatch: Function): Object { * @private */ function _mapStateToProps(state: Object): Object { - const { isGuest } = state['features/jwt']; + const { isGuest } = state['features/base/jwt']; const { secondaryToolbarButtons, visible } = state['features/toolbox']; const { callStatsID } = state['features/base/config'];