From c3e42e0162726b0a9e1cb71621769d560d5109a3 Mon Sep 17 00:00:00 2001 From: damencho Date: Fri, 13 Oct 2017 15:34:27 -0500 Subject: [PATCH] Adds application name to the initJitsiConference options. --- conference.js | 2 ++ react/features/app/functions.native.js | 21 ++++++--------------- react/features/app/functions.web.js | 11 ++++++++++- react/features/app/getRouteToRender.js | 22 ++++++++++++++++++++++ react/features/base/conference/actions.js | 7 +++++-- 5 files changed, 45 insertions(+), 18 deletions(-) create mode 100644 react/features/app/getRouteToRender.js diff --git a/conference.js b/conference.js index 8e010d545..04cc4807f 100644 --- a/conference.js +++ b/conference.js @@ -1297,6 +1297,8 @@ export default { options.displayName = nick; } + options.applicationName = interfaceConfig.APP_NAME; + return options; }, diff --git a/react/features/app/functions.native.js b/react/features/app/functions.native.js index 155931350..a4fd215bf 100644 --- a/react/features/app/functions.native.js +++ b/react/features/app/functions.native.js @@ -1,22 +1,13 @@ /* @flow */ +import { NativeModules } from 'react-native'; -import { isRoomValid } from '../base/conference'; -import { RouteRegistry } from '../base/react'; -import { toState } from '../base/redux'; -import { Conference } from '../conference'; -import { WelcomePage } from '../welcome'; +export * from './getRouteToRender'; /** - * Determines which route is to be rendered in order to depict a specific Redux - * store. + * Returns application name. * - * @param {(Object|Function)} stateOrGetState - Redux state or Regux getState() - * method. - * @returns {Route} + * @returns {string} The application name. */ -export function _getRouteToRender(stateOrGetState: Object | Function) { - const { room } = toState(stateOrGetState)['features/base/conference']; - const component = isRoomValid(room) ? Conference : WelcomePage; - - return RouteRegistry.getRouteByComponent(component); +export function getName() { + return NativeModules.AppInfo.name; } diff --git a/react/features/app/functions.web.js b/react/features/app/functions.web.js index 463e83ae5..0782116e2 100644 --- a/react/features/app/functions.web.js +++ b/react/features/app/functions.web.js @@ -12,7 +12,7 @@ import { import { // eslint-disable-next-line camelcase _getRouteToRender as _super_getRouteToRender -} from './functions.native'; +} from './getRouteToRender'; declare var APP: Object; declare var interfaceConfig: Object; @@ -116,3 +116,12 @@ function _interceptComponent( return result || component; } + +/** + * Returns application name. + * + * @returns {string} The application name. + */ +export function getName() { + return interfaceConfig.APP_NAME; +} diff --git a/react/features/app/getRouteToRender.js b/react/features/app/getRouteToRender.js new file mode 100644 index 000000000..155931350 --- /dev/null +++ b/react/features/app/getRouteToRender.js @@ -0,0 +1,22 @@ +/* @flow */ + +import { isRoomValid } from '../base/conference'; +import { RouteRegistry } from '../base/react'; +import { toState } from '../base/redux'; +import { Conference } from '../conference'; +import { WelcomePage } from '../welcome'; + +/** + * Determines which route is to be rendered in order to depict a specific Redux + * store. + * + * @param {(Object|Function)} stateOrGetState - Redux state or Regux getState() + * method. + * @returns {Route} + */ +export function _getRouteToRender(stateOrGetState: Object | Function) { + const { room } = toState(stateOrGetState)['features/base/conference']; + const component = isRoomValid(room) ? Conference : WelcomePage; + + return RouteRegistry.getRouteByComponent(component); +} diff --git a/react/features/base/conference/actions.js b/react/features/base/conference/actions.js index f1ea715ac..fa49faae9 100644 --- a/react/features/base/conference/actions.js +++ b/react/features/base/conference/actions.js @@ -1,6 +1,7 @@ // @flow import { sendEvent } from '../../analytics'; +import { getName } from '../../app'; import { JitsiConferenceEvents } from '../lib-jitsi-meet'; import { setAudioMuted, setVideoMuted } from '../media'; import { @@ -280,8 +281,10 @@ export function createConference() { = connection.initJitsiConference( // XXX Lib-jitsi-meet does not accept uppercase letters. - room.toLowerCase(), - state['features/base/config']); + room.toLowerCase(), { + ...state['features/base/config'], + applicationName: getName() + }); conference[JITSI_CONFERENCE_URL_KEY] = locationURL; dispatch(_conferenceWillJoin(conference));