Skip to content

Commit 708287e

Browse files
authored
fix(auto-update-manager): listen to events instead of invokes; broadcast to all windows, not only the focused one (#5506)
1 parent 7d3b82a commit 708287e

File tree

2 files changed

+7
-7
lines changed

2 files changed

+7
-7
lines changed

packages/compass/src/main/auto-update-manager.spec.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -305,7 +305,7 @@ describe('CompassAutoUpdateManager', function () {
305305

306306
it('should restart the app if user confirms', async function () {
307307
const restartToastIpcPrompt = sandbox
308-
.stub(ipcMain!, 'broadcastFocused')
308+
.stub(ipcMain!, 'broadcast')
309309
.callsFake((arg) => {
310310
expect(arg).to.equal('autoupdate:update-download-success');
311311
setTimeout(() => {
@@ -329,7 +329,7 @@ describe('CompassAutoUpdateManager', function () {
329329

330330
it('should transition to restart dismissed if user does not confirm restart', async function () {
331331
const restartToastIpcPrompt = sandbox
332-
.stub(ipcMain!, 'broadcastFocused')
332+
.stub(ipcMain!, 'broadcast')
333333
.callsFake((arg) => {
334334
expect(arg).to.equal('autoupdate:update-download-success');
335335
setTimeout(() => {

packages/compass/src/main/auto-update-manager.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -359,7 +359,7 @@ const STATE_UPDATE: Record<
359359
this.maybeInterrupt();
360360

361361
if (isDownloadForManualCheck) {
362-
ipcMain?.broadcastFocused('autoupdate:update-download-in-progress');
362+
ipcMain?.broadcast('autoupdate:update-download-in-progress');
363363
}
364364
autoUpdater.checkForUpdates();
365365
},
@@ -379,7 +379,7 @@ const STATE_UPDATE: Record<
379379

380380
this.maybeInterrupt();
381381

382-
ipcMain?.broadcastFocused('autoupdate:update-download-success');
382+
ipcMain?.broadcast('autoupdate:update-download-success');
383383
},
384384
},
385385
[AutoUpdateManagerState.ManualDownload]: {
@@ -431,7 +431,7 @@ const STATE_UPDATE: Record<
431431
[AutoUpdateManagerState.DownloadingError]: {
432432
nextStates: [AutoUpdateManagerState.UserPromptedManualCheck],
433433
enter: (_updateManager, _fromState, error) => {
434-
ipcMain?.broadcastFocused('autoupdate:update-download-failed');
434+
ipcMain?.broadcast('autoupdate:update-download-failed');
435435
log.error(
436436
mongoLogId(1001000129),
437437
'AutoUpdateManager',
@@ -663,12 +663,12 @@ class CompassAutoUpdateManager {
663663
this.setState(AutoUpdateManagerState.UserPromptedManualCheck);
664664
});
665665

666-
ipcMain?.handle(
666+
ipcMain?.on(
667667
'autoupdate:update-download-restart-confirmed',
668668
this.handleIpcUpdateDownloadRestartConfirmed.bind(this)
669669
);
670670

671-
ipcMain?.handle(
671+
ipcMain?.on(
672672
'autoupdate:update-download-restart-dismissed',
673673
this.handleIpcUpdateDownloadRestartDismissed.bind(this)
674674
);

0 commit comments

Comments
 (0)