Skip to content

Commit

Permalink
fix: use default tiles in view for mweb (#3152)
Browse files Browse the repository at this point in the history
  • Loading branch information
KaustubhKumar05 authored Aug 5, 2024
1 parent e18be94 commit 22781cf
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import React, { useEffect, useMemo, useRef } from 'react';
import { useMedia } from 'react-use';
import {
HMSRoomState,
selectFullAppData,
Expand All @@ -10,6 +11,7 @@ import {
useHMSStore,
useRecordingStreaming,
} from '@100mslive/react-sdk';
import { config as cssConfig } from '../../../Theme';
import { LayoutMode } from '../Settings/LayoutSettings';
import { useRoomLayoutConferencingScreen } from '../../provider/roomLayoutProvider/hooks/useRoomLayoutScreen';
//@ts-ignore
Expand All @@ -26,6 +28,7 @@ import {
UI_MODE_GRID,
UI_SETTINGS,
} from '../../common/constants';
import { DEFAULT_TILES_IN_VIEW } from '../MoreSettings/constants';

const initialAppData = {
[APP_DATA.uiSettings]: {
Expand Down Expand Up @@ -80,6 +83,7 @@ export const AppData = React.memo(() => {
const { isLocalVideoEnabled } = useAVToggle();
const sidepaneOpenedRef = useRef(false);
const [, setNoiseCancellationEnabled] = useSetNoiseCancellation();
const isMobile = useMedia(cssConfig.media.md);

useEffect(() => {
if (elements?.noise_cancellation?.enabled_by_default) {
Expand Down Expand Up @@ -117,10 +121,12 @@ export const AppData = React.memo(() => {
...uiSettings,
[UI_SETTINGS.isAudioOnly]: undefined,
[UI_SETTINGS.uiViewMode]: uiSettings.uiViewMode || UI_MODE_GRID,
[UI_SETTINGS.maxTileCount]: Number(elements?.video_tile_layout?.grid?.tiles_in_view) || 9,
[UI_SETTINGS.maxTileCount]: isMobile
? DEFAULT_TILES_IN_VIEW
: Number(elements?.video_tile_layout?.grid?.tiles_in_view) || DEFAULT_TILES_IN_VIEW,
};
hmsActions.setAppData(APP_DATA.uiSettings, updatedSettings, true);
}, [preferences, hmsActions, elements?.video_tile_layout]);
}, [preferences, hmsActions, elements?.video_tile_layout, isMobile]);

useEffect(() => {
if (!preferences.subscribedNotifications) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,4 @@ export const trackTypeOptions = [
{ label: 'audio', value: 'audio' },
{ label: 'video', value: 'video' },
];
export const DEFAULT_TILES_IN_VIEW = 9;

This comment has been minimized.

Copy link
@raviteja83

raviteja83 Aug 5, 2024

Collaborator

should be 4 only for mweb

0 comments on commit 22781cf

Please sign in to comment.