From aa4a00c60e8c2e5952e90c79ef2726c932042bc2 Mon Sep 17 00:00:00 2001 From: Robin Townsend Date: Mon, 11 Jul 2022 15:07:53 -0400 Subject: [PATCH 1/2] Hide screenshare button in video rooms on Desktop --- src/BasePlatform.ts | 4 ++++ src/utils/WidgetUtils.ts | 2 ++ 2 files changed, 6 insertions(+) diff --git a/src/BasePlatform.ts b/src/BasePlatform.ts index 232b44d7c96..2a0061836d5 100644 --- a/src/BasePlatform.ts +++ b/src/BasePlatform.ts @@ -288,6 +288,10 @@ export default abstract class BasePlatform { return false; } + public supportsJitsiScreensharing(): boolean { + return true; + } + public overrideBrowserShortcuts(): boolean { return false; } diff --git a/src/utils/WidgetUtils.ts b/src/utils/WidgetUtils.ts index ee4f97ff45f..60b71e5f655 100644 --- a/src/utils/WidgetUtils.ts +++ b/src/utils/WidgetUtils.ts @@ -26,6 +26,7 @@ import { CallType } from "matrix-js-sdk/src/webrtc/call"; import { randomString, randomLowercaseString, randomUppercaseString } from "matrix-js-sdk/src/randomstring"; import { MatrixClientPeg } from '../MatrixClientPeg'; +import PlatformPeg from '../PlatformPeg'; import SdkConfig from "../SdkConfig"; import dis from '../dispatcher/dispatcher'; import WidgetEchoStore from '../stores/WidgetEchoStore'; @@ -510,6 +511,7 @@ export default class WidgetUtils { 'roomId=$matrix_room_id', 'theme=$theme', 'roomName=$roomName', + `supportsScreensharing=${PlatformPeg.get().supportsJitsiScreensharing()}`, ]; if (opts.auth) { queryStringParts.push(`auth=${opts.auth}`); From 7bb7ca7758a4f0e41ce845198d3ba01bb129eb23 Mon Sep 17 00:00:00 2001 From: Robin Townsend Date: Mon, 11 Jul 2022 15:29:22 -0400 Subject: [PATCH 2/2] Fix tests --- test/createRoom-test.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/test/createRoom-test.ts b/test/createRoom-test.ts index 5143db0d700..75d79c24808 100644 --- a/test/createRoom-test.ts +++ b/test/createRoom-test.ts @@ -19,7 +19,7 @@ import { MatrixClient } from "matrix-js-sdk/src/matrix"; import { IDevice } from "matrix-js-sdk/src/crypto/deviceinfo"; import { RoomType } from "matrix-js-sdk/src/@types/event"; -import { stubClient, setupAsyncStoreWithClient } from "./test-utils"; +import { stubClient, setupAsyncStoreWithClient, mockPlatformPeg } from "./test-utils"; import { MatrixClientPeg } from "../src/MatrixClientPeg"; import WidgetStore from "../src/stores/WidgetStore"; import WidgetUtils from "../src/utils/WidgetUtils"; @@ -27,12 +27,16 @@ import { VIDEO_CHANNEL_MEMBER } from "../src/utils/VideoChannelUtils"; import createRoom, { canEncryptToAllUsers } from '../src/createRoom'; describe("createRoom", () => { + mockPlatformPeg(); + let client: MatrixClient; beforeEach(() => { stubClient(); client = MatrixClientPeg.get(); }); + afterEach(() => jest.clearAllMocks()); + it("sets up video rooms correctly", async () => { setupAsyncStoreWithClient(WidgetStore.instance, client); jest.spyOn(WidgetUtils, "waitForRoomWidget").mockResolvedValue();