Skip to content

Commit

Permalink
Conform more of the codebase to strictNullChecks & noImplicitAny (#25680
Browse files Browse the repository at this point in the history
)
  • Loading branch information
t3chguy authored Jun 28, 2023
1 parent 6bbc2b8 commit 0299aef
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 8 deletions.
43 changes: 37 additions & 6 deletions src/vector/jitsi/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,40 @@ import type {
AudioMuteStatusChangedEvent,
LogEvent,
VideoMuteStatusChangedEvent,
ExternalAPIOptions as _ExternalAPIOptions,
Config as _Config,
InterfaceConfig as _InterfaceConfig,
} from "jitsi-meet";
import { getVectorConfig } from "../getconfig";

interface Config extends _Config {
// Jitsi's types are missing these fields
prejoinConfig?: {
enabled: boolean;
hideDisplayName?: boolean;
hideExtraJoinButtons?: string[];
};
toolbarButtons?: string[];
conferenceInfo?: {
alwaysVIsible?: string[];
autoHide?: string[];
};
disableSelfViewSettings?: boolean;
}

interface InterfaceConfig extends _InterfaceConfig {
// XXX: It is unclear whether this is a typo of TOOLBAR_BUTTONS or if its just really undocumented,
// either way it is missing in types, yet we try and use it
MAIN_TOOLBAR_BUTTONS?: string[];
}

interface ExternalAPIOptions extends _ExternalAPIOptions {
configOverwrite?: Config;
interfaceConfigOverwrite?: InterfaceConfig;
// Jitsi's types are missing these fields
lang?: string;
}

// We have to trick webpack into loading our CSS for us.
require("./index.pcss");

Expand Down Expand Up @@ -382,7 +413,7 @@ async function joinConference(audioInput?: string | null, videoInput?: string |
"our fragment values and not recognizing the options.",
);

const options = {
const options: ExternalAPIOptions = {
width: "100%",
height: "100%",
parentNode: document.querySelector("#jitsiContainer") ?? undefined,
Expand Down Expand Up @@ -421,20 +452,20 @@ async function joinConference(audioInput?: string | null, videoInput?: string |
if (isVideoChannel) {
// Ensure that we skip Jitsi Meet's native prejoin screen, for
// deployments that have it enabled
options.configOverwrite.prejoinConfig = { enabled: false };
options.configOverwrite!.prejoinConfig = { enabled: false };
// Use a simplified set of toolbar buttons
options.configOverwrite.toolbarButtons = ["microphone", "camera", "tileview", "hangup"];
options.configOverwrite!.toolbarButtons = ["microphone", "camera", "tileview", "hangup"];
// Note: We can hide the screenshare button in video rooms but not in
// normal conference calls, since in video rooms we control exactly what
// set of controls appear, but in normal calls we need to leave that up
// to the deployment's configuration.
// https:/vector-im/element-web/issues/4880#issuecomment-940002464
if (supportsScreensharing) options.configOverwrite.toolbarButtons.splice(2, 0, "desktop");
if (supportsScreensharing) options.configOverwrite!.toolbarButtons.splice(2, 0, "desktop");
// Hide all top bar elements
options.configOverwrite.conferenceInfo = { autoHide: [] };
options.configOverwrite!.conferenceInfo = { autoHide: [] };
// Remove the ability to hide your own tile, since we're hiding the
// settings button which would be the only way to get it back
options.configOverwrite.disableSelfViewSettings = true;
options.configOverwrite!.disableSelfViewSettings = true;
}

meetApi = new JitsiMeetExternalAPI(jitsiDomain, options);
Expand Down
4 changes: 2 additions & 2 deletions test/app-tests/loading-test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -460,8 +460,8 @@ describe("loading:", function () {
httpBackend.verifyNoOutstandingExpectation();
expect(matrixChat?.container.querySelector(".mx_Welcome")).toBeTruthy();
expect(windowLocation?.hash).toEqual("#/welcome");
expect(MatrixClientPeg.get().baseUrl).toEqual(DEFAULT_HS_URL);
expect(MatrixClientPeg.get().idBaseUrl).toEqual(DEFAULT_IS_URL);
expect(MatrixClientPeg.safeGet().baseUrl).toEqual(DEFAULT_HS_URL);
expect(MatrixClientPeg.safeGet().idBaseUrl).toEqual(DEFAULT_IS_URL);
});
});

Expand Down

0 comments on commit 0299aef

Please sign in to comment.