Jitsi Meet - Secure, Simple and Scalable Video Conferences that you use as a standalone app or embed in your web application.
TypeScript debiandeep-videojitsijitsi-meetscalable-video-conferencessfuvideovideo-communicationvideo-conferencingwebrtc
ref: move getCurrentConferenceUrl to base/connection
paweldomas7684b2bf98a9
diff --git a/react/features/base/connection/functions.js b/react/features/base/connection/functions.jsindex 900b07b335..e6a93bbf4a 100644--- a/react/features/base/connection/functions.js+++ b/react/features/base/connection/functions.js@@ -1,6 +1,31 @@/* @flow */import { toState } from '../redux';+import { toURLString } from '../util';++/**+ * Figures out what's the current conference URL which is supposed to indicate what conference is currently active.+ * When not currently in any conference and not trying to join any then 'undefined' is returned.+ *+ * @param {Object|Function} stateful - Either the whole Redux state object or the Redux store's {@code getState} method.+ * @returns {string|undefined}+ * @private+ */+export function getCurrentConferenceUrl(stateful: Function | Object) {+ const state = toState(stateful);+ let currentUrl;++ if (isInviteURLReady(state)) {+ currentUrl = toURLString(getInviteURL(state));+ }++ // Check if the URL doesn't end with a slash+ if (currentUrl && currentUrl.substr(-1) === '/') {+ currentUrl = undefined;+ }++ return currentUrl ? currentUrl : undefined;+}/*** Retrieves a simplified version of the conference/location URL stripped of URL params (i.e. Query/search and hash)diff --git a/react/features/mobile/watchos/middleware.js b/react/features/mobile/watchos/middleware.jsindex adecb8ba9a..ea9b9802c8 100644--- a/react/features/mobile/watchos/middleware.js+++ b/react/features/mobile/watchos/middleware.js@@ -7,14 +7,13 @@ import { appNavigate } from '../../app';import { APP_WILL_MOUNT } from '../../base/app';import { CONFERENCE_JOINED } from '../../base/conference';-import { getInviteURL, isInviteURLReady } from '../../base/connection';+import { getCurrentConferenceUrl } from '../../base/connection';import { setAudioMuted } from '../../base/media';import {MiddlewareRegistry,StateListenerRegistry,toState} from '../../base/redux';-import { toURLString } from '../../base/util';import { setConferenceTimestamp, setSessionId, setWatchReachable } from './actions';import { CMD_HANG_UP, CMD_JOIN_CONFERENCE, CMD_SET_MUTED, MAX_RECENT_URLS } from './constants';@@ -39,7 +38,7 @@ watchOSEnabled && StateListenerRegistry.register(// Handles the conference URL state sent to the watchwatchOSEnabled && StateListenerRegistry.register(- /* selector */ state => _getCurrentConferenceUrl(state),+ /* selector */ state => getCurrentConferenceUrl(state),/* listener */ (currentUrl, { dispatch, getState }) => {dispatch(setSessionId());_updateApplicationContext(getState);@@ -101,13 +100,13 @@ function _appWillMount({ dispatch, getState }) {switch (command) {case CMD_HANG_UP:- if (typeof _getCurrentConferenceUrl(getState()) !== undefined) {+ if (typeof getCurrentConferenceUrl(getState()) !== undefined) {dispatch(appNavigate(undefined));}break;case CMD_JOIN_CONFERENCE: {const newConferenceURL = message.data;- const oldConferenceURL = _getCurrentConferenceUrl(getState());+ const oldConferenceURL = getCurrentConferenceUrl(getState());if (oldConferenceURL !== newConferenceURL) {dispatch(appNavigate(newConferenceURL));@@ -124,30 +123,6 @@ function _appWillMount({ dispatch, getState }) {});}-/**- * Figures out what's the current conference URL which is supposed to indicate what conference is currently active.- * When not currently in any conference and not trying to join any then the 'NULL' string value is returned.- *- * @param {Object|Function} stateful - Either the whole Redux state object or the Redux store's {@code getState} method.- * @returns {string}- * @private- */-function _getCurrentConferenceUrl(stateful) {- const state = toState(stateful);- let currentUrl;-- if (isInviteURLReady(state)) {- currentUrl = toURLString(getInviteURL(state));- }-- // Check if the URL doesn't end with a slash- if (currentUrl && currentUrl.substr(-1) === '/') {- currentUrl = undefined;- }-- return currentUrl ? currentUrl : undefined;-}-/*** Gets the current Apple Watch session's ID. A new session is started whenever the conference URL has changed. It is* used to filter out outdated commands which may arrive very later if the Apple Watch loses the connectivity.@@ -214,7 +189,7 @@ function _updateApplicationContext(stateful) {try {watch.updateApplicationContext({conferenceTimestamp,- conferenceURL: _getCurrentConferenceUrl(state),+ conferenceURL: getCurrentConferenceUrl(state),micMuted: _isAudioMuted(state),recentURLs: _getRecentUrls(state),sessionID