diff --git a/apps/desktop/src/lib/backend/updater.ts b/apps/desktop/src/lib/backend/updater.ts index f9873880c..7609cfb68 100644 --- a/apps/desktop/src/lib/backend/updater.ts +++ b/apps/desktop/src/lib/backend/updater.ts @@ -1,4 +1,5 @@ import { showToast } from '$lib/notifications/toasts'; +import { getVersion } from '@tauri-apps/api/app'; import { relaunch } from '@tauri-apps/api/process'; import { checkUpdate, @@ -10,7 +11,7 @@ import { import posthog from 'posthog-js'; import { derived, writable, type Readable } from 'svelte/store'; -// TOOD: Investigate why 'DOWNLOADED' is not in the type provided by Tauri. +// TODO: Investigate why 'DOWNLOADED' is not in the type provided by Tauri. export type Update = | { version?: string; status?: UpdateStatus | 'DOWNLOADED'; body?: string } | undefined; @@ -33,6 +34,7 @@ export class UpdaterService { undefined ); + currentVersion = writable(undefined); readonly version = derived(this.update, (update) => update?.version); prev: Update | undefined; @@ -42,6 +44,8 @@ export class UpdaterService { constructor() {} private async start() { + const currentVersion = await getVersion(); + this.currentVersion.set(currentVersion); await this.checkForUpdate(); setInterval(async () => await this.checkForUpdate(), 3600000); // hourly this.unlistenFn = await onUpdaterEvent((status) => { diff --git a/apps/desktop/src/lib/components/AppUpdater.svelte b/apps/desktop/src/lib/components/AppUpdater.svelte index 0346a5dfe..e70f618a7 100644 --- a/apps/desktop/src/lib/components/AppUpdater.svelte +++ b/apps/desktop/src/lib/components/AppUpdater.svelte @@ -8,10 +8,13 @@ const updaterService = getContext(UpdaterService); const update = updaterService.update; const version = updaterService.version; + const currentVersion = updaterService.currentVersion; let dismissed = $state(false); $effect(() => { - if (version && dismissed) dismissed = false; + if ($version !== $currentVersion && dismissed) { + dismissed = false; + } }); @@ -120,9 +123,8 @@ Release notes
-
- {#if !$update.status} +
{:else if $update.status === 'DONE'} +