Update updater service and add translation for update prompt

This commit is contained in:
Matteo Gheza 2024-01-17 18:02:44 +01:00
parent 215b15946e
commit e58652b802
3 changed files with 19 additions and 1 deletions

View File

@ -30,7 +30,7 @@ export class UpdaterService {
updates.unrecoverable.subscribe(event => {
console.error(event);
location.reload();
document.location.reload();
});
updates.versionUpdates.subscribe(evt => {
@ -41,6 +41,18 @@ export class UpdaterService {
case 'VERSION_READY':
console.log(`Current app version: ${evt.currentVersion.hash}`);
console.log(`New app version ready for use: ${evt.latestVersion.hash}`);
Swal.fire({
title: translate.instant('update_available'),
text: translate.instant('update_available_text'),
icon: 'info',
showCancelButton: true,
confirmButtonText: translate.instant('update_now'),
cancelButtonText: translate.instant('cancel')
}).then((result) => {
if (result.isConfirmed) {
document.location.reload();
}
});
break;
case 'VERSION_INSTALLATION_FAILED':
console.log(`Failed to install app version '${evt.version.hash}': ${evt.error}`);

View File

@ -185,6 +185,9 @@
"file_too_big": "File too big",
"password_min_length": "Password must be at least 6 characters long"
},
"update_available": "Update available",
"update_available_text": "A new version of the application is available. Do you want to update now?",
"update_now": "Update now",
"yes_remove": "Yes, remove",
"confirm": "Confirm",
"cancel": "Cancel",

View File

@ -185,6 +185,9 @@
"file_too_big": "File troppo grande",
"password_min_length": "La password deve essere di almeno 6 caratteri"
},
"update_available": "Aggiornamento disponibile",
"update_available_text": "È disponibile un aggiornamento per il gestionale. Vuoi aggiornare ora?",
"update_now": "Aggiorna ora",
"yes_remove": "Si, rimuovi",
"confirm": "Conferma",
"cancel": "Annulla",