fix(layout): defaultLayout join parameter

This commit is contained in:
João Victor 2024-02-09 16:53:58 -03:00
parent 04714848cf
commit fa872e2b55
3 changed files with 20 additions and 5 deletions

View File

@ -8,6 +8,9 @@ import { makeCall } from '/imports/ui/services/api';
import logger from '/imports/startup/client/logger'; import logger from '/imports/startup/client/logger';
import LoadingScreen from '/imports/ui/components/common/loading-screen/component'; import LoadingScreen from '/imports/ui/components/common/loading-screen/component';
import { CurrentUser } from '/imports/api/users'; import { CurrentUser } from '/imports/api/users';
import Settings from '/imports/ui/services/settings';
import { updateSettings } from '/imports/ui/components/settings/service';
import { LAYOUT_TYPE } from '/imports/ui/components/layout/enums';
const propTypes = { const propTypes = {
children: PropTypes.element.isRequired, children: PropTypes.element.isRequired,
@ -178,6 +181,16 @@ class JoinHandler extends Component {
Session.set('bannerColor', resp.bannerColor); Session.set('bannerColor', resp.bannerColor);
}; };
const setUserDefaultLayout = (response) => {
const settings = {
application: {
...Settings.application,
selectedLayout: LAYOUT_TYPE[response.defaultLayout] || 'custom',
},
};
updateSettings(settings);
};
// use enter api to get params for the client // use enter api to get params for the client
const url = `${APP.bbbWebBase}/api/enter?sessionToken=${sessionToken}`; const url = `${APP.bbbWebBase}/api/enter?sessionToken=${sessionToken}`;
const fetchContent = await fetch(url, { credentials: 'include' }); const fetchContent = await fetch(url, { credentials: 'include' });
@ -199,6 +212,7 @@ class JoinHandler extends Component {
.findOne({ userId: Auth.userID, approved: true }, { fields: { _id: 1 } }); .findOne({ userId: Auth.userID, approved: true }, { fields: { _id: 1 } });
if (user) { if (user) {
await setCustomData(response); await setCustomData(response);
setUserDefaultLayout(response);
cd.stop(); cd.stop();
} }
}); });

View File

@ -56,7 +56,6 @@ class PushLayoutEngine extends React.Component {
cameraHeight, cameraHeight,
horizontalPosition, horizontalPosition,
layoutContextDispatch, layoutContextDispatch,
meetingLayout,
meetingLayoutCameraPosition, meetingLayoutCameraPosition,
meetingLayoutFocusedCamera, meetingLayoutFocusedCamera,
meetingLayoutVideoRate, meetingLayoutVideoRate,
@ -65,10 +64,12 @@ class PushLayoutEngine extends React.Component {
shouldShowExternalVideo, shouldShowExternalVideo,
} = this.props; } = this.props;
const userLayout = LAYOUT_TYPE[getFromUserSettings('bbb_change_layout', false)]; const changedLayout = getFromUserSettings('bbb_change_layout', null);
Settings.application.selectedLayout = userLayout || meetingLayout; if (changedLayout) {
Settings.application.selectedLayout = LAYOUT_TYPE[changedLayout];
}
let selectedLayout = Settings.application.selectedLayout; let { selectedLayout } = Settings.application;
if (isMobile()) { if (isMobile()) {
selectedLayout = selectedLayout === 'custom' ? 'smart' : selectedLayout; selectedLayout = selectedLayout === 'custom' ? 'smart' : selectedLayout;
Settings.application.selectedLayout = selectedLayout; Settings.application.selectedLayout = selectedLayout;

View File

@ -47,7 +47,7 @@ const joinEndpointTableData = [
"name": "defaultLayout", "name": "defaultLayout",
"required": false, "required": false,
"type": "String", "type": "String",
"description": (<>The layout name to be loaded first when the application is loaded.</>) "description": (<>The layout name to be loaded first when the application is loaded. If none is provided, the meeting layout will be used.</>)
}, },
{ {
"name": "avatarURL", "name": "avatarURL",