fix(Prejoin): Allow changing 'Enable pre meeting screen' option while prejoin screen visible

This commit is contained in:
Vlad Piersec 2021-11-04 10:17:55 +02:00 committed by vp8x8
parent 35b76a2f7c
commit d2619b4dd3
5 changed files with 25 additions and 31 deletions

View File

@ -15,9 +15,9 @@ export const PREJOIN_INITIALIZED = 'PREJOIN_INITIALIZED';
export const SET_DEVICE_STATUS = 'SET_DEVICE_STATUS';
/**
* Action type to set the visibility of the prejoin page for the future.
* Action type to mark the fact that the 'skip prejoin' option was modified this session.
*/
export const SET_SKIP_PREJOIN = 'SET_SKIP_PREJOIN';
export const SET_SKIP_PREJOIN_CHANGING = 'SET_SKIP_PREJOIN_CHANGING';
/**
* Action type to set the visibility of the prejoin page when client is forcefully reloaded.

View File

@ -8,7 +8,6 @@ import { v4 as uuidv4 } from 'uuid';
import { getDialOutStatusUrl, getDialOutUrl, updateConfig } from '../base/config';
import { browser, createLocalTrack } from '../base/lib-jitsi-meet';
import { isVideoMutedByUser, MEDIA_TYPE } from '../base/media';
import { updateSettings } from '../base/settings';
import {
createLocalTracksF,
getLocalAudioTrack,
@ -28,7 +27,7 @@ import {
SET_DIALOUT_NUMBER,
SET_DIALOUT_STATUS,
SET_PREJOIN_DISPLAY_NAME_REQUIRED,
SET_SKIP_PREJOIN,
SET_SKIP_PREJOIN_CHANGING,
SET_SKIP_PREJOIN_RELOAD,
SET_JOIN_BY_PHONE_DIALOG_VISIBLITY,
SET_PRECALL_TEST_RESULTS,
@ -228,15 +227,10 @@ export function joinConference(options?: Object, ignoreJoiningInProgress: boolea
}
const state = getState();
const { userSelectedSkipPrejoin } = state['features/prejoin'];
let localTracks = getLocalTracks(state['features/base/tracks']);
options && dispatch(updateConfig(options));
userSelectedSkipPrejoin && dispatch(updateSettings({
userSelectedSkipPrejoin
}));
// Do not signal audio/video tracks if the user joins muted.
for (const track of localTracks) {
// Always add the audio track on Safari because of a known issue where audio playout doesn't happen
@ -484,14 +478,15 @@ export function setDialOutNumber(value: string) {
}
/**
* Sets the visibility of the prejoin page for future uses.
* Sets a flag which signals that the option to skip the prejoin
* page on join has been modified during this session.
*
* @param {boolean} value - The visibility value.
* @returns {Object}
*/
export function setSkipPrejoin(value: boolean) {
export function setSkipPrejoinIsChanging(value: boolean) {
return {
type: SET_SKIP_PREJOIN,
type: SET_SKIP_PREJOIN_CHANGING,
value
};
}

View File

@ -36,16 +36,6 @@ export function isDisplayNameRequired(state: Object): boolean {
|| state['features/base/config'].requireDisplayName;
}
/**
* Selector for determining if the user has chosen to skip prejoin page.
*
* @param {Object} state - The state of the app.
* @returns {boolean}
*/
export function isPrejoinSkipped(state: Object) {
return state['features/prejoin'].userSelectedSkipPrejoin;
}
/**
* Returns the text for the prejoin status bar.
*
@ -160,6 +150,12 @@ export function isPrejoinPageEnabled(state: Object): boolean {
* @returns {boolean}
*/
export function isPrejoinPageVisible(state: Object): boolean {
// If the user has changed the setting for prejoin visibility on start
// let the visibility be controlled only by the 'showPrejoin' flag.
if (state['features/prejoin'].skipPrejoinChanging) {
return state['features/prejoin']?.showPrejoin;
}
return isPrejoinPageEnabled(state) && state['features/prejoin']?.showPrejoin;
}

View File

@ -11,7 +11,7 @@ import {
SET_PREJOIN_DEVICE_ERRORS,
SET_PREJOIN_DISPLAY_NAME_REQUIRED,
SET_PREJOIN_PAGE_VISIBILITY,
SET_SKIP_PREJOIN,
SET_SKIP_PREJOIN_CHANGING,
SET_SKIP_PREJOIN_RELOAD
} from './actionTypes';
@ -30,9 +30,9 @@ const DEFAULT_STATE = {
name: '',
rawError: '',
showPrejoin: true,
skipPrejoinChanging: false,
skipPrejoinOnReload: false,
showJoinByPhoneDialog: false,
userSelectedSkipPrejoin: false
showJoinByPhoneDialog: false
};
/**
@ -59,10 +59,10 @@ ReducerRegistry.register(
...state,
joiningInProgress: action.value
};
case SET_SKIP_PREJOIN: {
case SET_SKIP_PREJOIN_CHANGING: {
return {
...state,
userSelectedSkipPrejoin: action.value
skipPrejoinChanging: action.value
};
}

View File

@ -11,7 +11,7 @@ import { openDialog } from '../base/dialog';
import { i18next } from '../base/i18n';
import { updateSettings } from '../base/settings';
import { NOTIFICATION_TIMEOUT_TYPE, showNotification } from '../notifications';
import { setPrejoinPageVisibility } from '../prejoin/actions';
import { setPrejoinPageVisibility, setSkipPrejoinIsChanging } from '../prejoin/actions';
import { setScreenshareFramerate } from '../screen-share/actions';
import {
@ -96,9 +96,12 @@ export function submitMoreTab(newState: Object): Function {
if (showPrejoinPage && getState()['features/prejoin']?.showPrejoin) {
dispatch(setPrejoinPageVisibility(false));
}
dispatch(updateSettings({
userSelectedSkipPrejoin: !showPrejoinPage
}));
batch(() => {
dispatch(setSkipPrejoinIsChanging(true));
dispatch(updateSettings({
userSelectedSkipPrejoin: !showPrejoinPage
}));
});
}
if (newState.currentLanguage !== currentState.currentLanguage) {