Skip to content

Commit

Permalink
uberf-8301: improve desktop app update UX (#6808)
Browse files Browse the repository at this point in the history
Signed-off-by: Alexey Zinoviev <[email protected]>
  • Loading branch information
lexiv0re authored Oct 4, 2024
1 parent 70a1666 commit fc9e15f
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 8 deletions.
11 changes: 8 additions & 3 deletions desktop/src/main/start.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion packages/presentation/src/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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)) {
Expand Down
2 changes: 1 addition & 1 deletion plugins/guest-resources/src/components/GuestApp.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
<div class="antiPopup version-popup">
<h1><Label label={workbench.string.ServerUnderMaintenance} /></h1>
{$versionError}
{#if $upgradeDownloadProgress > 0}
{#if $upgradeDownloadProgress >= 0}
<div class="mt-1">
<Label label={workbench.string.UpgradeDownloadProgress} params={{ percent: $upgradeDownloadProgress }} />
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,8 @@
{$versionError}
</div>
{/if}
{#if $upgradeDownloadProgress > 0}
<div class="ml-2" class:mt-1={$versionError !== undefined}>
{#if $upgradeDownloadProgress >= 0}
<div class="ml-1" class:ml-2={$versionError === undefined}>
<Label label={workbench.string.UpgradeDownloadProgress} params={{ percent: $upgradeDownloadProgress }} />
</div>
{/if}
Expand All @@ -85,7 +85,7 @@
<h1><Label label={workbenchRes.string.ServerUnderMaintenance} /></h1>
{/if}
{$versionError}
{#if $upgradeDownloadProgress > 0}
{#if $upgradeDownloadProgress >= 0}
<div class="mt-1">
<Label
label={workbench.string.UpgradeDownloadProgress}
Expand Down

0 comments on commit fc9e15f

Please sign in to comment.