fix: #264 show notification on auto update finish

This commit is contained in:
ThaUnknown 2023-04-12 20:54:13 +02:00
parent f19dbdb400
commit b7d7c3108a
3 changed files with 13 additions and 3 deletions

View file

@ -1,6 +1,6 @@
{
"name": "Miru",
"version": "3.9.3",
"version": "3.9.4",
"author": "ThaUnknown_ <ThaUnknown@users.noreply.github.com>",
"description": "Stream anime torrents, real-time with no waiting for downloads.",
"main": "src/index.js",

View file

@ -291,5 +291,8 @@ ipcMain.on('update', () => {
autoUpdater.checkForUpdatesAndNotify()
autoUpdater.on('update-available', () => {
BrowserWindow.getAllWindows()[0]?.send('update', true)
BrowserWindow.getAllWindows()[0]?.send('update-available', true)
})
autoUpdater.on('update-downloaded', () => {
BrowserWindow.getAllWindows()[0]?.send('update-downloaded', true)
})

View file

@ -59,7 +59,7 @@
window.IPC.emit('version')
let wasUpdated = false
window.IPC.on('update', () => {
window.IPC.on('update-available', () => {
if (!wasUpdated) {
wasUpdated = true
addToast({
@ -68,6 +68,13 @@
})
}
})
window.IPC.on('update-downloaded', () => {
addToast({
title: 'Auto Updater',
text: 'A new version of Miru has downloaded. You can restart to update!',
type: 'success'
})
})
function checkUpdate () {
window.IPC.emit('update')
}