diff --git a/react/features/app/actions.any.ts b/react/features/app/actions.any.ts index 7b2c0b18a9..000a74d61f 100644 --- a/react/features/app/actions.any.ts +++ b/react/features/app/actions.any.ts @@ -104,6 +104,8 @@ export function maybeRedirectToTokenAuthUrl( dispatch: IStore['dispatch'], getState: IStore['getState'], failureCallback: Function) { const state = getState(); const config = state['features/base/config']; + const { enabled: audioOnlyEnabled } = state['features/base/audio-only']; + const { startAudioOnly } = config; const { locationURL = { href: '' } as URL } = state['features/base/connection']; if (!isTokenAuthEnabled(config)) { @@ -120,7 +122,7 @@ export function maybeRedirectToTokenAuthUrl( const room = state['features/base/conference'].room; const { tenant } = parseURIString(locationURL.href) || {}; - getTokenAuthUrl(config, room, tenant, true, locationURL) + getTokenAuthUrl(audioOnlyEnabled || startAudioOnly, config, room, tenant, true, locationURL) .then((tokenAuthServiceUrl: string | undefined) => { if (!tokenAuthServiceUrl) { logger.warn('Cannot handle login, token service URL is not set'); diff --git a/react/features/app/getRouteToRender.web.ts b/react/features/app/getRouteToRender.web.ts index fc4ad60bd7..2d330d552e 100644 --- a/react/features/app/getRouteToRender.web.ts +++ b/react/features/app/getRouteToRender.web.ts @@ -55,8 +55,9 @@ function _getWebConferenceRoute(state: IReduxState) { && !state['features/base/jwt'].jwt && room) { const { locationURL = { href: '' } as URL } = state['features/base/connection']; const { tenant } = parseURIString(locationURL.href) || {}; + const { startAudioOnly } = config; - return getTokenAuthUrl(config, room, tenant, false, locationURL) + return getTokenAuthUrl(startAudioOnly, config, room, tenant, false, locationURL) .then((url: string | undefined) => { route.href = url; diff --git a/react/features/authentication/functions.any.ts b/react/features/authentication/functions.any.ts index 22a59f21fb..5641474229 100644 --- a/react/features/authentication/functions.any.ts +++ b/react/features/authentication/functions.any.ts @@ -13,6 +13,7 @@ export const isTokenAuthEnabled = (config: IConfig): boolean => /** * Returns the state that we can add as a parameter to the tokenAuthUrl. * + * @param {boolean} audioOnlyEnabled - Join conference audio only. * @param {string?} roomName - The room name. * @param {string?} tenant - The tenant name if any. * @param {boolean} skipPrejoin - Whether to skip pre-join page. @@ -20,9 +21,11 @@ export const isTokenAuthEnabled = (config: IConfig): boolean => * @returns {Object} The state object. */ export const _getTokenAuthState = ( + audioOnlyEnabled: boolean | undefined = false, roomName: string | undefined, tenant: string | undefined, skipPrejoin: boolean | undefined = false, + // eslint-disable-next-line max-params locationURL: URL): object => { const state = { room: roomName, @@ -36,6 +39,12 @@ export const _getTokenAuthState = ( state['config.prejoinConfig.enabled'] = false; } + if (audioOnlyEnabled) { + + // @ts-ignore + state['config.startAudioOnly'] = true; + } + const params = new URLSearchParams(locationURL.hash); for (const [ key, value ] of params) { diff --git a/react/features/authentication/functions.native.ts b/react/features/authentication/functions.native.ts index 4feac2ea22..dfa1544914 100644 --- a/react/features/authentication/functions.native.ts +++ b/react/features/authentication/functions.native.ts @@ -13,10 +13,11 @@ export * from './functions.any'; * '{room}' - name of the conference room passed as roomName * argument to this method. * + * @param {boolean} audioOnlyEnabled - Join conference audio only. * @param {Object} config - Configuration state object from store. A URL pattern pointing to the login service. * @param {string} roomName - The name of the conference room for which the user will be authenticated. * @param {string} tenant - The name of the conference tenant. - * @param {string} skipPrejoin - The name of the conference room for which the user will be authenticated. + * @param {boolean} skipPrejoin - Whether to skip pre-join page. * @param {URL} locationURL - The location URL. * * @returns {Promise} - The URL pointing to JWT login service or @@ -24,6 +25,7 @@ export * from './functions.any'; * constructed. */ export const getTokenAuthUrl = ( + audioOnlyEnabled: boolean | undefined = false, config: IConfig, roomName: string | undefined, tenant: string | undefined, @@ -38,7 +40,7 @@ export const getTokenAuthUrl = ( } if (url.indexOf('{state}')) { - const state = _getTokenAuthState(roomName, tenant, skipPrejoin, locationURL); + const state = _getTokenAuthState(audioOnlyEnabled, roomName, tenant, skipPrejoin, locationURL); // Append ios=true or android=true to the token URL. // @ts-ignore diff --git a/react/features/authentication/functions.web.ts b/react/features/authentication/functions.web.ts index 1aa0e4107d..2157300c85 100644 --- a/react/features/authentication/functions.web.ts +++ b/react/features/authentication/functions.web.ts @@ -31,10 +31,11 @@ function _cryptoRandom() { * '{room}' - name of the conference room passed as roomName * argument to this method. * + * @param {boolean} audioOnlyEnabled - Join conference audio only. * @param {Object} config - Configuration state object from store. A URL pattern pointing to the login service. * @param {string} roomName - The name of the conference room for which the user will be authenticated. * @param {string} tenant - The name of the conference tenant. - * @param {string} skipPrejoin - The name of the conference room for which the user will be authenticated. + * @param {boolean} skipPrejoin - Whether to skip pre-join page. * @param {URL} locationURL - The current location URL. * * @returns {Promise} - The URL pointing to JWT login service or @@ -42,6 +43,7 @@ function _cryptoRandom() { * constructed. */ export const getTokenAuthUrl = ( + audioOnlyEnabled: boolean | undefined = false, config: IConfig, roomName: string | undefined, tenant: string | undefined, @@ -56,7 +58,7 @@ export const getTokenAuthUrl = ( } if (url.indexOf('{state}')) { - const state = _getTokenAuthState(roomName, tenant, skipPrejoin, locationURL); + const state = _getTokenAuthState(audioOnlyEnabled, roomName, tenant, skipPrejoin, locationURL); if (browser.isElectron()) { // @ts-ignore diff --git a/react/features/authentication/middleware.ts b/react/features/authentication/middleware.ts index 8ef9b0499b..7300c658c4 100644 --- a/react/features/authentication/middleware.ts +++ b/react/features/authentication/middleware.ts @@ -257,6 +257,7 @@ function _handleLogin({ dispatch, getState }: IStore) { const room = state['features/base/conference'].room; const { locationURL = { href: '' } as URL } = state['features/base/connection']; const { tenant } = parseURIString(locationURL.href) || {}; + const { enabled: audioOnlyEnabled } = state['features/base/audio-only']; if (!room) { logger.warn('Cannot handle login, room is undefined!'); @@ -270,7 +271,7 @@ function _handleLogin({ dispatch, getState }: IStore) { return; } - getTokenAuthUrl(config, room, tenant, true, locationURL) + getTokenAuthUrl(audioOnlyEnabled, config, room, tenant, true, locationURL) .then((tokenAuthServiceUrl: string | undefined) => { if (!tokenAuthServiceUrl) { logger.warn('Cannot handle login, token service URL is not set'); diff --git a/react/features/conference/components/native/Conference.tsx b/react/features/conference/components/native/Conference.tsx index dc81b9f906..2dde4735ff 100644 --- a/react/features/conference/components/native/Conference.tsx +++ b/react/features/conference/components/native/Conference.tsx @@ -12,7 +12,7 @@ import { import { EdgeInsets, withSafeAreaInsets } from 'react-native-safe-area-context'; import { connect, useDispatch } from 'react-redux'; -import { appNavigate } from '../../../app/actions'; +import { appNavigate } from '../../../app/actions.native'; import { IReduxState, IStore } from '../../../app/types'; import { CONFERENCE_BLURRED, CONFERENCE_FOCUSED } from '../../../base/conference/actionTypes'; import { FULLSCREEN_ENABLED, PIP_ENABLED } from '../../../base/flags/constants'; @@ -41,15 +41,15 @@ import { navigate } from '../../../mobile/navigation/components/conference/Confe import { screen } from '../../../mobile/navigation/routes'; import { setPictureInPictureEnabled } from '../../../mobile/picture-in-picture/functions'; import Captions from '../../../subtitles/components/native/Captions'; -import { setToolboxVisible } from '../../../toolbox/actions'; +import { setToolboxVisible } from '../../../toolbox/actions.native'; import Toolbox from '../../../toolbox/components/native/Toolbox'; -import { isToolboxVisible } from '../../../toolbox/functions'; +import { isToolboxVisible } from '../../../toolbox/functions.native'; import { AbstractConference, abstractMapStateToProps } from '../AbstractConference'; import type { AbstractProps } from '../AbstractConference'; -import { isConnecting } from '../functions'; +import { isConnecting } from '../functions.native'; import AlwaysOnLabels from './AlwaysOnLabels'; import ExpandedLabelPopup from './ExpandedLabelPopup'; @@ -230,7 +230,9 @@ class Conference extends AbstractConference { */ componentDidUpdate(prevProps: IProps) { const { - _showLobby + _audioOnlyEnabled, + _showLobby, + _startCarMode } = this.props; if (!prevProps._showLobby && _showLobby) { @@ -238,6 +240,10 @@ class Conference extends AbstractConference { } if (prevProps._showLobby && !_showLobby) { + if (_audioOnlyEnabled && _startCarMode) { + return; + } + navigate(screen.conference.main); } }