uberf-8301: improve desktop app update UX (#6808)

Signed-off-by: Alexey Zinoviev <alexey.zinoviev@xored.com>
This commit is contained in:
Alexey Zinoviev 2024-10-04 19:00:31 +04:00 committed by GitHub
parent 70a1666a57
commit fc9e15f7e6
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 13 additions and 8 deletions

View File

@ -385,15 +385,20 @@ autoUpdater.on('update-available', (info: UpdateInfo) => {
app.quit() app.quit()
} }
isUpdating = true isUpdating = true
setDownloadProgress(0)
}) })
}) })
autoUpdater.on('download-progress', (progressObj: ProgressInfo) => { autoUpdater.on('download-progress', (progressObj: ProgressInfo) => {
setDownloadProgress(progressObj.percent)
})
function setDownloadProgress (percent: number): void {
if (mainWindow === undefined) return if (mainWindow === undefined) return
mainWindow.setProgressBar(progressObj.percent / 100) mainWindow.setProgressBar(percent / 100)
mainWindow.webContents.send('handle-update-download-progress', progressObj.percent) mainWindow.webContents.send('handle-update-download-progress', percent)
}) }
autoUpdater.on('update-downloaded', (info) => { autoUpdater.on('update-downloaded', (info) => {
// We have listeners that prevents the app from being exited on mac // We have listeners that prevents the app from being exited on mac

View File

@ -687,7 +687,7 @@ export function setPresentationCookie (token: string, workspaceId: string): void
setToken('/files/' + workspaceId) setToken('/files/' + workspaceId)
} }
export const upgradeDownloadProgress = writable(0) export const upgradeDownloadProgress = writable(-1)
export function setDownloadProgress (percent: number): void { export function setDownloadProgress (percent: number): void {
if (Number.isNaN(percent)) { if (Number.isNaN(percent)) {

View File

@ -32,7 +32,7 @@
<div class="antiPopup version-popup"> <div class="antiPopup version-popup">
<h1><Label label={workbench.string.ServerUnderMaintenance} /></h1> <h1><Label label={workbench.string.ServerUnderMaintenance} /></h1>
{$versionError} {$versionError}
{#if $upgradeDownloadProgress > 0} {#if $upgradeDownloadProgress >= 0}
<div class="mt-1"> <div class="mt-1">
<Label label={workbench.string.UpgradeDownloadProgress} params={{ percent: $upgradeDownloadProgress }} /> <Label label={workbench.string.UpgradeDownloadProgress} params={{ percent: $upgradeDownloadProgress }} />
</div> </div>

View File

@ -68,8 +68,8 @@
{$versionError} {$versionError}
</div> </div>
{/if} {/if}
{#if $upgradeDownloadProgress > 0} {#if $upgradeDownloadProgress >= 0}
<div class="ml-2" class:mt-1={$versionError !== undefined}> <div class="ml-1" class:ml-2={$versionError === undefined}>
<Label label={workbench.string.UpgradeDownloadProgress} params={{ percent: $upgradeDownloadProgress }} /> <Label label={workbench.string.UpgradeDownloadProgress} params={{ percent: $upgradeDownloadProgress }} />
</div> </div>
{/if} {/if}
@ -85,7 +85,7 @@
<h1><Label label={workbenchRes.string.ServerUnderMaintenance} /></h1> <h1><Label label={workbenchRes.string.ServerUnderMaintenance} /></h1>
{/if} {/if}
{$versionError} {$versionError}
{#if $upgradeDownloadProgress > 0} {#if $upgradeDownloadProgress >= 0}
<div class="mt-1"> <div class="mt-1">
<Label <Label
label={workbench.string.UpgradeDownloadProgress} label={workbench.string.UpgradeDownloadProgress}