Remove more usages of singleton store getter in favour of contexts (#34099)
* Expose SDKContextClass via window for debugging * Remove stores from window if they are exposed via sdkContext * Avoid usages of global store instance where React context is accessible * Remove more usages of singleton store getter in favour of contexts * Remove more usages of singleton store getter in favour of contexts * Fix tests by adding SDKContext.Provider * Fix tests by adding SDKContext.Provider * Fix tests by adding SDKContext.Provider * Fix tests by adding SDKContext.Provider * Fix tests * Fix tests * Fix tests * Iterate * Fix bad merge * Iterate * Fix tests * Iterate * Iterate * Iterate * Iterate * Iterate * Improve coverage * Improve coverage
This commit is contained in:
@@ -9,12 +9,12 @@ Please see LICENSE files in the repository root for full details.
|
||||
import { type CallType } from "matrix-js-sdk/src/webrtc/call";
|
||||
import { type Room } from "matrix-js-sdk/src/matrix";
|
||||
|
||||
import type LegacyCallHandler from "../../LegacyCallHandler";
|
||||
import { getPlatformCallTypeProps, PlatformCallType } from "../../hooks/room/useRoomCall";
|
||||
import defaultDispatcher from "../../dispatcher/dispatcher";
|
||||
import { type ViewRoomPayload } from "../../dispatcher/payloads/ViewRoomPayload";
|
||||
import { Action } from "../../dispatcher/actions";
|
||||
import PosthogTrackers from "../../PosthogTrackers";
|
||||
import { SDKContextClass } from "../../contexts/SDKContextClass.ts";
|
||||
|
||||
/**
|
||||
* Helper to place a call in a room that works with all the legacy modes
|
||||
@@ -24,6 +24,7 @@ import { SDKContextClass } from "../../contexts/SDKContextClass.ts";
|
||||
* @param skipLobby Has the user indicated they would like to skip the lobby. Otherwise, defer to platform defaults.
|
||||
*/
|
||||
export const placeCall = async (
|
||||
legacyCallHandler: LegacyCallHandler,
|
||||
room: Room,
|
||||
callType: CallType,
|
||||
platformCallType: PlatformCallType,
|
||||
@@ -34,7 +35,7 @@ export const placeCall = async (
|
||||
PosthogTrackers.trackInteraction(analyticsName);
|
||||
|
||||
if (platformCallType == PlatformCallType.LegacyCall || platformCallType == PlatformCallType.JitsiCall) {
|
||||
await SDKContextClass.instance.legacyCallHandler.placeCall(room.roomId, callType);
|
||||
await legacyCallHandler.placeCall(room.roomId, callType);
|
||||
} else if (platformCallType == PlatformCallType.ElementCall) {
|
||||
defaultDispatcher.dispatch<ViewRoomPayload>({
|
||||
action: Action.ViewRoom,
|
||||
|
||||
Reference in New Issue
Block a user