fix: update check for new updates to not show banner if app is up to date

This commit is contained in:
Mattias Granlund 2024-01-23 22:07:24 +01:00
parent 14fd810a54
commit 16ab8d71c8
2 changed files with 5 additions and 3 deletions

View File

@ -18,7 +18,8 @@ import {
catchError,
of,
startWith,
combineLatestWith
combineLatestWith,
tap
} from 'rxjs';
export type Update = { version?: string; status?: UpdateStatus } | undefined;
@ -42,6 +43,7 @@ export class UpdaterService {
this.update$ = this.reload$.pipe(
switchMap(() => interval(60 * 1000).pipe(startWith(0))),
tap(() => this.status$.next(undefined)),
switchMap(() =>
from(checkUpdate()).pipe(
timeout(10000), // In dev mode the promise hangs indefinitely.
@ -61,7 +63,7 @@ export class UpdaterService {
}),
shareReplay(1)
);
// this.update$ = of({ version: '1.0.0', status: 'DONE' });
this.update$ = of({ version: '1.0.0', status: 'UPTODATE' });
}
async install() {

View File

@ -10,7 +10,7 @@
$: update$ = updaterService.update$;
</script>
{#if $update$?.version}
{#if $update$?.version && $update$.status != 'UPTODATE'}
<div class="update-banner" class:busy={$update$?.status == 'PENDING'}>
<div class="img">
<div class="circle-img">