Bladeren bron

feat(prejoin) default to enabled (#14236)

* feat(prejoin) default to enabled

* squash: Fixes is prejoin config check.

---------

Co-authored-by: damencho <damencho@jitsi.org>
factor2
Saúl Ibarra Corretgé 1 jaar geleden
bovenliggende
commit
7e0b00ba5f
No account linked to committer's email address

+ 1
- 1
config.js Bestand weergeven

@@ -723,7 +723,7 @@ var config = {
723 723
     // Configs for prejoin page.
724 724
     // prejoinConfig: {
725 725
     //     // When 'true', it shows an intermediate page before joining, where the user can configure their devices.
726
-    //     // This replaces `prejoinPageEnabled`.
726
+    //     // This replaces `prejoinPageEnabled`. Defaults to true.
727 727
     //     enabled: true,
728 728
     //     // Hides the participant name editing field in the prejoin screen.
729 729
     //     // If requireDisplayName is also set as true, a name should still be provided through

+ 8
- 3
react/features/lobby/middleware.ts Bestand weergeven

@@ -43,7 +43,11 @@ import {
43 43
 import { INotificationProps } from '../notifications/types';
44 44
 import { open as openParticipantsPane } from '../participants-pane/actions';
45 45
 import { getParticipantsPaneOpen } from '../participants-pane/functions';
46
-import { isPrejoinPageVisible, shouldAutoKnock } from '../prejoin/functions';
46
+import {
47
+    isPrejoinEnabledInConfig,
48
+    isPrejoinPageVisible,
49
+    shouldAutoKnock
50
+} from '../prejoin/functions';
47 51
 
48 52
 import {
49 53
     KNOCKING_PARTICIPANT_ARRIVED_OR_UPDATED,
@@ -269,7 +273,6 @@ function _conferenceFailed({ dispatch, getState }: IStore, next: Function, actio
269 273
     const { membersOnly } = state['features/base/conference'];
270 274
     const nonFirstFailure = Boolean(membersOnly);
271 275
     const { isDisplayNameRequiredError } = state['features/lobby'];
272
-    const { prejoinConfig } = state['features/base/config'];
273 276
 
274 277
     if (error.name === JitsiConferenceErrors.MEMBERS_ONLY_ERROR) {
275 278
         if (typeof error.recoverable === 'undefined') {
@@ -284,7 +287,9 @@ function _conferenceFailed({ dispatch, getState }: IStore, next: Function, actio
284 287
         dispatch(openLobbyScreen());
285 288
 
286 289
         // if there was an error about display name and pre-join is not enabled
287
-        if (shouldAutoKnock(state) || (isDisplayNameRequiredError && !prejoinConfig?.enabled) || lobbyWaitingForHost) {
290
+        if (shouldAutoKnock(state)
291
+                || (isDisplayNameRequiredError && !isPrejoinEnabledInConfig(state))
292
+                || lobbyWaitingForHost) {
288 293
             dispatch(startKnocking());
289 294
         }
290 295
 

+ 2
- 3
react/features/mobile/navigation/functions.tsx Bestand weergeven

@@ -11,6 +11,7 @@ import { getFeatureFlag } from '../../base/flags/functions';
11 11
 import { IconCloseLarge } from '../../base/icons/svg';
12 12
 import { toState } from '../../base/redux/functions';
13 13
 import { cancelKnocking } from '../../lobby/actions.native';
14
+import { isPrejoinEnabledInConfig } from '../../prejoin/functions';
14 15
 
15 16
 import HeaderNavigationButton from './components/HeaderNavigationButton';
16 17
 
@@ -50,10 +51,8 @@ export function screenHeaderCloseButton(goBack: (e?: GestureResponderEvent | Rea
50 51
  */
51 52
 export function isPrejoinPageEnabled(stateful: IStateful) {
52 53
     const state = toState(stateful);
53
-    const { prejoinConfig } = state['features/base/config'];
54
-    const isPrejoinEnabledInConfig = prejoinConfig?.enabled;
55 54
 
56
-    return getFeatureFlag(state, PREJOIN_PAGE_ENABLED, isPrejoinEnabledInConfig ?? true);
55
+    return getFeatureFlag(state, PREJOIN_PAGE_ENABLED, isPrejoinEnabledInConfig(state));
57 56
 }
58 57
 
59 58
 /**

+ 13
- 4
react/features/prejoin/functions.ts Bestand weergeven

@@ -42,6 +42,16 @@ export function isDisplayNameRequired(state: IReduxState): boolean {
42 42
         || state['features/base/config']?.requireDisplayName);
43 43
 }
44 44
 
45
+/**
46
+ * Selector for determining if the prejoin page is enabled in config. Defaults to `true`.
47
+ *
48
+ * @param {IReduxState} state - The state of the app.
49
+ * @returns {boolean}
50
+ */
51
+export function isPrejoinEnabledInConfig(state: IReduxState): boolean {
52
+    return state['features/base/config'].prejoinConfig?.enabled ?? true;
53
+}
54
+
45 55
 /**
46 56
  * Selector for determining if the prejoin display name field is visible.
47 57
  *
@@ -154,7 +164,7 @@ export function isJoinByPhoneDialogVisible(state: IReduxState): boolean {
154 164
  */
155 165
 export function isPrejoinPageVisible(state: IReduxState): boolean {
156 166
     return Boolean(navigator.product !== 'ReactNative'
157
-        && state['features/base/config'].prejoinConfig?.enabled
167
+        && isPrejoinEnabledInConfig(state)
158 168
         && state['features/prejoin']?.showPrejoin
159 169
         && !(state['features/base/config'].enableForcedReload && state['features/prejoin'].skipPrejoinOnReload));
160 170
 }
@@ -166,12 +176,11 @@ export function isPrejoinPageVisible(state: IReduxState): boolean {
166 176
  * @returns {boolean}
167 177
  */
168 178
 export function shouldAutoKnock(state: IReduxState): boolean {
169
-    const { iAmRecorder, iAmSipGateway, prejoinConfig } = state['features/base/config'];
179
+    const { iAmRecorder, iAmSipGateway } = state['features/base/config'];
170 180
     const { userSelectedSkipPrejoin } = state['features/base/settings'];
171 181
     const { autoKnock } = getLobbyConfig(state);
172
-    const isPrejoinEnabled = prejoinConfig?.enabled;
173 182
 
174
-    return Boolean(((isPrejoinEnabled && !userSelectedSkipPrejoin)
183
+    return Boolean(((isPrejoinEnabledInConfig(state) && !userSelectedSkipPrejoin)
175 184
             || autoKnock || (iAmRecorder && iAmSipGateway))
176 185
         && !state['features/lobby'].knocking);
177 186
 }

+ 2
- 2
react/features/settings/components/native/GeneralSection.tsx Bestand weergeven

@@ -11,6 +11,7 @@ import { updateSettings } from '../../../base/settings/actions';
11 11
 import Switch from '../../../base/ui/components/native/Switch';
12 12
 import { navigate } from '../../../mobile/navigation/components/settings/SettingsNavigationContainerRef';
13 13
 import { screen } from '../../../mobile/navigation/routes';
14
+import { isPrejoinEnabledInConfig } from '../../../prejoin/functions';
14 15
 
15 16
 import FormRow from './FormRow';
16 17
 import FormSection from './FormSection';
@@ -27,8 +28,7 @@ const GeneralSection = () => {
27 28
 
28 29
     const showPrejoinPage = !userSelectedSkipPrejoin;
29 30
 
30
-    let showPrejoinSettings = useSelector(
31
-        (state: IReduxState) => state['features/base/config'].prejoinConfig?.enabled);
31
+    let showPrejoinSettings = useSelector(isPrejoinEnabledInConfig);
32 32
 
33 33
     const { language = DEFAULT_LANGUAGE } = i18next;
34 34
 

+ 2
- 1
react/features/settings/functions.any.ts Bestand weergeven

@@ -10,6 +10,7 @@ import { getHideSelfView } from '../base/settings/functions.any';
10 10
 import { parseStandardURIString } from '../base/util/uri';
11 11
 import { isStageFilmstripEnabled } from '../filmstrip/functions';
12 12
 import { isFollowMeActive } from '../follow-me/functions';
13
+import { isPrejoinEnabledInConfig } from '../prejoin/functions';
13 14
 import { isReactionsEnabled } from '../reactions/functions.any';
14 15
 import { iAmVisitor } from '../visitors/functions';
15 16
 
@@ -114,7 +115,7 @@ export function getMoreTabProps(stateful: IStateful) {
114 115
         maxStageParticipants: state['features/base/settings'].maxStageParticipants,
115 116
         showLanguageSettings: configuredTabs.includes('language'),
116 117
         showPrejoinPage: !state['features/base/settings'].userSelectedSkipPrejoin,
117
-        showPrejoinSettings: state['features/base/config'].prejoinConfig?.enabled,
118
+        showPrejoinSettings: isPrejoinEnabledInConfig(state),
118 119
         stageFilmstripEnabled
119 120
     };
120 121
 }

Laden…
Annuleren
Opslaan