diff --git a/src/@types/global.d.ts b/src/@types/global.d.ts index 9c2e7677ed..ddf3f40c62 100644 --- a/src/@types/global.d.ts +++ b/src/@types/global.d.ts @@ -109,7 +109,7 @@ declare global { mxActiveWidgetStore?: ActiveWidgetStore; mxSkinner?: Skinner; mxOnRecaptchaLoaded?: () => void; - electron?: Electron; + electron?: unknown; mxSendSentryReport: (userText: string, issueUrl: string, error: Error) => Promise; mxLoginWithAccessToken: (hsUrl: string, accessToken: string) => Promise; mxAutoRageshakeStore?: AutoRageshakeStore; @@ -130,10 +130,6 @@ declare global { fetchWindowIcons?: boolean; } - interface Electron { - getDesktopCapturerSources(options: GetSourcesOptions): Promise>; - } - interface Document { // Safari & IE11 only have this prefixed: we used prefixed versions // previously so let's continue to support them for now diff --git a/src/BasePlatform.ts b/src/BasePlatform.ts index 4e02325bed..048ed30c06 100644 --- a/src/BasePlatform.ts +++ b/src/BasePlatform.ts @@ -301,6 +301,14 @@ export default abstract class BasePlatform { return null; } + async getDesktopCapturerSources(options: GetSourcesOptions): Promise> { + return []; + } + + supportsDesktopCapturer(): boolean { + return false; + } + getAvailableSpellCheckLanguages(): Promise | null { return null; } diff --git a/src/components/views/elements/DesktopCapturerSourcePicker.tsx b/src/components/views/elements/DesktopCapturerSourcePicker.tsx index 6c5dbca659..57bf24b777 100644 --- a/src/components/views/elements/DesktopCapturerSourcePicker.tsx +++ b/src/components/views/elements/DesktopCapturerSourcePicker.tsx @@ -23,6 +23,7 @@ import DialogButtons from "./DialogButtons"; import AccessibleButton from './AccessibleButton'; import { replaceableComponent } from "../../../utils/replaceableComponent"; import TabbedView, { Tab, TabLocation } from '../../structures/TabbedView'; +import PlatformPeg from "../../../PlatformPeg"; export function getDesktopCapturerSources(): Promise> { const options: GetSourcesOptions = { @@ -35,7 +36,7 @@ export function getDesktopCapturerSources(): Promise { if (this.state.screensharing) { isScreensharing = await this.props.call.setScreensharingEnabled(false); } else { - if (window.electron?.getDesktopCapturerSources) { + if (PlatformPeg.get().supportsDesktopCapturer()) { const { finished } = Modal.createDialog(DesktopCapturerSourcePicker); const [source] = await finished; if (!source) return;