From fc9e15f7e68b397fb7e18b75c2e8c7cc3d624515 Mon Sep 17 00:00:00 2001 From: Alexey Zinoviev Date: Fri, 4 Oct 2024 19:00:31 +0400 Subject: [PATCH] uberf-8301: improve desktop app update UX (#6808) Signed-off-by: Alexey Zinoviev --- desktop/src/main/start.ts | 11 ++++++++--- packages/presentation/src/utils.ts | 2 +- .../guest-resources/src/components/GuestApp.svelte | 2 +- .../src/components/WorkbenchApp.svelte | 6 +++--- 4 files changed, 13 insertions(+), 8 deletions(-) diff --git a/desktop/src/main/start.ts b/desktop/src/main/start.ts index ccaa35aac8..731aa1022a 100644 --- a/desktop/src/main/start.ts +++ b/desktop/src/main/start.ts @@ -385,15 +385,20 @@ autoUpdater.on('update-available', (info: UpdateInfo) => { app.quit() } isUpdating = true + setDownloadProgress(0) }) }) autoUpdater.on('download-progress', (progressObj: ProgressInfo) => { + setDownloadProgress(progressObj.percent) +}) + +function setDownloadProgress (percent: number): void { if (mainWindow === undefined) return - mainWindow.setProgressBar(progressObj.percent / 100) - mainWindow.webContents.send('handle-update-download-progress', progressObj.percent) -}) + mainWindow.setProgressBar(percent / 100) + mainWindow.webContents.send('handle-update-download-progress', percent) +} autoUpdater.on('update-downloaded', (info) => { // We have listeners that prevents the app from being exited on mac diff --git a/packages/presentation/src/utils.ts b/packages/presentation/src/utils.ts index 34e9900b9e..39ee4b1eee 100644 --- a/packages/presentation/src/utils.ts +++ b/packages/presentation/src/utils.ts @@ -687,7 +687,7 @@ export function setPresentationCookie (token: string, workspaceId: string): void setToken('/files/' + workspaceId) } -export const upgradeDownloadProgress = writable(0) +export const upgradeDownloadProgress = writable(-1) export function setDownloadProgress (percent: number): void { if (Number.isNaN(percent)) { diff --git a/plugins/guest-resources/src/components/GuestApp.svelte b/plugins/guest-resources/src/components/GuestApp.svelte index 46b9a6542f..f4b71de44a 100644 --- a/plugins/guest-resources/src/components/GuestApp.svelte +++ b/plugins/guest-resources/src/components/GuestApp.svelte @@ -32,7 +32,7 @@

{$versionError} - {#if $upgradeDownloadProgress > 0} + {#if $upgradeDownloadProgress >= 0}
diff --git a/plugins/workbench-resources/src/components/WorkbenchApp.svelte b/plugins/workbench-resources/src/components/WorkbenchApp.svelte index 1f2bede397..b2805ab304 100644 --- a/plugins/workbench-resources/src/components/WorkbenchApp.svelte +++ b/plugins/workbench-resources/src/components/WorkbenchApp.svelte @@ -68,8 +68,8 @@ {$versionError}
{/if} - {#if $upgradeDownloadProgress > 0} -
+ {#if $upgradeDownloadProgress >= 0} +
{/if} @@ -85,7 +85,7 @@

{/if} {$versionError} - {#if $upgradeDownloadProgress > 0} + {#if $upgradeDownloadProgress >= 0}