2022-06-23 19:15:27 +00:00
|
|
|
// Copyright 2018-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';
|
2022-06-08 22:00:32 +00:00
|
|
|
import { contextBridge } from 'electron';
|
2021-09-16 15:52:56 +00:00
|
|
|
|
2021-10-07 23:28:47 +00:00
|
|
|
import { SignalContext } from '../context';
|
2021-09-16 15:52:56 +00:00
|
|
|
import { About } from '../../components/About';
|
|
|
|
|
2021-10-07 23:28:47 +00:00
|
|
|
contextBridge.exposeInMainWorld('SignalContext', {
|
|
|
|
...SignalContext,
|
2021-09-16 15:52:56 +00:00
|
|
|
renderWindow: () => {
|
2021-10-07 23:28:47 +00:00
|
|
|
const environmentText: Array<string> = [SignalContext.getEnvironment()];
|
2021-09-16 15:52:56 +00:00
|
|
|
|
2021-10-07 23:28:47 +00:00
|
|
|
const appInstance = SignalContext.getAppInstance();
|
2021-09-16 15:52:56 +00:00
|
|
|
if (appInstance) {
|
|
|
|
environmentText.push(appInstance);
|
|
|
|
}
|
|
|
|
|
2021-12-13 23:04:29 +00:00
|
|
|
let platform = '';
|
|
|
|
if (process.platform === 'darwin') {
|
|
|
|
if (process.arch === 'arm64') {
|
|
|
|
platform = ' (M1)';
|
|
|
|
} else {
|
|
|
|
platform = ' (Intel)';
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-09-16 15:52:56 +00:00
|
|
|
ReactDOM.render(
|
|
|
|
React.createElement(About, {
|
2022-06-08 22:00:32 +00:00
|
|
|
closeAbout: () => SignalContext.executeMenuRole('close'),
|
2021-12-13 23:04:29 +00:00
|
|
|
environment: `${environmentText.join(' - ')}${platform}`,
|
2021-10-07 23:28:47 +00:00
|
|
|
i18n: SignalContext.i18n,
|
|
|
|
version: SignalContext.getVersion(),
|
2022-07-05 16:44:53 +00:00
|
|
|
hasCustomTitleBar: SignalContext.OS.hasCustomTitleBar(),
|
2022-06-08 22:00:32 +00:00
|
|
|
executeMenuRole: SignalContext.executeMenuRole,
|
2021-09-16 15:52:56 +00:00
|
|
|
}),
|
|
|
|
document.getElementById('app')
|
|
|
|
);
|
|
|
|
},
|
|
|
|
});
|