2022-06-23 12:15:27 -07:00
|
|
|
// Copyright 2018-2022 Signal Messenger, LLC
|
2021-09-16 11:52:56 -04:00
|
|
|
// SPDX-License-Identifier: AGPL-3.0-only
|
|
|
|
|
2022-06-23 12:15:27 -07:00
|
|
|
// This has to be the first import because of monkey-patching
|
|
|
|
import '../shims';
|
|
|
|
|
2021-09-16 11:52:56 -04:00
|
|
|
import React from 'react';
|
|
|
|
import ReactDOM from 'react-dom';
|
2022-06-08 15:00:32 -07:00
|
|
|
import { contextBridge } from 'electron';
|
2021-09-16 11:52:56 -04:00
|
|
|
|
2021-10-07 19:28:47 -04:00
|
|
|
import { SignalContext } from '../context';
|
2021-09-16 11:52:56 -04:00
|
|
|
import { About } from '../../components/About';
|
|
|
|
|
2021-10-07 19:28:47 -04:00
|
|
|
contextBridge.exposeInMainWorld('SignalContext', {
|
|
|
|
...SignalContext,
|
2021-09-16 11:52:56 -04:00
|
|
|
renderWindow: () => {
|
2021-10-07 19:28:47 -04:00
|
|
|
const environmentText: Array<string> = [SignalContext.getEnvironment()];
|
2021-09-16 11:52:56 -04:00
|
|
|
|
2021-10-07 19:28:47 -04:00
|
|
|
const appInstance = SignalContext.getAppInstance();
|
2021-09-16 11:52:56 -04:00
|
|
|
if (appInstance) {
|
|
|
|
environmentText.push(appInstance);
|
|
|
|
}
|
|
|
|
|
2021-12-14 00:04:29 +01:00
|
|
|
let platform = '';
|
|
|
|
if (process.platform === 'darwin') {
|
|
|
|
if (process.arch === 'arm64') {
|
2022-07-19 07:26:41 -07:00
|
|
|
platform = ` (${SignalContext.i18n('appleSilicon')})`;
|
2021-12-14 00:04:29 +01:00
|
|
|
} else {
|
|
|
|
platform = ' (Intel)';
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-09-16 11:52:56 -04:00
|
|
|
ReactDOM.render(
|
|
|
|
React.createElement(About, {
|
2022-06-08 15:00:32 -07:00
|
|
|
closeAbout: () => SignalContext.executeMenuRole('close'),
|
2021-12-14 00:04:29 +01:00
|
|
|
environment: `${environmentText.join(' - ')}${platform}`,
|
2021-10-07 19:28:47 -04:00
|
|
|
i18n: SignalContext.i18n,
|
|
|
|
version: SignalContext.getVersion(),
|
2022-07-05 09:44:53 -07:00
|
|
|
hasCustomTitleBar: SignalContext.OS.hasCustomTitleBar(),
|
2022-06-08 15:00:32 -07:00
|
|
|
executeMenuRole: SignalContext.executeMenuRole,
|
2021-09-16 11:52:56 -04:00
|
|
|
}),
|
|
|
|
document.getElementById('app')
|
|
|
|
);
|
|
|
|
},
|
|
|
|
});
|