2023-04-20 21:23:19 +00:00
|
|
|
// Copyright 2023 Signal Messenger, LLC
|
|
|
|
// SPDX-License-Identifier: AGPL-3.0-only
|
|
|
|
|
|
|
|
import React from 'react';
|
|
|
|
import ReactDOM from 'react-dom';
|
|
|
|
|
|
|
|
import { CallingScreenSharingController } from '../../components/CallingScreenSharingController';
|
|
|
|
import { i18n } from '../sandboxedInit';
|
|
|
|
import { strictAssert } from '../../util/assert';
|
2024-05-06 21:48:31 +00:00
|
|
|
import { drop } from '../../util/drop';
|
2024-04-17 17:53:54 +00:00
|
|
|
import { parseEnvironment, setEnvironment } from '../../environment';
|
2023-04-20 21:23:19 +00:00
|
|
|
|
|
|
|
const { ScreenShareWindowProps } = window.Signal;
|
|
|
|
|
|
|
|
strictAssert(ScreenShareWindowProps, 'window values not provided');
|
|
|
|
|
2024-04-17 17:53:54 +00:00
|
|
|
setEnvironment(
|
|
|
|
parseEnvironment(window.SignalContext.getEnvironment()),
|
|
|
|
window.SignalContext.isTestOrMockEnvironment()
|
|
|
|
);
|
|
|
|
|
2024-05-06 21:48:31 +00:00
|
|
|
function onCloseController(): void {
|
|
|
|
drop(window.SignalContext.executeMenuRole('close'));
|
|
|
|
}
|
|
|
|
|
|
|
|
function render() {
|
|
|
|
// Pacify typescript
|
|
|
|
strictAssert(ScreenShareWindowProps, 'window values not provided');
|
|
|
|
|
|
|
|
ReactDOM.render(
|
|
|
|
<div className="App dark-theme">
|
|
|
|
<CallingScreenSharingController
|
|
|
|
i18n={i18n}
|
|
|
|
onCloseController={onCloseController}
|
|
|
|
onStopSharing={ScreenShareWindowProps.onStopSharing}
|
|
|
|
status={ScreenShareWindowProps.getStatus()}
|
|
|
|
presentedSourceName={ScreenShareWindowProps.presentedSourceName}
|
|
|
|
/>
|
|
|
|
</div>,
|
|
|
|
|
|
|
|
document.getElementById('app')
|
|
|
|
);
|
|
|
|
}
|
|
|
|
render();
|
|
|
|
ScreenShareWindowProps.setRenderCallback(render);
|