mirror of
https://github.com/signalapp/Signal-Desktop.git
synced 2025-12-20 02:08:57 +00:00
Delay provisioner socket connection
This commit is contained in:
37
app/main.ts
37
app/main.ts
@@ -690,6 +690,21 @@ async function createWindow() {
|
||||
? Math.min(windowConfig.height, maxHeight)
|
||||
: DEFAULT_HEIGHT;
|
||||
|
||||
const [systemTraySetting, backgroundColor, spellcheck] = await Promise.all([
|
||||
systemTraySettingCache.get(),
|
||||
isTestEnvironment(getEnvironment())
|
||||
? '#ffffff' // Tests should always be rendered on a white background
|
||||
: getBackgroundColor({ signalColors: true }),
|
||||
getSpellCheckSetting(),
|
||||
]);
|
||||
|
||||
const startInTray =
|
||||
isTestEnvironment(getEnvironment()) ||
|
||||
systemTraySetting === SystemTraySetting.MinimizeToAndStartInSystemTray;
|
||||
|
||||
const shouldShowWindow =
|
||||
!app.getLoginItemSettings().wasOpenedAsHidden && !startInTray;
|
||||
|
||||
const windowOptions: Electron.BrowserWindowConstructorOptions = {
|
||||
show: false,
|
||||
width,
|
||||
@@ -698,9 +713,7 @@ async function createWindow() {
|
||||
minHeight: MIN_HEIGHT,
|
||||
autoHideMenuBar: false,
|
||||
titleBarStyle: mainTitleBarStyle,
|
||||
backgroundColor: isTestEnvironment(getEnvironment())
|
||||
? '#ffffff' // Tests should always be rendered on a white background
|
||||
: await getBackgroundColor({ signalColors: true }),
|
||||
backgroundColor,
|
||||
webPreferences: {
|
||||
...defaultWebPrefs,
|
||||
nodeIntegration: false,
|
||||
@@ -713,7 +726,7 @@ async function createWindow() {
|
||||
? '../preload.wrapper.js'
|
||||
: '../ts/windows/main/preload.js'
|
||||
),
|
||||
spellcheck: await getSpellCheckSetting(),
|
||||
spellcheck,
|
||||
backgroundThrottling: true,
|
||||
disableBlinkFeatures: 'Accelerated2dCanvas,AcceleratedSmallCanvases',
|
||||
},
|
||||
@@ -731,11 +744,6 @@ async function createWindow() {
|
||||
delete windowOptions.autoHideMenuBar;
|
||||
}
|
||||
|
||||
const startInTray =
|
||||
isTestEnvironment(getEnvironment()) ||
|
||||
(await systemTraySettingCache.get()) ===
|
||||
SystemTraySetting.MinimizeToAndStartInSystemTray;
|
||||
|
||||
const haveFullWindowsBounds =
|
||||
isNumber(windowOptions.x) &&
|
||||
isNumber(windowOptions.y) &&
|
||||
@@ -997,6 +1005,12 @@ async function createWindow() {
|
||||
}
|
||||
});
|
||||
|
||||
mainWindow.webContents.on('devtools-reload-page', () => {
|
||||
mainWindow?.webContents.on('dom-ready', () => {
|
||||
mainWindow?.webContents.send('activate');
|
||||
});
|
||||
});
|
||||
|
||||
mainWindow.once('ready-to-show', async () => {
|
||||
getLogger().info('main window is ready-to-show');
|
||||
|
||||
@@ -1009,11 +1023,9 @@ async function createWindow() {
|
||||
|
||||
mainWindow.webContents.send('ci:event', 'db-initialized', {});
|
||||
|
||||
const shouldShowWindow =
|
||||
!app.getLoginItemSettings().wasOpenedAsHidden && !startInTray;
|
||||
|
||||
if (shouldShowWindow) {
|
||||
getLogger().info('showing main window');
|
||||
mainWindow.webContents.send('activate');
|
||||
mainWindow.show();
|
||||
}
|
||||
});
|
||||
@@ -2554,6 +2566,7 @@ app.on('activate', () => {
|
||||
// On OS X it's common to re-create a window in the app when the
|
||||
// dock icon is clicked and there are no other windows open.
|
||||
if (mainWindow) {
|
||||
mainWindow.webContents.send('activate');
|
||||
mainWindow.show();
|
||||
} else {
|
||||
drop(createWindow());
|
||||
|
||||
@@ -103,6 +103,7 @@
|
||||
<link href="stylesheets/manifest.css" rel="stylesheet" type="text/css" />
|
||||
</head>
|
||||
<body class="overflow-hidden">
|
||||
<!-- Match ts/components/App.tsx -->
|
||||
<div id="app-container">
|
||||
<div class="app-loading-screen app-loading-screen--before-app-load">
|
||||
<div class="module-title-bar-drag-area"></div>
|
||||
|
||||
@@ -1546,7 +1546,15 @@ export async function startApp(): Promise<void> {
|
||||
}
|
||||
} else {
|
||||
window.IPC.readyForUpdates();
|
||||
window.reduxActions.installer.startInstaller();
|
||||
drop(
|
||||
(async () => {
|
||||
try {
|
||||
await window.IPC.whenWindowVisible();
|
||||
} finally {
|
||||
window.reduxActions.installer.startInstaller();
|
||||
}
|
||||
})()
|
||||
);
|
||||
}
|
||||
|
||||
const { activeWindowService } = window.SignalContext;
|
||||
|
||||
@@ -89,7 +89,20 @@ export function App({
|
||||
} else if (state.appView === AppViewType.Inbox) {
|
||||
contents = renderInbox();
|
||||
} else if (state.appView === AppViewType.Blank) {
|
||||
contents = undefined;
|
||||
// See `background.html`
|
||||
contents = (
|
||||
<div className="app-loading-screen app-loading-screen--before-app-load">
|
||||
<div className="module-title-bar-drag-area" />
|
||||
|
||||
<div className="module-splash-screen__logo module-splash-screen__logo--128" />
|
||||
<div className="dot-container">
|
||||
<span className="dot" />
|
||||
<span className="dot" />
|
||||
<span className="dot" />
|
||||
</div>
|
||||
<div className="message-placeholder" />
|
||||
</div>
|
||||
);
|
||||
} else {
|
||||
throw missingCaseError(state.appView);
|
||||
}
|
||||
|
||||
1
ts/window.d.ts
vendored
1
ts/window.d.ts
vendored
@@ -75,6 +75,7 @@ export type IPCType = {
|
||||
mediaType: 'microphone' | 'camera' | 'screenCapture'
|
||||
) => Promise<void>;
|
||||
getMediaPermissions: () => Promise<boolean>;
|
||||
whenWindowVisible: () => Promise<void>;
|
||||
logAppLoadedEvent?: (options: { processedCount?: number }) => void;
|
||||
readyForUpdates: () => void;
|
||||
removeSetupMenuItems: () => unknown;
|
||||
|
||||
@@ -17,6 +17,7 @@ import * as Errors from '../../types/errors';
|
||||
|
||||
import { strictAssert } from '../../util/assert';
|
||||
import { drop } from '../../util/drop';
|
||||
import { explodePromise } from '../../util/explodePromise';
|
||||
import { DataReader } from '../../sql/Client';
|
||||
import type { WindowsNotificationData } from '../../services/notifications';
|
||||
import { AggregatedStats } from '../../textsecure/WebsocketResources';
|
||||
@@ -144,6 +145,7 @@ const IPC: IPCType = {
|
||||
ipc.send('title-bar-double-click');
|
||||
},
|
||||
updateTrayIcon: unreadCount => ipc.send('update-tray-icon', unreadCount),
|
||||
whenWindowVisible,
|
||||
};
|
||||
|
||||
window.IPC = IPC;
|
||||
@@ -450,3 +452,14 @@ ipc.on(
|
||||
event.sender.send('art-creator:uploadStickerPack:done', packId);
|
||||
}
|
||||
);
|
||||
|
||||
const { promise: windowVisible, resolve: resolveWindowVisible } =
|
||||
explodePromise<void>();
|
||||
|
||||
ipc.on('activate', () => {
|
||||
resolveWindowVisible();
|
||||
});
|
||||
|
||||
async function whenWindowVisible(): Promise<void> {
|
||||
await windowVisible;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user