mirror of
https://github.com/vector-im/element-call.git
synced 2024-11-27 00:48:06 +08:00
Assertions for one-on-one view
This commit is contained in:
parent
be250e2f25
commit
5009f1fe1b
@ -802,6 +802,7 @@ export class CallViewModel extends ViewModel {
|
|||||||
// There might not be a remote tile if only the local user is in the call
|
// There might not be a remote tile if only the local user is in the call
|
||||||
// and they're using the duplicate tiles option
|
// and they're using the duplicate tiles option
|
||||||
grid.some((vm) => !vm.local) &&
|
grid.some((vm) => !vm.local) &&
|
||||||
|
grid.some((vm) => vm.local) &&
|
||||||
screenShares.length === 0,
|
screenShares.length === 0,
|
||||||
);
|
);
|
||||||
|
|
||||||
@ -816,12 +817,14 @@ export class CallViewModel extends ViewModel {
|
|||||||
}),
|
}),
|
||||||
);
|
);
|
||||||
|
|
||||||
private readonly spotlightLandscapeLayout: Observable<LayoutMedia> =
|
private spotlightLandscapeLayout: Observable<LayoutMedia> = combineLatest(
|
||||||
combineLatest([this.grid, this.spotlight], (grid, spotlight) => ({
|
[this.grid, this.spotlight],
|
||||||
|
(grid, spotlight) => ({
|
||||||
type: "spotlight-landscape",
|
type: "spotlight-landscape",
|
||||||
spotlight,
|
spotlight,
|
||||||
grid,
|
grid,
|
||||||
}));
|
}),
|
||||||
|
);
|
||||||
|
|
||||||
private readonly spotlightPortraitLayout: Observable<LayoutMedia> =
|
private readonly spotlightPortraitLayout: Observable<LayoutMedia> =
|
||||||
combineLatest([this.grid, this.spotlight], (grid, spotlight) => ({
|
combineLatest([this.grid, this.spotlight], (grid, spotlight) => ({
|
||||||
@ -839,11 +842,24 @@ export class CallViewModel extends ViewModel {
|
|||||||
|
|
||||||
private readonly oneOnOneLayout: Observable<LayoutMedia> =
|
private readonly oneOnOneLayout: Observable<LayoutMedia> =
|
||||||
this.mediaItems.pipe(
|
this.mediaItems.pipe(
|
||||||
map((grid) => ({
|
map((grid) => {
|
||||||
type: "one-on-one",
|
const local = grid.find((vm) => vm.vm.local)?.vm as
|
||||||
local: grid.find((vm) => vm.vm.local)!.vm as LocalUserMediaViewModel,
|
| LocalUserMediaViewModel
|
||||||
remote: grid.find((vm) => !vm.vm.local)!.vm as RemoteUserMediaViewModel,
|
| undefined;
|
||||||
})),
|
const remote = grid.find((vm) => !vm.vm.local)?.vm as
|
||||||
|
| RemoteUserMediaViewModel
|
||||||
|
| undefined;
|
||||||
|
if (!local || !remote) {
|
||||||
|
throw new Error(
|
||||||
|
"Invalid state: there should be local and remote media for one-on-one layout",
|
||||||
|
);
|
||||||
|
}
|
||||||
|
return {
|
||||||
|
type: "one-on-one",
|
||||||
|
local,
|
||||||
|
remote,
|
||||||
|
};
|
||||||
|
}),
|
||||||
);
|
);
|
||||||
|
|
||||||
private readonly pipLayout: Observable<LayoutMedia> = this.spotlight.pipe(
|
private readonly pipLayout: Observable<LayoutMedia> = this.spotlight.pipe(
|
||||||
|
Loading…
Reference in New Issue
Block a user