diff --git a/electron-builder.yml b/electron-builder.yml index 75e0a58..7cbb8db 100644 --- a/electron-builder.yml +++ b/electron-builder.yml @@ -49,7 +49,6 @@ mac: artifactName: "${productName}-${version}-${arch}.${ext}" target: - target: dmg - arch: [arm64, x64] win: icon: build/icon.ico target: diff --git a/electron/updater.ts b/electron/updater.ts index 53b9120..adf2e91 100644 --- a/electron/updater.ts +++ b/electron/updater.ts @@ -98,7 +98,14 @@ export function initAutoUpdater(win: BrowserWindow) { }); ipcMain.handle('updater:download', async () => { - return autoUpdater.downloadUpdate(); + try { + return await autoUpdater.downloadUpdate(); + } catch (err) { + const message = err instanceof Error ? err.message : String(err); + console.error('[updater] Download failed:', message); + sendStatus({ status: 'error', error: message }); + throw err; + } }); ipcMain.handle('updater:quit-and-install', () => { diff --git a/src/components/layout/AppShell.tsx b/src/components/layout/AppShell.tsx index d30c864..221a8de 100644 --- a/src/components/layout/AppShell.tsx +++ b/src/components/layout/AppShell.tsx @@ -280,6 +280,8 @@ export function AppShell({ children }: { children: React.ReactNode }) { case 'error': setChecking(false); + // Reset download progress so the download button re-appears + setUpdateInfo((prev) => prev ? { ...prev, downloadProgress: null } : prev); console.warn('[updater] Error:', event.error); break; } @@ -300,8 +302,16 @@ export function AppShell({ children }: { children: React.ReactNode }) { setShowDialog(false); }, []); - const downloadUpdate = useCallback(() => { - window.electronAPI?.updater?.downloadUpdate(); + const downloadUpdate = useCallback(async () => { + // Immediately show downloading state so user gets feedback + setUpdateInfo((prev) => prev ? { ...prev, downloadProgress: 0 } : prev); + try { + await window.electronAPI?.updater?.downloadUpdate(); + } catch (err) { + console.warn('[updater] Download failed:', err); + // Reset progress so the download button re-appears + setUpdateInfo((prev) => prev ? { ...prev, downloadProgress: null } : prev); + } }, []); const quitAndInstall = useCallback(() => { diff --git a/src/components/layout/UpdateDialog.tsx b/src/components/layout/UpdateDialog.tsx index 03f5703..b060578 100644 --- a/src/components/layout/UpdateDialog.tsx +++ b/src/components/layout/UpdateDialog.tsx @@ -20,7 +20,7 @@ export function UpdateDialog() { if (!updateInfo?.updateAvailable) return null; const { isNativeUpdate, readyToInstall, downloadProgress } = updateInfo; - const isDownloading = isNativeUpdate && !readyToInstall && downloadProgress != null && downloadProgress > 0; + const isDownloading = isNativeUpdate && !readyToInstall && downloadProgress != null; return ( { diff --git a/src/components/settings/GeneralSection.tsx b/src/components/settings/GeneralSection.tsx index de51573..c6c5c25 100644 --- a/src/components/settings/GeneralSection.tsx +++ b/src/components/settings/GeneralSection.tsx @@ -26,7 +26,7 @@ function UpdateCard() { const currentVersion = process.env.NEXT_PUBLIC_APP_VERSION || "0.0.0"; const isDownloading = updateInfo?.isNativeUpdate && !updateInfo.readyToInstall - && updateInfo.downloadProgress != null && updateInfo.downloadProgress > 0; + && updateInfo.downloadProgress != null; return (