fix: risoluzione importazione playlist tramite link di condivisione e fix installabilità PWA su Android

This commit is contained in:
David Frassi
2026-05-22 01:22:26 +02:00
parent d82d56a3cc
commit adc3d510ad
39 changed files with 842 additions and 299 deletions
+22 -23
View File
@@ -19,21 +19,31 @@ export class AppComponent {
private setupUpdates() {
if (this.swUpdate.isEnabled) {
// 1. Check for updates immediately as soon as the application stabilizes
const appIsStable$ = this.appRef.isStable.pipe(
first(isStable => isStable === true)
);
// Wait for the application to stabilize before running update checks or starting intervals
this.appRef.isStable.pipe(
filter(stable => stable),
first()
).subscribe(() => {
console.log('[PWA-Update] App is stable. Initializing update checks...');
// 1. Check for updates immediately
this.swUpdate.checkForUpdate().catch(err => {
console.warn('[PWA-Update] Failed immediate startup update check:', err);
});
appIsStable$.subscribe(async () => {
console.log('[PWA-Update] App is stable, checking for PWA updates immediately...');
try {
await this.swUpdate.checkForUpdate();
} catch (err) {
console.warn('[PWA-Update] Failed startup update check:', err);
}
// 2. Periodic check in background every 30 seconds
const every30Seconds$ = interval(30 * 1000);
every30Seconds$.subscribe(async () => {
console.log('[PWA-Update] Periodic check for updates (every 30s)...');
try {
await this.swUpdate.checkForUpdate();
} catch (err) {
console.warn('[PWA-Update] Failed periodic update check:', err);
}
});
});
// 2. Check for updates when the app is resumed/focused
// 3. Check for updates when the app is resumed/focused
fromEvent(document, 'visibilitychange')
.pipe(filter(() => document.visibilityState === 'visible'))
.subscribe(async () => {
@@ -45,17 +55,6 @@ export class AppComponent {
}
});
// 3. Periodic check in background every 5 minutes
const everyFiveMinutes$ = interval(5 * 60 * 1000);
everyFiveMinutes$.subscribe(async () => {
console.log('[PWA-Update] Periodic check for updates...');
try {
await this.swUpdate.checkForUpdate();
} catch (err) {
console.warn('[PWA-Update] Failed periodic update check:', err);
}
});
// 4. Activate update and reload when a new version is ready
this.swUpdate.versionUpdates
.pipe(filter((evt): evt is VersionReadyEvent => evt.type === 'VERSION_READY'))