Skip to content

Commit

Permalink
Improve the layouts on small mobile calls
Browse files Browse the repository at this point in the history
Due to an oversight of mine, 2440037 actually removed the ability to see the one-on-one layout on mobile. This restores mobile one-on-one calls to working order and also avoids showing the spotlight tile unless there are more than a few participants.
  • Loading branch information
robintown committed Jul 25, 2024
1 parent 5e4a29a commit 4b0a595
Showing 1 changed file with 19 additions and 1 deletion.
20 changes: 19 additions & 1 deletion src/state/CallViewModel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ import {
shareReplay,
skip,
startWith,
switchAll,
switchMap,
throttleTime,
timer,
Expand Down Expand Up @@ -75,6 +76,10 @@ import { duplicateTiles } from "../settings/settings";
// list again
const POST_FOCUS_PARTICIPANT_UPDATE_DELAY_MS = 3000;

// This is the number of participants that we think constitutes a "small" call
// on mobile. No spotlight tile should be shown below this threshold.
const smallMobileCallThreshold = 3;

export interface GridLayout {
type: "grid";
spotlight?: MediaViewModel[];
Expand Down Expand Up @@ -648,7 +653,20 @@ export class CallViewModel extends ViewModel {
}),
);
case "narrow":
return this.spotlightPortraitLayout;
return this.oneOnOne.pipe(
switchMap((oneOnOne) =>
oneOnOne
? this.oneOnOneLayout
: combineLatest(
[this.grid, this.spotlight],
(grid, spotlight) =>
grid.length > smallMobileCallThreshold ||
spotlight.some((vm) => vm instanceof ScreenShareViewModel)
? this.spotlightPortraitLayout
: this.gridLayout,
).pipe(switchAll()),
),
);
case "flat":
return this.gridMode.pipe(
switchMap((gridMode) => {
Expand Down

0 comments on commit 4b0a595

Please sign in to comment.