diff --git a/ngsw-config-template.json b/ngsw-config-template.json index 7659ccaaf2b7f1ac1c77803300d27434bc50fc7b..3b0a4fbca27cc58a3290e7dacd228c8b194773c4 100644 --- a/ngsw-config-template.json +++ b/ngsw-config-template.json @@ -19,12 +19,12 @@ "/*.css", "/*.js", "/*.json", + "/*.(svg|cur|jpg|jpeg|png|apng|webp|avif|gif|otf|ttf|woff|woff2|eot)", "/3rdpartylicenses.txt", - "/MaterialIcons-Regular.1e50f5c2ffa6aba4.eot", "/assets/**", "!/**/*.pdf", "!/**/*.php", - "/*.(svg|cur|jpg|jpeg|png|apng|webp|avif|gif|otf|ttf|woff|woff2)" + "!/assets/docs/javascripts/matomo-tracking.js" ] } } diff --git a/src/app/services/service-worker-update.service.ts b/src/app/services/service-worker-update.service.ts index 163fd4a12e45f941abec56a389479a73c68b291c..857a662782cb83bcd184a5eaeaab0c9ea5a414f9 100644 --- a/src/app/services/service-worker-update.service.ts +++ b/src/app/services/service-worker-update.service.ts @@ -5,7 +5,7 @@ import { NotificationsService } from "./notifications.service"; import { UserConfirmationService } from "./user-confirmation.service"; import { interval } from "rxjs"; -@Injectable() +@Injectable({providedIn: 'root'}) export class ServiceWorkerUpdateService { constructor( private swUpdate: SwUpdate, @@ -28,11 +28,12 @@ export class ServiceWorkerUpdateService { } this.swUpdate.versionUpdates.subscribe(evt => { + console.log("ServiceWorkerUpdateService event:", evt.type); switch (evt.type) { case 'VERSION_DETECTED': let ver = (evt as any).version?.appData?.version ?? "<NA>"; console.log("ServiceWorkerUpdateService: VERSION_DETECTED", ver); - notificationService.notify(i18nService.localizeText("INFO_SERVICE_WORKER_VERSION_DETECTED", { "ver": ver }), 10000); + this.notificationService.notify(this.i18nService.localizeText("INFO_SERVICE_WORKER_VERSION_DETECTED", { "ver": ver }), 10000); break; case 'VERSION_READY': @@ -40,15 +41,15 @@ export class ServiceWorkerUpdateService { const newVer = (evt as any).latestVersion?.appData?.version ?? "<NA>"; console.log("ServiceWorkerUpdateService: VERSION_READY", currVer, "->", newVer); - notificationService.notify(i18nService.localizeText("INFO_SERVICE_WORKER_VERSION_READY", { "ver": newVer }), 10000); + this.notificationService.notify(this.i18nService.localizeText("INFO_SERVICE_WORKER_VERSION_READY", { "ver": newVer }), 10000); // PLANTE si on stocke le message dans une variable !!!! // const msg = i18nService.localizeText("INFO_SERVICE_WORKER_VERSION_READY", { "ver": newVer }); // notificationService.notify(msg, 10000); // -> ReferenceError: can't access lexical declaration 'xxx' before initialization // avec xxx qui varie d'une fois à l'autre !!! - userConfirmationService.askUserConfirmation("Confirmation", - i18nService.localizeText("INFO_SERVICE_WORKER_VERSION_READY", { "ver": newVer })).then(data => { + this.userConfirmationService.askUserConfirmation("Confirmation", + this.i18nService.localizeText("INFO_SERVICE_WORKER_VERSION_READY", { "ver": newVer })).then(data => { if (data["confirm"]) { console.log("ServiceWorkerUpdateService: application update confirmed"); window.location.reload(); @@ -60,15 +61,14 @@ export class ServiceWorkerUpdateService { break; case 'VERSION_INSTALLATION_FAILED': - ver = (evt as any).version?.appData?.version ?? "NA"; - console.log("ServiceWorkerUpdateService: VERSION_INSTALLATION_FAILED", ver); - notificationService.notify(i18nService.localizeText("ERROR_SERVICE_WORKER_INSTALL_FAILED", { "ver": ver }), 10000); + console.log(`Failed to install app version '${evt.version.hash}': ${evt.error}`); + this.notificationService.notify(this.i18nService.localizeText("ERROR_SERVICE_WORKER_INSTALL_FAILED"), 10000); break; } }); swUpdate.unrecoverable.subscribe(event => { console.log("SwUpdate.unrecoverable reason", event.reason, "type", event.type); - notificationService.notify("SwUpdate: unrecoverable state. Reason=" + event.reason + ", type=" + event.type, 10000); + this.notificationService.notify("SwUpdate: unrecoverable state. Reason=" + event.reason + ", type=" + event.type, 10000); }); } } diff --git a/src/locale/messages.en.json b/src/locale/messages.en.json index c8fd7869c3e9f8d5ad5a8a99c4aeafb94247d852..49d04bcaa7a4dbf5e72870eb669396dbf985576c 100755 --- a/src/locale/messages.en.json +++ b/src/locale/messages.en.json @@ -678,7 +678,7 @@ "INFO_ESPECE_TITRE_COURT": "Species", "INFO_SERVICE_WORKER_VERSION_DETECTED": "Downloading Cassiopée version %ver%...", "INFO_SERVICE_WORKER_VERSION_READY": "Cassiopée version %ver% is ready to be used, please restart.", - "ERROR_SERVICE_WORKER_INSTALL_FAILED": "Cassiopée version %ver% installation failed.", + "ERROR_SERVICE_WORKER_INSTALL_FAILED": "Cassiopée new version installation failed.", "ERROR_JET_SUBMERGED_NO_SOLUTION": "There is no solution", "WARNING_DEVER_ZDV_INF_ZR": "Apron elevation of structure #%number% is below river bed elevation", "WARNING_JET_START_SUBMERGED": "Water elevation is greater than jet start elevation", diff --git a/src/locale/messages.fr.json b/src/locale/messages.fr.json index 05ac13aefede5071006c779c7681bfbca832454a..764dfbbbf7eb42a5a05132f83ce0c5025c4123f2 100755 --- a/src/locale/messages.fr.json +++ b/src/locale/messages.fr.json @@ -679,7 +679,7 @@ "INFO_ESPECE_TITRE_COURT": "Espèce", "INFO_SERVICE_WORKER_VERSION_DETECTED": "Téléchargement de la version %ver% de Cassiopée en cours...", "INFO_SERVICE_WORKER_VERSION_READY": "La version %ver% de Cassiopée est prête à être utilisée, veuillez redémarrer.", - "ERROR_SERVICE_WORKER_INSTALL_FAILED": "Erreur d'installation de Cassiopée version %ver%.", + "ERROR_SERVICE_WORKER_INSTALL_FAILED": "Erreur d'installation de la nouvelle version de Cassiopée.", "ERROR_JET_SUBMERGED_NO_SOLUTION": "Il n'y a pas de solution", "WARNING_DEVER_ZDV_INF_ZR": "La cote de radier de l'ouvrage n°%number% est sous la cote de fond du lit", "WARNING_JET_START_SUBMERGED": "La cote de l'eau est supérieure à la cote de départ du jet",