Update to Angular 18 (#3309)

This commit is contained in:
Joe Milazzo 2024-10-25 13:55:49 -07:00 committed by GitHub
parent eacf2b9a5a
commit d563ebf3d2
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
28 changed files with 2220 additions and 8310 deletions

View file

@ -121,18 +121,18 @@ export class AppComponent implements OnInit {
this.libraryService.getLibraryNames().pipe(take(1), shareReplay({refCount: true, bufferSize: 1})).subscribe();
// Get the server version, compare vs localStorage, and if different bust locale cache
const versionKey = 'kavita--version';
this.serverService.getVersion(user.apiKey).subscribe(version => {
const cachedVersion = localStorage.getItem('kavita--version');
const cachedVersion = localStorage.getItem(versionKey);
console.log('Kavita version: ', version, ' Running version: ', cachedVersion);
if (cachedVersion == null || cachedVersion != version) {
// Bust locale cache
localStorage.removeItem('@transloco/translations/timestamp');
localStorage.removeItem('@transloco/translations');
(this.translocoService as any).cache.delete(localStorage.getItem('kavita-locale') || 'en');
(this.translocoService as any).cache.clear();
localStorage.setItem('kavita--version', version);
this.bustLocaleCache();
localStorage.setItem(versionKey, version);
location.reload();
}
localStorage.setItem('kavita--version', version);
localStorage.setItem(versionKey, version);
});
// Every hour, have the UI check for an update. People seriously stay out of date
@ -153,4 +153,12 @@ export class AppComponent implements OnInit {
)
.subscribe();
}
private bustLocaleCache() {
localStorage.removeItem('@transloco/translations/timestamp');
localStorage.removeItem('@transloco/translations');
localStorage.removeItem('translocoLang');
(this.translocoService as any).cache.delete(localStorage.getItem('kavita-locale') || 'en');
(this.translocoService as any).cache.clear();
}
}