Update updater service and add translation for update prompt
This commit is contained in:
parent
215b15946e
commit
e58652b802
|
@ -30,7 +30,7 @@ export class UpdaterService {
|
||||||
|
|
||||||
updates.unrecoverable.subscribe(event => {
|
updates.unrecoverable.subscribe(event => {
|
||||||
console.error(event);
|
console.error(event);
|
||||||
location.reload();
|
document.location.reload();
|
||||||
});
|
});
|
||||||
|
|
||||||
updates.versionUpdates.subscribe(evt => {
|
updates.versionUpdates.subscribe(evt => {
|
||||||
|
@ -41,6 +41,18 @@ export class UpdaterService {
|
||||||
case 'VERSION_READY':
|
case 'VERSION_READY':
|
||||||
console.log(`Current app version: ${evt.currentVersion.hash}`);
|
console.log(`Current app version: ${evt.currentVersion.hash}`);
|
||||||
console.log(`New app version ready for use: ${evt.latestVersion.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;
|
break;
|
||||||
case 'VERSION_INSTALLATION_FAILED':
|
case 'VERSION_INSTALLATION_FAILED':
|
||||||
console.log(`Failed to install app version '${evt.version.hash}': ${evt.error}`);
|
console.log(`Failed to install app version '${evt.version.hash}': ${evt.error}`);
|
||||||
|
|
|
@ -185,6 +185,9 @@
|
||||||
"file_too_big": "File too big",
|
"file_too_big": "File too big",
|
||||||
"password_min_length": "Password must be at least 6 characters long"
|
"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",
|
"yes_remove": "Yes, remove",
|
||||||
"confirm": "Confirm",
|
"confirm": "Confirm",
|
||||||
"cancel": "Cancel",
|
"cancel": "Cancel",
|
||||||
|
|
|
@ -185,6 +185,9 @@
|
||||||
"file_too_big": "File troppo grande",
|
"file_too_big": "File troppo grande",
|
||||||
"password_min_length": "La password deve essere di almeno 6 caratteri"
|
"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",
|
"yes_remove": "Si, rimuovi",
|
||||||
"confirm": "Conferma",
|
"confirm": "Conferma",
|
||||||
"cancel": "Annulla",
|
"cancel": "Annulla",
|
||||||
|
|
Loading…
Reference in New Issue