mirror of
https://github.com/stablyai/orca.git
synced 2026-10-23 16:03:49 +00:00
fix(updater): show download progress toast and enable toast feedback for settings check
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 4.6
parent
a5167c5a03
commit
8bdada3fb7
@@ -5,7 +5,7 @@ import { registerRepoHandlers } from '../ipc/repos'
|
||||
import { registerWorktreeHandlers } from '../ipc/worktrees'
|
||||
import { registerPtyHandlers } from '../ipc/pty'
|
||||
import {
|
||||
checkForUpdates,
|
||||
checkForUpdatesFromMenu,
|
||||
downloadUpdate,
|
||||
getUpdateStatus,
|
||||
quitAndInstall,
|
||||
@@ -57,7 +57,7 @@ export function registerUpdaterHandlers(): void {
|
||||
|
||||
ipcMain.handle('updater:getStatus', () => getUpdateStatus())
|
||||
ipcMain.handle('updater:getVersion', () => app.getVersion())
|
||||
ipcMain.handle('updater:check', () => checkForUpdates())
|
||||
ipcMain.handle('updater:check', () => checkForUpdatesFromMenu())
|
||||
ipcMain.handle('updater:download', () => downloadUpdate())
|
||||
ipcMain.handle('updater:quitAndInstall', () => quitAndInstall())
|
||||
}
|
||||
|
||||
@@ -35,6 +35,7 @@ export function useIpcEvents(): void {
|
||||
|
||||
let checkingToastId: string | number | undefined
|
||||
let availableToastId: string | number | undefined
|
||||
const downloadToastId = 'update-download-progress'
|
||||
unsubs.push(
|
||||
window.api.updater.onStatus((raw) => {
|
||||
const status = raw as UpdateStatus
|
||||
@@ -65,11 +66,16 @@ export function useIpcEvents(): void {
|
||||
toast.dismiss(availableToastId)
|
||||
availableToastId = undefined
|
||||
}
|
||||
toast.loading(`Downloading v${status.version}… ${status.percent}%`, {
|
||||
id: downloadToastId,
|
||||
duration: Infinity
|
||||
})
|
||||
} else if (status.state === 'downloaded') {
|
||||
if (availableToastId) {
|
||||
toast.dismiss(availableToastId)
|
||||
availableToastId = undefined
|
||||
}
|
||||
toast.dismiss(downloadToastId)
|
||||
toast.success(`Version ${status.version} is ready to install.`, {
|
||||
duration: Infinity,
|
||||
action: {
|
||||
@@ -77,12 +83,15 @@ export function useIpcEvents(): void {
|
||||
onClick: () => window.api.updater.quitAndInstall()
|
||||
}
|
||||
})
|
||||
} else if (status.state === 'error' && 'userInitiated' in status && status.userInitiated) {
|
||||
toast.error('Could not check for updates.', {
|
||||
description: status.message,
|
||||
id: checkingToastId
|
||||
})
|
||||
checkingToastId = undefined
|
||||
} else if (status.state === 'error') {
|
||||
toast.dismiss(downloadToastId)
|
||||
if ('userInitiated' in status && status.userInitiated) {
|
||||
toast.error('Could not check for updates.', {
|
||||
description: status.message,
|
||||
id: checkingToastId
|
||||
})
|
||||
checkingToastId = undefined
|
||||
}
|
||||
}
|
||||
})
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user