convert CallViewModel into create function pattern. (with much more
minimal changes thanks to the intermediate class refactor)
This commit is contained in:
@@ -59,7 +59,8 @@ import { type MatrixInfo } from "./VideoPreview";
|
|||||||
import { InviteButton } from "../button/InviteButton";
|
import { InviteButton } from "../button/InviteButton";
|
||||||
import { LayoutToggle } from "./LayoutToggle";
|
import { LayoutToggle } from "./LayoutToggle";
|
||||||
import {
|
import {
|
||||||
CallViewModel,
|
type CallViewModel,
|
||||||
|
createCallViewModel$,
|
||||||
type GridMode,
|
type GridMode,
|
||||||
} from "../state/CallViewModel/CallViewModel.ts";
|
} from "../state/CallViewModel/CallViewModel.ts";
|
||||||
import { Grid, type TileProps } from "../grid/Grid";
|
import { Grid, type TileProps } from "../grid/Grid";
|
||||||
@@ -128,7 +129,7 @@ export const ActiveCall: FC<ActiveCallProps> = (props) => {
|
|||||||
const reactionsReader = new ReactionsReader(scope, props.rtcSession);
|
const reactionsReader = new ReactionsReader(scope, props.rtcSession);
|
||||||
const { autoLeaveWhenOthersLeft, waitForCallPickup, sendNotificationType } =
|
const { autoLeaveWhenOthersLeft, waitForCallPickup, sendNotificationType } =
|
||||||
urlParams;
|
urlParams;
|
||||||
const vm = new CallViewModel(
|
const vm = createCallViewModel$(
|
||||||
scope,
|
scope,
|
||||||
props.rtcSession,
|
props.rtcSession,
|
||||||
props.matrixRoom,
|
props.matrixRoom,
|
||||||
|
|||||||
@@ -37,7 +37,7 @@ import {
|
|||||||
import { deepCompare } from "matrix-js-sdk/lib/utils";
|
import { deepCompare } from "matrix-js-sdk/lib/utils";
|
||||||
import { AutoDiscovery } from "matrix-js-sdk/lib/autodiscovery";
|
import { AutoDiscovery } from "matrix-js-sdk/lib/autodiscovery";
|
||||||
|
|
||||||
import { CallViewModel } from "./CallViewModel";
|
import { createCallViewModel$ } from "./CallViewModel";
|
||||||
import { type Layout } from "../layout-types.ts";
|
import { type Layout } from "../layout-types.ts";
|
||||||
import {
|
import {
|
||||||
mockLocalParticipant,
|
mockLocalParticipant,
|
||||||
@@ -277,7 +277,7 @@ describe("CallViewModel", () => {
|
|||||||
|
|
||||||
vi.spyOn(AutoDiscovery, "getRawClientConfig").mockResolvedValue({});
|
vi.spyOn(AutoDiscovery, "getRawClientConfig").mockResolvedValue({});
|
||||||
|
|
||||||
const callVM = new CallViewModel(
|
const callVM = createCallViewModel$(
|
||||||
testScope(),
|
testScope(),
|
||||||
fakeRtcSession.asMockedSession(),
|
fakeRtcSession.asMockedSession(),
|
||||||
matrixRoom,
|
matrixRoom,
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@@ -24,7 +24,11 @@ import * as ComponentsCore from "@livekit/components-core";
|
|||||||
import type { CallMembership } from "matrix-js-sdk/lib/matrixrtc";
|
import type { CallMembership } from "matrix-js-sdk/lib/matrixrtc";
|
||||||
import { E2eeType } from "../../e2ee/e2eeType";
|
import { E2eeType } from "../../e2ee/e2eeType";
|
||||||
import { type RaisedHandInfo, type ReactionInfo } from "../../reactions";
|
import { type RaisedHandInfo, type ReactionInfo } from "../../reactions";
|
||||||
import { CallViewModel, type CallViewModelOptions } from "./CallViewModel";
|
import {
|
||||||
|
type CallViewModel,
|
||||||
|
createCallViewModel$,
|
||||||
|
type CallViewModelOptions,
|
||||||
|
} from "./CallViewModel";
|
||||||
import {
|
import {
|
||||||
mockConfig,
|
mockConfig,
|
||||||
mockLivekitRoom,
|
mockLivekitRoom,
|
||||||
@@ -154,7 +158,7 @@ export function withCallViewModel(
|
|||||||
const raisedHands$ = new BehaviorSubject<Record<string, RaisedHandInfo>>({});
|
const raisedHands$ = new BehaviorSubject<Record<string, RaisedHandInfo>>({});
|
||||||
const reactions$ = new BehaviorSubject<Record<string, ReactionInfo>>({});
|
const reactions$ = new BehaviorSubject<Record<string, ReactionInfo>>({});
|
||||||
|
|
||||||
const vm = new CallViewModel(
|
const vm = createCallViewModel$(
|
||||||
testScope(),
|
testScope(),
|
||||||
rtcSession.asMockedSession(),
|
rtcSession.asMockedSession(),
|
||||||
room,
|
room,
|
||||||
|
|||||||
@@ -20,7 +20,8 @@ import { ConnectionState, type Room as LivekitRoom } from "livekit-client";
|
|||||||
|
|
||||||
import { E2eeType } from "../e2ee/e2eeType";
|
import { E2eeType } from "../e2ee/e2eeType";
|
||||||
import {
|
import {
|
||||||
CallViewModel,
|
type CallViewModel,
|
||||||
|
createCallViewModel$,
|
||||||
type CallViewModelOptions,
|
type CallViewModelOptions,
|
||||||
} from "../state/CallViewModel/CallViewModel";
|
} from "../state/CallViewModel/CallViewModel";
|
||||||
import {
|
import {
|
||||||
@@ -145,7 +146,7 @@ export function getBasicCallViewModelEnvironment(
|
|||||||
|
|
||||||
// const remoteParticipants$ = of([aliceParticipant]);
|
// const remoteParticipants$ = of([aliceParticipant]);
|
||||||
|
|
||||||
const vm = new CallViewModel(
|
const vm = createCallViewModel$(
|
||||||
testScope(),
|
testScope(),
|
||||||
rtcSession.asMockedSession(),
|
rtcSession.asMockedSession(),
|
||||||
matrixRoom,
|
matrixRoom,
|
||||||
|
|||||||
Reference in New Issue
Block a user