2022-05-27 10:47:24 +00:00
|
|
|
import { autoUpdater } from 'electron-updater';
|
2022-03-16 09:49:48 +00:00
|
|
|
import { Main } from '../main';
|
2022-03-31 07:33:58 +00:00
|
|
|
import { IPC_CHANNELS } from '../utils/messages';
|
2022-03-16 09:49:48 +00:00
|
|
|
|
|
|
|
export default function registerAutoUpdaterListeners(main: Main) {
|
2022-05-27 10:47:24 +00:00
|
|
|
autoUpdater.autoDownload = true;
|
|
|
|
autoUpdater.autoInstallOnAppQuit = true;
|
2022-03-16 09:49:48 +00:00
|
|
|
|
|
|
|
autoUpdater.on('error', (error) => {
|
|
|
|
if (!main.checkedForUpdate) {
|
|
|
|
main.checkedForUpdate = true;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2022-05-27 10:47:24 +00:00
|
|
|
main.mainWindow!.webContents.send(IPC_CHANNELS.MAIN_PROCESS_ERROR, error);
|
2022-03-16 09:49:48 +00:00
|
|
|
});
|
|
|
|
}
|