Skip to content
This repository has been archived by the owner on Jun 20, 2022. It is now read-only.

Commit

Permalink
fix: don't show a result dialog after a background update check
Browse files Browse the repository at this point in the history
  • Loading branch information
arielsvg committed May 28, 2020
1 parent f5893a6 commit 7ccba9a
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 5 deletions.
1 change: 0 additions & 1 deletion app/application.ts
Expand Up @@ -103,7 +103,6 @@ function registerAppEventListeners(args: {
const windowState = state.windowState;
if (!windowState) return;
windowState.window.show();
windowState.updateManager.checkForUpdate();
});

app.on('ready', () => {
Expand Down
2 changes: 1 addition & 1 deletion app/javascripts/main/menus.ts
Expand Up @@ -566,7 +566,7 @@ function updateMenu(updateManager: UpdateManager) {
submenu.push({
label: str().checkForUpdate,
click() {
updateManager.checkForUpdate();
updateManager.checkForUpdate(true);
},
});
}
Expand Down
6 changes: 3 additions & 3 deletions app/javascripts/main/updateManager.ts
Expand Up @@ -37,7 +37,7 @@ export interface UpdateManager {
readonly checkingForUpdate: boolean;
onStateUpdate?: () => void;
openChangelog(): void;
checkForUpdate(): void;
checkForUpdate(userTriggered: boolean): void;
toggleAutoupdateStatus(): void;
showAutoUpdateInstallationDialog(): void;
updateNeeded(): boolean;
Expand Down Expand Up @@ -97,8 +97,8 @@ export function createUpdateManager(
showAutoUpdateInstallationDialog() {
showUpdateInstallationDialog(window, state);
},
checkForUpdate() {
checkForUpdate(store, state, true);
checkForUpdate(userTriggered: boolean) {
checkForUpdate(store, state, userTriggered);
},
toggleAutoupdateStatus() {
toggleAutoupdateStatus(store, state);
Expand Down
7 changes: 7 additions & 0 deletions app/javascripts/main/window.ts
Expand Up @@ -58,6 +58,7 @@ export async function createWindowState({
window,
archiveManager: services.archiveManager,
trayManager: services.trayManager,
updateManager: services.updateManager,
onClosed: teardown,
});

Expand Down Expand Up @@ -178,20 +179,26 @@ function registerWindowEventListeners({
window,
archiveManager,
trayManager,
updateManager,
onClosed,
}: {
shell: Shell;
appState: Pick<AppState, 'willQuitApp' | 'startUrl'>;
window: Electron.BrowserWindow;
archiveManager: ArchiveManager;
trayManager: TrayManager;
updateManager: UpdateManager;
onClosed: () => void;
}) {
const shouldOpenUrl = (url: string) =>
url.startsWith('http') || url.startsWith('mailto');

window.on('closed', onClosed);

window.on('show', () => {
updateManager.checkForUpdate(false);
});

window.on('focus', () => {
window.webContents.send(IpcMessages.WindowFocused, null);
});
Expand Down

0 comments on commit 7ccba9a

Please sign in to comment.