2
0
mirror of https://github.com/frappe/books.git synced 2024-11-10 07:40:55 +00:00

fix(ux): don't notify if no updates on startup

This commit is contained in:
18alantom 2022-02-08 12:56:46 +05:30
parent 325045dc34
commit b725267789

View File

@ -215,7 +215,6 @@ ipcMain.handle(IPC_ACTIONS.SEND_ERROR, (event, bodyJson) => {
ipcMain.handle(IPC_ACTIONS.CHECK_FOR_UPDATES, (event, force) => { ipcMain.handle(IPC_ACTIONS.CHECK_FOR_UPDATES, (event, force) => {
if (!isDevelopment && !checkedForUpdate) { if (!isDevelopment && !checkedForUpdate) {
autoUpdater.checkForUpdates(); autoUpdater.checkForUpdates();
checkedForUpdate = true;
} else if (force) { } else if (force) {
autoUpdater.checkForUpdates(); autoUpdater.checkForUpdates();
} }
@ -236,10 +235,17 @@ autoUpdater.on('checking-for-update', () => {
}); });
autoUpdater.on('update-available', (info) => { autoUpdater.on('update-available', (info) => {
if (!checkedForUpdate) {
checkedForUpdate = true;
}
mainWindow.webContents.send(IPC_CHANNELS.UPDATE_AVAILABLE, info.version); mainWindow.webContents.send(IPC_CHANNELS.UPDATE_AVAILABLE, info.version);
}); });
autoUpdater.on('update-not-available', () => { autoUpdater.on('update-not-available', () => {
if (!checkedForUpdate) {
checkedForUpdate = true;
return;
}
mainWindow.webContents.send(IPC_CHANNELS.UPDATE_NOT_AVAILABLE); mainWindow.webContents.send(IPC_CHANNELS.UPDATE_NOT_AVAILABLE);
}); });
@ -248,6 +254,10 @@ autoUpdater.on('update-downloaded', () => {
}); });
autoUpdater.on('error', (error) => { autoUpdater.on('error', (error) => {
if (!checkedForUpdate) {
checkedForUpdate = true;
return;
}
mainWindow.webContents.send(IPC_CHANNELS.UPDATE_ERROR, error); mainWindow.webContents.send(IPC_CHANNELS.UPDATE_ERROR, error);
}); });