forked from lexogrine/hud-manager
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathautoUpdater.ts
29 lines (24 loc) · 857 Bytes
/
autoUpdater.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
import { autoUpdater } from 'electron-updater';
import { BrowserWindow, ipcMain, Notification } from 'electron';
autoUpdater.autoDownload = false;
autoUpdater.autoInstallOnAppQuit = false;
export default (window: BrowserWindow) => {
autoUpdater.on('update-available', () => {
window.webContents.send('updateStatus', true);
const notification = new Notification({
title: 'Update available',
body: `You can install the newest Lexogrine HUD Manager update in the Settings tab`
});
notification.show();
});
autoUpdater.on('update-not-available', () => {
window.webContents.send('updateStatus', false);
});
autoUpdater.on('update-downloaded', () => autoUpdater.quitAndInstall(true, true));
ipcMain.on('updateApp', () => {
autoUpdater.downloadUpdate();
});
ipcMain.on('checkUpdate', () => {
autoUpdater.checkForUpdates();
});
};