2022-06-23 19:15:27 +00:00
|
|
|
// Copyright 2021-2022 Signal Messenger, LLC
|
2021-09-16 15:52:56 +00:00
|
|
|
// SPDX-License-Identifier: AGPL-3.0-only
|
|
|
|
|
2022-06-23 19:15:27 +00:00
|
|
|
// This has to be the first import because of monkey-patching
|
|
|
|
import '../shims';
|
|
|
|
|
2021-09-16 15:52:56 +00:00
|
|
|
import React from 'react';
|
|
|
|
import ReactDOM from 'react-dom';
|
|
|
|
import { contextBridge, ipcRenderer } from 'electron';
|
|
|
|
|
2021-10-07 23:28:47 +00:00
|
|
|
import { SignalContext } from '../context';
|
2021-09-16 15:52:56 +00:00
|
|
|
import { CallingScreenSharingController } from '../../components/CallingScreenSharingController';
|
|
|
|
|
2021-10-07 23:28:47 +00:00
|
|
|
contextBridge.exposeInMainWorld('SignalContext', SignalContext);
|
2021-09-16 15:52:56 +00:00
|
|
|
|
|
|
|
function renderScreenSharingController(presentedSourceName: string): void {
|
|
|
|
ReactDOM.render(
|
|
|
|
React.createElement(CallingScreenSharingController, {
|
2022-06-08 22:00:32 +00:00
|
|
|
platform: process.platform,
|
|
|
|
executeMenuRole: SignalContext.executeMenuRole,
|
2021-10-07 23:28:47 +00:00
|
|
|
i18n: SignalContext.i18n,
|
2022-06-08 22:00:32 +00:00
|
|
|
onCloseController: () => SignalContext.executeMenuRole('close'),
|
2021-09-16 15:52:56 +00:00
|
|
|
onStopSharing: () => ipcRenderer.send('stop-screen-share'),
|
|
|
|
presentedSourceName,
|
|
|
|
}),
|
|
|
|
document.getElementById('app')
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
ipcRenderer.once('render-screen-sharing-controller', (_, name: string) => {
|
|
|
|
renderScreenSharingController(name);
|
|
|
|
});
|