mirror of
https://github.com/signalapp/Signal-Desktop.git
synced 2025-12-24 20:26:24 +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)
|
? Math.min(windowConfig.height, maxHeight)
|
||||||
: DEFAULT_HEIGHT;
|
: 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 = {
|
const windowOptions: Electron.BrowserWindowConstructorOptions = {
|
||||||
show: false,
|
show: false,
|
||||||
width,
|
width,
|
||||||
@@ -698,9 +713,7 @@ async function createWindow() {
|
|||||||
minHeight: MIN_HEIGHT,
|
minHeight: MIN_HEIGHT,
|
||||||
autoHideMenuBar: false,
|
autoHideMenuBar: false,
|
||||||
titleBarStyle: mainTitleBarStyle,
|
titleBarStyle: mainTitleBarStyle,
|
||||||
backgroundColor: isTestEnvironment(getEnvironment())
|
backgroundColor,
|
||||||
? '#ffffff' // Tests should always be rendered on a white background
|
|
||||||
: await getBackgroundColor({ signalColors: true }),
|
|
||||||
webPreferences: {
|
webPreferences: {
|
||||||
...defaultWebPrefs,
|
...defaultWebPrefs,
|
||||||
nodeIntegration: false,
|
nodeIntegration: false,
|
||||||
@@ -713,7 +726,7 @@ async function createWindow() {
|
|||||||
? '../preload.wrapper.js'
|
? '../preload.wrapper.js'
|
||||||
: '../ts/windows/main/preload.js'
|
: '../ts/windows/main/preload.js'
|
||||||
),
|
),
|
||||||
spellcheck: await getSpellCheckSetting(),
|
spellcheck,
|
||||||
backgroundThrottling: true,
|
backgroundThrottling: true,
|
||||||
disableBlinkFeatures: 'Accelerated2dCanvas,AcceleratedSmallCanvases',
|
disableBlinkFeatures: 'Accelerated2dCanvas,AcceleratedSmallCanvases',
|
||||||
},
|
},
|
||||||
@@ -731,11 +744,6 @@ async function createWindow() {
|
|||||||
delete windowOptions.autoHideMenuBar;
|
delete windowOptions.autoHideMenuBar;
|
||||||
}
|
}
|
||||||
|
|
||||||
const startInTray =
|
|
||||||
isTestEnvironment(getEnvironment()) ||
|
|
||||||
(await systemTraySettingCache.get()) ===
|
|
||||||
SystemTraySetting.MinimizeToAndStartInSystemTray;
|
|
||||||
|
|
||||||
const haveFullWindowsBounds =
|
const haveFullWindowsBounds =
|
||||||
isNumber(windowOptions.x) &&
|
isNumber(windowOptions.x) &&
|
||||||
isNumber(windowOptions.y) &&
|
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 () => {
|
mainWindow.once('ready-to-show', async () => {
|
||||||
getLogger().info('main window is ready-to-show');
|
getLogger().info('main window is ready-to-show');
|
||||||
|
|
||||||
@@ -1009,11 +1023,9 @@ async function createWindow() {
|
|||||||
|
|
||||||
mainWindow.webContents.send('ci:event', 'db-initialized', {});
|
mainWindow.webContents.send('ci:event', 'db-initialized', {});
|
||||||
|
|
||||||
const shouldShowWindow =
|
|
||||||
!app.getLoginItemSettings().wasOpenedAsHidden && !startInTray;
|
|
||||||
|
|
||||||
if (shouldShowWindow) {
|
if (shouldShowWindow) {
|
||||||
getLogger().info('showing main window');
|
getLogger().info('showing main window');
|
||||||
|
mainWindow.webContents.send('activate');
|
||||||
mainWindow.show();
|
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
|
// 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.
|
// dock icon is clicked and there are no other windows open.
|
||||||
if (mainWindow) {
|
if (mainWindow) {
|
||||||
|
mainWindow.webContents.send('activate');
|
||||||
mainWindow.show();
|
mainWindow.show();
|
||||||
} else {
|
} else {
|
||||||
drop(createWindow());
|
drop(createWindow());
|
||||||
|
|||||||
@@ -103,6 +103,7 @@
|
|||||||
<link href="stylesheets/manifest.css" rel="stylesheet" type="text/css" />
|
<link href="stylesheets/manifest.css" rel="stylesheet" type="text/css" />
|
||||||
</head>
|
</head>
|
||||||
<body class="overflow-hidden">
|
<body class="overflow-hidden">
|
||||||
|
<!-- Match ts/components/App.tsx -->
|
||||||
<div id="app-container">
|
<div id="app-container">
|
||||||
<div class="app-loading-screen app-loading-screen--before-app-load">
|
<div class="app-loading-screen app-loading-screen--before-app-load">
|
||||||
<div class="module-title-bar-drag-area"></div>
|
<div class="module-title-bar-drag-area"></div>
|
||||||
|
|||||||
@@ -1546,7 +1546,15 @@ export async function startApp(): Promise<void> {
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
window.IPC.readyForUpdates();
|
window.IPC.readyForUpdates();
|
||||||
window.reduxActions.installer.startInstaller();
|
drop(
|
||||||
|
(async () => {
|
||||||
|
try {
|
||||||
|
await window.IPC.whenWindowVisible();
|
||||||
|
} finally {
|
||||||
|
window.reduxActions.installer.startInstaller();
|
||||||
|
}
|
||||||
|
})()
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
const { activeWindowService } = window.SignalContext;
|
const { activeWindowService } = window.SignalContext;
|
||||||
|
|||||||
@@ -89,7 +89,20 @@ export function App({
|
|||||||
} else if (state.appView === AppViewType.Inbox) {
|
} else if (state.appView === AppViewType.Inbox) {
|
||||||
contents = renderInbox();
|
contents = renderInbox();
|
||||||
} else if (state.appView === AppViewType.Blank) {
|
} 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 {
|
} else {
|
||||||
throw missingCaseError(state.appView);
|
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'
|
mediaType: 'microphone' | 'camera' | 'screenCapture'
|
||||||
) => Promise<void>;
|
) => Promise<void>;
|
||||||
getMediaPermissions: () => Promise<boolean>;
|
getMediaPermissions: () => Promise<boolean>;
|
||||||
|
whenWindowVisible: () => Promise<void>;
|
||||||
logAppLoadedEvent?: (options: { processedCount?: number }) => void;
|
logAppLoadedEvent?: (options: { processedCount?: number }) => void;
|
||||||
readyForUpdates: () => void;
|
readyForUpdates: () => void;
|
||||||
removeSetupMenuItems: () => unknown;
|
removeSetupMenuItems: () => unknown;
|
||||||
|
|||||||
@@ -17,6 +17,7 @@ import * as Errors from '../../types/errors';
|
|||||||
|
|
||||||
import { strictAssert } from '../../util/assert';
|
import { strictAssert } from '../../util/assert';
|
||||||
import { drop } from '../../util/drop';
|
import { drop } from '../../util/drop';
|
||||||
|
import { explodePromise } from '../../util/explodePromise';
|
||||||
import { DataReader } from '../../sql/Client';
|
import { DataReader } from '../../sql/Client';
|
||||||
import type { WindowsNotificationData } from '../../services/notifications';
|
import type { WindowsNotificationData } from '../../services/notifications';
|
||||||
import { AggregatedStats } from '../../textsecure/WebsocketResources';
|
import { AggregatedStats } from '../../textsecure/WebsocketResources';
|
||||||
@@ -144,6 +145,7 @@ const IPC: IPCType = {
|
|||||||
ipc.send('title-bar-double-click');
|
ipc.send('title-bar-double-click');
|
||||||
},
|
},
|
||||||
updateTrayIcon: unreadCount => ipc.send('update-tray-icon', unreadCount),
|
updateTrayIcon: unreadCount => ipc.send('update-tray-icon', unreadCount),
|
||||||
|
whenWindowVisible,
|
||||||
};
|
};
|
||||||
|
|
||||||
window.IPC = IPC;
|
window.IPC = IPC;
|
||||||
@@ -450,3 +452,14 @@ ipc.on(
|
|||||||
event.sender.send('art-creator:uploadStickerPack:done', packId);
|
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