feat: allinea lo swipe e lo scroll con l'avanzamento karaoke, aggiungi frecce di navigazione canti nel titolo
This commit is contained in:
@@ -43,6 +43,26 @@ export class SettingsPage {
|
||||
|
||||
constructor() {}
|
||||
|
||||
private async forceBypassCacheAndCheck(): Promise<boolean> {
|
||||
try {
|
||||
// 1. Forza il browser mobile a controllare la rete per aggiornamenti al Service Worker nativo
|
||||
if ('serviceWorker' in navigator) {
|
||||
const registrations = await navigator.serviceWorker.getRegistrations();
|
||||
for (const registration of registrations) {
|
||||
await registration.update();
|
||||
console.log('[PWA-Update] Native Service Worker updated from settings');
|
||||
}
|
||||
}
|
||||
// 2. Forza il caricamento di ngsw.json bypassando le cache intermedie e locali
|
||||
await fetch(`/ngsw.json?cb=${Date.now()}`, { cache: 'no-store' });
|
||||
await fetch('/ngsw.json', { cache: 'reload' });
|
||||
console.log('[PWA-Update] Caches successfully busted for ngsw.json');
|
||||
} catch (e) {
|
||||
console.warn('[PWA-Update] Failed to bust cache for ngsw.json:', e);
|
||||
}
|
||||
return await this.swUpdate.checkForUpdate();
|
||||
}
|
||||
|
||||
async installApp() {
|
||||
await this.settingsService.installPwa();
|
||||
}
|
||||
@@ -83,7 +103,7 @@ export class SettingsPage {
|
||||
// 4. Check for Service Worker updates
|
||||
if (this.swUpdate.isEnabled) {
|
||||
try {
|
||||
const updateFound = await this.swUpdate.checkForUpdate();
|
||||
const updateFound = await this.forceBypassCacheAndCheck();
|
||||
if (updateFound) {
|
||||
const toast = await this.toastCtrl.create({
|
||||
message: 'Nuova versione disponibile! Aggiornamento in corso...',
|
||||
@@ -143,7 +163,7 @@ export class SettingsPage {
|
||||
await toastLoading.present();
|
||||
|
||||
try {
|
||||
const updateFound = await this.swUpdate.checkForUpdate();
|
||||
const updateFound = await this.forceBypassCacheAndCheck();
|
||||
if (updateFound) {
|
||||
const toast = await this.toastCtrl.create({
|
||||
message: 'Nuova versione trovata! Installazione e attivazione in corso...',
|
||||
|
||||
Reference in New Issue
Block a user