diff --git a/src/@types/global.d.ts b/src/@types/global.d.ts index 5047aeeed5e..0145673ec98 100644 --- a/src/@types/global.d.ts +++ b/src/@types/global.d.ts @@ -32,7 +32,8 @@ type ElectronChannel = | "setBadgeCount" | "update-downloaded" | "userDownloadCompleted" - | "userDownloadAction"; + | "userDownloadAction" + | "openDesktopCapturerSourcePicker"; declare global { interface Window { diff --git a/src/vector/platform/ElectronPlatform.tsx b/src/vector/platform/ElectronPlatform.tsx index b18b1abe4ec..605fab9cbab 100644 --- a/src/vector/platform/ElectronPlatform.tsx +++ b/src/vector/platform/ElectronPlatform.tsx @@ -43,6 +43,7 @@ import { MatrixEvent } from "matrix-js-sdk/src/models/event"; import { BreadcrumbsStore } from "matrix-react-sdk/src/stores/BreadcrumbsStore"; import { UPDATE_EVENT } from "matrix-react-sdk/src/stores/AsyncStore"; import { avatarUrlForRoom, getInitialLetter } from "matrix-react-sdk/src/Avatar"; +import DesktopCapturerSourcePicker from "matrix-react-sdk/src/components/views/elements/DesktopCapturerSourcePicker"; import VectorBasePlatform from "./VectorBasePlatform"; import { SeshatIndexManager } from "./SeshatIndexManager"; @@ -163,6 +164,14 @@ export default class ElectronPlatform extends VectorBasePlatform { }); }); + window.electron.on("openDesktopCapturerSourcePicker", async () => { + const { finished } = Modal.createDialog(DesktopCapturerSourcePicker); + const [source] = await finished; + if (!source) return; + + this.ipc.call("callDisplayMediaCallback", source) + }) + this.ipc.call("startSSOFlow", this.ssoID); BreadcrumbsStore.instance.on(UPDATE_EVENT, this.onBreadcrumbsUpdate); @@ -417,13 +426,13 @@ export default class ElectronPlatform extends VectorBasePlatform { public async destroyPickleKey(userId: string, deviceId: string): Promise { try { await this.ipc.call("destroyPickleKey", userId, deviceId); - } catch (e) {} + } catch (e) { } } public async clearStorage(): Promise { try { await super.clearStorage(); await this.ipc.call("clearStorage"); - } catch (e) {} + } catch (e) { } } }