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(visitors): Updates mobile to handle redirected conf error. (#13110)
Дамян Минков649a4ffd466b
diff --git a/conference.js b/conference.jsindex e286fc83ab..2fce22953a 100644--- a/conference.js+++ b/conference.js@@ -352,8 +352,8 @@ class ConferenceConnector {const [ vnode ] = params;APP.store.dispatch(overwriteConfig(newConfig))- .then(APP.store.dispatch(setIAmVisitor(Boolean(vnode)))).then(this._conference.leaveRoom())+ .then(APP.store.dispatch(setIAmVisitor(Boolean(vnode))))// we do not clear local tracks on error, so we need to manually clear them.then(APP.store.dispatch(destroyLocalTracks()))diff --git a/lang/main.json b/lang/main.jsonindex 035cf025bf..2ccd3f133e 100644--- a/lang/main.json+++ b/lang/main.json@@ -1377,7 +1377,13 @@"webAssemblyWarning": "WebAssembly not supported","webAssemblyWarningDescription": "WebAssembly disabled or not supported by this browser"},- "visitorsLabel": "Number of visitors: {{count}}",+ "visitors": {+ "labelTooltip": "Number of visitors: {{count}}",+ "notification": {+ "description": "To participate raise your hand",+ "title": "You are a visitor in the meeting"+ }+ },"volumeSlider": "Volume slider","welcomepage": {"accessibilityLabel": {diff --git a/react/features/base/conference/functions.ts b/react/features/base/conference/functions.tsindex 3a52352220..fff7283fe1 100644--- a/react/features/base/conference/functions.ts+++ b/react/features/base/conference/functions.ts@@ -288,7 +288,7 @@ export function getVisitorOptions(stateful: IStateful, params: Array<string>) {};}- return {};+ return;}const oldConfig = {diff --git a/react/features/base/conference/middleware.any.js b/react/features/base/conference/middleware.any.jsindex 14c6e1829f..f1035cd7ce 100644--- a/react/features/base/conference/middleware.any.js+++ b/react/features/base/conference/middleware.any.js@@ -12,7 +12,15 @@ import { reloadNow } from '../../app/actions';import { removeLobbyChatParticipant } from '../../chat/actions.any';import { openDisplayNamePrompt } from '../../display-name';import { NOTIFICATION_TIMEOUT_TYPE, showErrorNotification, showWarningNotification } from '../../notifications';-import { CONNECTION_ESTABLISHED, CONNECTION_FAILED, connectionDisconnected } from '../connection';+import { setIAmVisitor } from '../../visitors/actions';+import { overwriteConfig } from '../config';+import {+ CONNECTION_ESTABLISHED,+ CONNECTION_FAILED,+ connectionDisconnected,+ disconnect+} from '../connection';+import { connect } from '../connection/actions';import { validateJwt } from '../jwt';import { JitsiConferenceErrors } from '../lib-jitsi-meet';import {@@ -24,7 +32,7 @@ import {getPinnedParticipant} from '../participants';import { MiddlewareRegistry } from '../redux';-import { TRACK_ADDED, TRACK_REMOVED } from '../tracks';+import { TRACK_ADDED, TRACK_REMOVED, destroyLocalTracks } from '../tracks';import {CONFERENCE_FAILED,@@ -47,7 +55,8 @@ import {_addLocalTracksToConference,_removeLocalTracksFromConference,forEachConference,- getCurrentConference+ getCurrentConference,+ getVisitorOptions} from './functions';import logger from './logger';@@ -119,8 +128,15 @@ MiddlewareRegistry.register(store => next => action => {* @returns {Object} The value returned by {@code next(action)}.*/function _conferenceFailed({ dispatch, getState }, next, action) {- const result = next(action);const { conference, error } = action;++ if (error.name === JitsiConferenceErrors.REDIRECTED) {+ if (typeof error.recoverable === 'undefined') {+ error.recoverable = true;+ }+ }++ const result = next(action);const { enableForcedReload } = getState()['features/base/config'];// Handle specific failure reasons.@@ -168,6 +184,31 @@ function _conferenceFailed({ dispatch, getState }, next, action) {case JitsiConferenceErrors.OFFER_ANSWER_FAILED:sendAnalytics(createOfferAnswerFailedEvent());break;+ case JitsiConferenceErrors.REDIRECTED: {+ // once conference.js is gone this can be removed and both+ // redirect logics to be merged+ if (typeof APP === 'undefined') {+ const newConfig = getVisitorOptions(getState, error.params);++ if (!newConfig) {+ logger.warn('Not redirected missing params');+ break;+ }++ const [ vnode ] = error.params;++ dispatch(overwriteConfig(newConfig))+ .then(dispatch(conferenceWillLeave(conference)))+ .then(conference.leave())+ .then(dispatch(disconnect()))+ .then(dispatch(setIAmVisitor(Boolean(vnode))))++ // we do not clear local tracks on error, so we need to manually clear them+ .then(dispatch(destroyLocalTracks()))+ .then(dispatch(connect()));+ }+ break;+ }}if (typeof APP === 'undefined') {diff --git a/react/features/base/lib-jitsi-meet/actions.ts b/react/features/base/lib-jitsi-meet/actions.tsindex ef35011b17..a994652c15 100644--- a/react/features/base/lib-jitsi-meet/actions.ts+++ b/react/features/base/lib-jitsi-meet/actions.ts@@ -14,6 +14,7 @@ import {LIB_WILL_INIT} from './actionTypes';import { isAnalyticsEnabled } from './functions.any';+import logger from './logger';/*** Disposes (of) lib-jitsi-meet.@@ -56,6 +57,9 @@ export function initLib() {JitsiMeetJS.setNetworkInfo({isOnline: isOnline(state)});++ logger.info(`lib-jitsi-meet version:${JitsiMeetJS.version}`);+dispatch({ type: LIB_DID_INIT });} catch (error: any) {dispatch(libInitError(error));diff --git a/react/features/conference/components/native/Conference.js b/react/features/conference/components/native/Conference.jsindex 6ff6f1d435..36bfe9a683 100644--- a/react/features/conference/components/native/Conference.js+++ b/react/features/conference/components/native/Conference.js@@ -472,7 +472,13 @@ class Conference extends AbstractConference<Props, State> {<TestConnectionInfo />- {_shouldDisplayTileView && <Toolbox />}+ {+ _shouldDisplayTileView+ && <>+ { this._renderNotificationsContainer() }+ <Toolbox />+ </>+ }</>);}@@ -528,6 +534,7 @@ class Conference extends AbstractConference<Props, State> {return super.renderNotificationsContainer({+ shouldDisplayTileView: this.props._shouldDisplayTileView,style: notificationsStyle,toolboxVisible: this.props._toolboxVisible}diff --git a/react/features/notifications/components/native/NotificationsContainer.tsx b/react/features/notifications/components/native/NotificationsContainer.tsxindex 84c7009775..123ee14410 100644--- a/react/features/notifications/components/native/NotificationsContainer.tsx+++ b/react/features/notifications/components/native/NotificationsContainer.tsx@@ -29,6 +29,11 @@ interface IProps extends WithTranslation {*/dispatch: Function;+ /**+ * Whether or not the layout should change to support tile view mode.+ */+ shouldDisplayTileView: boolean;+/*** Checks toolbox visibility.*/@@ -176,9 +181,21 @@ class NotificationsContainer extends Component<IProps> {* @inheritdoc*/render() {- const { _notifications, toolboxVisible } = this.props;- const notificationsContainerStyle- = toolboxVisible ? styles.withToolbox : styles.withoutToolbox;+ const { _notifications, shouldDisplayTileView, toolboxVisible } = this.props;+ let notificationsContainerStyle;++ if (shouldDisplayTileView) {++ if (toolboxVisible) {+ notificationsContainerStyle = styles.withToolboxTileView;+ } else {+ notificationsContainerStyle = styles.withoutToolboxTileView;+ }++ } else {+ notificationsContainerStyle+ = toolboxVisible ? styles.withToolbox : styles.withoutToolbox;+ }return (<SafeAreaViewdiff --git a/react/features/notifications/components/native/styles.js b/react/features/notifications/components/native/styles.jsindex d3ae396219..015ab6f9f3 100644--- a/react/features/notifications/components/native/styles.js+++ b/react/features/notifications/components/native/styles.js@@ -108,7 +108,13 @@ export default {},withToolbox: {- bottom: 64,+ bottom: 56,+ position: 'absolute',+ width: '100%'+ },++ withToolboxTileView: {+ bottom: 56,position: 'absolute',width: '100%'},@@ -116,5 +122,11 @@ export default {withoutToolbox: {position: 'absolute',width: '100%'+ },++ withoutToolboxTileView: {+ bottom: 0,+ position: 'absolute',+ width: '100%'}};diff --git a/react/features/toolbox/components/native/Toolbox.js b/react/features/toolbox/components/native/Toolbox.jsindex ec9bbe4309..03d805c0a7 100644--- a/react/features/toolbox/components/native/Toolbox.js+++ b/react/features/toolbox/components/native/Toolbox.js@@ -52,7 +52,7 @@ type Props = {/*** Whether we are in visitors mode.*/- _visitorsModeEnabled: boolean,+ _iAmVisitor: boolean,/*** The width of the screen.@@ -67,7 +67,7 @@ type Props = {* @returns {React$Element}.*/function Toolbox(props: Props) {- const { _endConferenceSupported, _reactionsEnabled, _styles, _visible, _visitorsModeEnabled, _width } = props;+ const { _endConferenceSupported, _reactionsEnabled, _styles, _visible, _iAmVisitor, _width } = props;if (!_visible) {return null;@@ -83,6 +83,13 @@ function Toolbox(props: Props) {_styles.backgroundToggle]};+ const style = { ...styles.toolbox };++ // we have only hangup and raisehand button in _iAmVisitor mode+ if (_iAmVisitor) {+ additionalButtons.add('raisehand');+ style.justifyContent = 'center';+ }return (<View@@ -92,23 +99,23 @@ function Toolbox(props: Props) {accessibilityRole = 'toolbar'edges = { [ bottomEdge && 'bottom' ].filter(Boolean) }pointerEvents = 'box-none'- style = { styles.toolbox }>- {!_visitorsModeEnabled && <AudioMuteButton+ style = { style }>+ {!_iAmVisitor && <AudioMuteButtonstyles = { buttonStylesBorderless }toggledStyles = { toggledButtonStyles } />}- {!_visitorsModeEnabled && <VideoMuteButton+ {!_iAmVisitor && <VideoMuteButtonstyles = { buttonStylesBorderless }toggledStyles = { toggledButtonStyles } />}- {!_visitorsModeEnabled && additionalButtons.has('chat')+ {additionalButtons.has('chat')&& <ChatButtonstyles = { buttonStylesBorderless }toggledStyles = { backgroundToggledStyle } />}- {!_visitorsModeEnabled && additionalButtons.has('screensharing')+ {!_iAmVisitor && additionalButtons.has('screensharing')&& <ScreenSharingButton styles = { buttonStylesBorderless } />}- { !_visitorsModeEnabled && additionalButtons.has('raisehand') && (_reactionsEnabled+ {additionalButtons.has('raisehand') && (_reactionsEnabled && !_iAmVisitor? <ReactionsMenuButtonstyles = { buttonStylesBorderless }toggledStyles = { backgroundToggledStyle } />@@ -116,7 +123,7 @@ function Toolbox(props: Props) {styles = { buttonStylesBorderless }toggledStyles = { backgroundToggledStyle } />)}{additionalButtons.has('tileview') && <TileViewButton styles = { buttonStylesBorderless } />}- {!_visitorsModeEnabled && <OverflowMenuButton+ {!_iAmVisitor && <OverflowMenuButtonstyles = { buttonStylesBorderless }toggledStyles = { toggledButtonStyles } />}@@ -149,7 +156,7 @@ function _mapStateToProps(state: Object): Object {_endConferenceSupported: Boolean(endConferenceSupported),_styles: ColorSchemeRegistry.get(state, 'Toolbox'),_visible: isToolboxVisible(state),- _visitorsModeEnabled: iAmVisitor(state),+ _iAmVisitor: iAmVisitor(state),_width: state['features/base/responsive-ui'].clientWidth,_reactionsEnabled: isReactionsEnabled(state)};diff --git a/react/features/video-menu/components/native/RemoteVideoMenu.js b/react/features/video-menu/components/native/RemoteVideoMenu.jsindex a284acf59b..9d45319cc1 100644--- a/react/features/video-menu/components/native/RemoteVideoMenu.js+++ b/react/features/video-menu/components/native/RemoteVideoMenu.js@@ -224,12 +224,13 @@ function _mapStateToProps(state, ownProps) {const _currentRoomId = getCurrentRoomId(state);const shouldDisableKick = disableKick || !kickOutEnabled;const moderator = isLocalParticipantModerator(state);+ const _iAmVisitor = state['features/visitors'].iAmVisitor;return {_currentRoomId,_disableKick: Boolean(shouldDisableKick),_disableRemoteMute: Boolean(disableRemoteMute),- _disablePrivateChat: Boolean(disablePrivateChat),+ _disablePrivateChat: Boolean(disablePrivateChat) || _iAmVisitor,_isParticipantAvailable: Boolean(isParticipantAvailable),_moderator: moderator,_participantDisplayName: getParticipantDisplayName(state, participantId),diff --git a/react/features/visitors/components/native/VisitorsCountLabel.tsx b/react/features/visitors/components/native/VisitorsCountLabel.tsxindex 3f2d6f0b15..afde7c8640 100644--- a/react/features/visitors/components/native/VisitorsCountLabel.tsx+++ b/react/features/visitors/components/native/VisitorsCountLabel.tsx@@ -30,7 +30,7 @@ const VisitorsCountLabel = () => {const visitorsCount = useSelector((state: IReduxState) =>state['features/visitors'].count || 0);- return visitorsMode && (+ return !visitorsMode && visitorsCount > 0 && (<Labelicon = { IconUsers }iconColor = { BaseTheme.palette.uiBackground }diff --git a/react/features/visitors/components/web/VisitorsCountLabel.tsx b/react/features/visitors/components/web/VisitorsCountLabel.tsxindex d527ea7c5e..a9079f037c 100644--- a/react/features/visitors/components/web/VisitorsCountLabel.tsx+++ b/react/features/visitors/components/web/VisitorsCountLabel.tsx@@ -26,7 +26,7 @@ const VisitorsCountLabel = () => {const { t } = useTranslation();return !visitorsMode && visitorsCount > 0 && (<Tooltip- content = { t('visitorsLabel', { count: visitorsCount }) }+ content = { t('visitors.labelTooltip', { count: visitorsCount }) }position = { 'bottom' }><LabelclassName = { styles.label }diff --git a/react/features/visitors/middleware.ts b/react/features/visitors/middleware.tsindex e21b0fe411..d0692ffe3e 100644--- a/react/features/visitors/middleware.ts+++ b/react/features/visitors/middleware.ts@@ -1,11 +1,14 @@-import { CONFERENCE_JOIN_IN_PROGRESS } from '../base/conference/actionTypes';+import { CONFERENCE_JOINED, CONFERENCE_JOIN_IN_PROGRESS } from '../base/conference/actionTypes';import { JitsiConferenceEvents } from '../base/lib-jitsi-meet';import MiddlewareRegistry from '../base/redux/MiddlewareRegistry';+import { showNotification } from '../notifications/actions';+import { NOTIFICATION_TIMEOUT_TYPE } from '../notifications/constants';import { updateVisitorsCount } from './actions';MiddlewareRegistry.register(({ dispatch, getState }) => next => action => {- if (action.type === CONFERENCE_JOIN_IN_PROGRESS) {+ switch (action.type) {+ case CONFERENCE_JOIN_IN_PROGRESS: {const { conference } = action;conference.on(JitsiConferenceEvents.PROPERTIES_CHANGED, (properties: { 'visitor-count': number; }) => {@@ -15,6 +18,17 @@ MiddlewareRegistry.register(({ dispatch, getState }) => next => action => {dispatch(updateVisitorsCount(visitorCount));}});+ break;+ }+ case CONFERENCE_JOINED: {+ if (getState()['features/visitors'].showNotification) {+ dispatch(showNotification({+ titleKey: 'visitors.notification.title',+ descriptionKey: 'visitors.notification.description'+ }, NOTIFICATION_TIMEOUT_TYPE.STICKY));+ }+ break;+ }}return next(action);diff --git a/react/features/visitors/reducer.ts b/react/features/visitors/reducer.tsindex 600f2655fc..fb773e3112 100644--- a/react/features/visitors/reducer.ts+++ b/react/features/visitors/reducer.ts@@ -1,20 +1,27 @@+import { CONFERENCE_WILL_LEAVE } from '../base/conference/actionTypes';import ReducerRegistry from '../base/redux/ReducerRegistry';-import {- I_AM_VISITOR_MODE,- UPDATE_VISITORS_COUNT-} from './actionTypes';+import { I_AM_VISITOR_MODE, UPDATE_VISITORS_COUNT } from './actionTypes';const DEFAULT_STATE = {- iAmVisitor: false+ count: -1,+ iAmVisitor: false,+ showNotification: false};export interface IVisitorsState {count?: number;iAmVisitor: boolean;+ showNotification: boolean;}ReducerRegistry.register<IVisitorsState>('features/visitors', (state = DEFAULT_STATE, action): IVisitorsState => {switch (action.type) {+ case CONFERENCE_WILL_LEAVE: {+ return {+ ...state,+ ...DEFAULT_STATE+ };+ }case UPDATE_VISITORS_COUNT: {if (state.count === action.count) {return state;@@ -28,7 +35,8 @@ ReducerRegistry.register<IVisitorsState>('features/visitors', (state = DEFAULT_Scase I_AM_VISITOR_MODE: {return {...state,- iAmVisitor: action.enabled+ iAmVisitor: action.enabled,+ showNotification: true};}}