Hide screenshare button in video rooms on Desktop (#9045)

* Hide screenshare button in video rooms on Desktop

* Fix tests
This commit is contained in:
Robin 2022-07-12 08:23:35 -04:00 committed by GitHub
parent e576347b62
commit 4dd74261b5
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 11 additions and 1 deletions

View file

@ -288,6 +288,10 @@ export default abstract class BasePlatform {
return false;
}
public supportsJitsiScreensharing(): boolean {
return true;
}
public overrideBrowserShortcuts(): boolean {
return false;
}

View file

@ -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}`);

View file

@ -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();