Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 2 additions & 29 deletions desktop/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -212,9 +212,6 @@ const showKeyboardShortcutsPage = (browserWindow: BrowserWindow) => {
const electronUpdater = (browserWindow: BrowserWindow): PlatformSpecificUpdater => ({
init: () => {
autoUpdater.on(ELECTRON_EVENTS.UPDATE_DOWNLOADED, (info) => {
// eslint-disable-next-line no-console
console.group('[dev] ELECTRON_EVENTS.UPDATE_DOWNLOADED');
console.debug('[dev] info:', info);
const systemMenu = Menu.getApplicationMenu();
const updateMenuItem = systemMenu?.getMenuItemById(`update`);
const checkForUpdatesMenuItem = systemMenu?.getMenuItemById(`checkForUpdates`);
Expand All @@ -230,39 +227,15 @@ const electronUpdater = (browserWindow: BrowserWindow): PlatformSpecificUpdater
if (browserWindow.isVisible() && !isSilentUpdating) {
browserWindow.webContents.send(ELECTRON_EVENTS.UPDATE_DOWNLOADED, info.version);
} else {
console.debug('[dev] else');

autoUpdater
.checkForUpdates()
.then((result) => {
console.debug('[dev] result', result);
if (result?.updateInfo.version === downloadedVersion) {
console.debug('[dev] if - versions match, installing');
quitAndInstallWithUpdate();
} else {
console.debug('[dev] else - downloading new update');
return autoUpdater.downloadUpdate().then(() => {
console.debug('[dev] download complete, installing');
quitAndInstallWithUpdate();
});
}
})
.catch((error) => {
console.debug('[dev] error', error);
log.error('Error during update check or download:', error);
});
quitAndInstallWithUpdate();
}
// eslint-disable-next-line no-console
console.groupEnd();
});

ipcMain.on(ELECTRON_EVENTS.START_UPDATE, quitAndInstallWithUpdate);
autoUpdater.checkForUpdates();
},
update: () => {
autoUpdater.checkForUpdates().then((result) => {
console.debug('[dev] update result', result);
});
autoUpdater.checkForUpdates();
},
});

Expand Down
Loading