feat: show real-time download progress bar for app updates

Leverage the Tauri updater plugin's DownloadEvent callback to display
a progress bar with downloaded/total bytes during app updates, replacing
the previous spinner-only feedback.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
xintaofei
2026-04-12 22:01:46 +08:00
parent a763adaf36
commit 1554425b03
12 changed files with 90 additions and 4 deletions

View File

@@ -4,6 +4,11 @@ import { getTransport, isDesktop } from "./transport"
// eslint-disable-next-line @typescript-eslint/no-explicit-any
type Update = any
export type DownloadEvent =
| { event: "Started"; data: { contentLength?: number } }
| { event: "Progress"; data: { chunkLength: number } }
| { event: "Finished" }
export interface AppUpdateCheckResult {
currentVersion: string
update: Update | null
@@ -46,9 +51,10 @@ export async function checkAppUpdate(): Promise<AppUpdateCheckResult> {
}
export async function installAppUpdate(
update: NonNullable<Update>
update: NonNullable<Update>,
onEvent?: (progress: DownloadEvent) => void
): Promise<void> {
await update.downloadAndInstall()
await update.downloadAndInstall(onEvent)
}
export async function relaunchApp(): Promise<void> {