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
feat(rn,invite) add ability to disable dial-in options
Saúl Ibarra Corretgé418d333caf50
diff --git a/react/features/base/flags/constants.ts b/react/features/base/flags/constants.tsindex 17673e1681..6c9ffbfaba 100644--- a/react/features/base/flags/constants.ts+++ b/react/features/base/flags/constants.ts@@ -90,6 +90,12 @@ export const HELP_BUTTON_ENABLED = 'help.enabled';*/export const INVITE_ENABLED = 'invite.enabled';+/**+ * Flag indicating if dial-in invite functionality should be enabled.+ * Default: enabled (true).+ */+export const INVITE_DIAL_IN_ENABLED = 'invite-dial-in.enabled';+/*** Flag indicating if recording should be enabled in iOS.* Default: disabled (false).diff --git a/react/features/invite/functions.ts b/react/features/invite/functions.tsindex f8bac9549d..535eea14e3 100644--- a/react/features/invite/functions.ts+++ b/react/features/invite/functions.ts@@ -571,12 +571,13 @@ export function searchDirectory( // eslint-disable-line max-params* @param {IReduxState} state - The current state.* @param {string} inviteUrl - The conference/location URL.* @param {boolean} useHtml - Whether to return html text.+ * @param {boolean} skipDialIn - Whether to skip dial-in options or not.* @returns {Promise<string>} A {@code Promise} resolving with a* descriptive text that can be used to invite participants to a meeting.*/-export function getShareInfoText(state: IReduxState, inviteUrl: string, useHtml?: boolean): Promise<string> {+export function getShareInfoText(+ state: IReduxState, inviteUrl: string, useHtml?: boolean, skipDialIn?: boolean): Promise<string> {let roomUrl = _decodeRoomURI(inviteUrl);- const includeDialInfo = state['features/base/config'] !== undefined;if (useHtml) {roomUrl = `<a href="${roomUrl}">${roomUrl}</a>`;@@ -584,85 +585,72 @@ export function getShareInfoText(state: IReduxState, inviteUrl: string, useHtml?let infoText = i18next.t('share.mainText', { roomUrl });- if (includeDialInfo) {- const { room } = parseURIString(inviteUrl);- let numbersPromise;- let hasPaymentError = false;-- if (state['features/invite'].numbers- && state['features/invite'].conferenceID) {- numbersPromise = Promise.resolve(state['features/invite']);- } else {- // we are requesting numbers and conferenceId directly- // not using updateDialInNumbers, because custom room- // is specified and we do not want to store the data- // in the state- const { dialInConfCodeUrl, dialInNumbersUrl, hosts }- = state['features/base/config'];- const { locationURL = {} } = state['features/base/connection'];- const mucURL = hosts?.muc;-- if (!dialInConfCodeUrl || !dialInNumbersUrl || !mucURL) {- // URLs for fetching dial in numbers not defined- return Promise.resolve(infoText);- }-- numbersPromise = Promise.all([- getDialInNumbers(dialInNumbersUrl, room, mucURL), // @ts-ignore- getDialInConferenceID(dialInConfCodeUrl, room, mucURL, locationURL)- ]).then(([ numbers, {- conference, id, message } ]) => {+ const { room } = parseURIString(inviteUrl);+ const { dialInConfCodeUrl, dialInNumbersUrl, hosts } = state['features/base/config'];+ const { locationURL = {} } = state['features/base/connection'];+ const mucURL = hosts?.muc;- if (!conference || !id) {- return Promise.reject(message);- }+ if (skipDialIn || !dialInConfCodeUrl || !dialInNumbersUrl || !mucURL) {+ // URLs for fetching dial in numbers not defined.+ return Promise.resolve(infoText);+ }- return {- numbers,- conferenceID: id- };- });- }+ let hasPaymentError = false;- return numbersPromise.then(- ({ conferenceID, numbers }) => {- const phoneNumber = _getDefaultPhoneNumber(numbers) || '';+ // We are requesting numbers and conferenceId directly+ // not using updateDialInNumbers, because custom room+ // is specified and we do not want to store the data+ // in the state.+ const numbersPromise = Promise.all([+ getDialInNumbers(dialInNumbersUrl, room, mucURL), // @ts-ignore+ getDialInConferenceID(dialInConfCodeUrl, room, mucURL, locationURL)+ ]).then(([ numbers, {+ conference, id, message } ]) => {- return `${- i18next.t('info.dialInNumber')} ${- phoneNumber} ${- i18next.t('info.dialInConferenceID')} ${- conferenceID}#\n\n`;- })- .catch(error => {- logger.error('Error fetching numbers or conferenceID', error);- hasPaymentError = error?.status === StatusCode.PaymentRequired;- })- .then(defaultDialInNumber => {- if (hasPaymentError) {- infoText += `${- i18next.t('info.dialInNumber')} ${i18next.t('info.reachedLimit')} ${- i18next.t('info.upgradeOptions')} ${UPGRADE_OPTIONS_TEXT}`;+ if (!conference || !id) {+ return Promise.reject(message);+ }- return infoText;- }+ return {+ numbers,+ conferenceID: id+ };+ });- let dialInfoPageUrl = getDialInfoPageURL(state, room);+ return numbersPromise.then(({ conferenceID, numbers }) => {+ const phoneNumber = _getDefaultPhoneNumber(numbers) || '';++ return `${+ i18next.t('info.dialInNumber')} ${+ phoneNumber} ${+ i18next.t('info.dialInConferenceID')} ${+ conferenceID}#\n\n`;+ })+ .catch(error => {+ logger.error('Error fetching numbers or conferenceID', error);+ hasPaymentError = error?.status === StatusCode.PaymentRequired;+ })+ .then(defaultDialInNumber => {+ if (hasPaymentError) {+ infoText += `${+ i18next.t('info.dialInNumber')} ${i18next.t('info.reachedLimit')} ${+ i18next.t('info.upgradeOptions')} ${UPGRADE_OPTIONS_TEXT}`;++ return infoText;+ }- if (useHtml) {- dialInfoPageUrl- = `<a href="${dialInfoPageUrl}">${dialInfoPageUrl}</a>`;- }+ let dialInfoPageUrl = getDialInfoPageURL(state, room);- infoText += i18next.t('share.dialInfoText', {- defaultDialInNumber,- dialInfoPageUrl });+ if (useHtml) {+ dialInfoPageUrl = `<a href="${dialInfoPageUrl}">${dialInfoPageUrl}</a>`;+ }- return infoText;- });- }+ infoText += i18next.t('share.dialInfoText', {+ defaultDialInNumber,+ dialInfoPageUrl });- return Promise.resolve(infoText);+ return infoText;+ });}/**diff --git a/react/features/share-room/middleware.ts b/react/features/share-room/middleware.tsindex ea554556cc..05c7204abd 100644--- a/react/features/share-room/middleware.ts+++ b/react/features/share-room/middleware.ts@@ -2,6 +2,8 @@ import { Share } from 'react-native';import { getName } from '../app/functions.native';import { IStore } from '../app/types';+import { INVITE_DIAL_IN_ENABLED } from '../base/flags/constants';+import { getFeatureFlag } from '../base/flags/functions';import MiddlewareRegistry from '../base/redux/MiddlewareRegistry';import { getShareInfoText } from '../invite/functions';@@ -35,7 +37,9 @@ MiddlewareRegistry.register(store => next => action => {* @returns {void}*/function _shareRoom(roomURL: string, { dispatch, getState }: IStore) {- getShareInfoText(getState(), roomURL)+ const dialInEnabled = getFeatureFlag(getState(), INVITE_DIAL_IN_ENABLED, true);++ getShareInfoText(getState(), roomURL, false /* useHtml */, !dialInEnabled /* skipDialIn */).then(message => {const title = `${getName()} Conference`;const onFulfilled@@ -53,14 +57,15 @@ function _shareRoom(roomURL: string, { dispatch, getState }: IStore) {.then(/* onFulfilled */ value => {onFulfilled(value.action === Share.sharedAction);- dispatch(toggleShareDialog(false));},/* onRejected */ reason => {- dispatch(toggleShareDialog(false));logger.error(`Failed to share conference/room URL ${roomURL}:`,reason);onFulfilled(false);- });+ })+ .finally(() => {+ dispatch(toggleShareDialog(false));+ });});}