pwa debug

This commit is contained in:
2023-06-24 12:29:13 +02:00
parent 26932b8850
commit 503cfca0c3

View File

@@ -18,28 +18,30 @@ export class AppComponent {
) {
console.log('Start versionUpdates subscribe', this._swUpdate.isEnabled, environment.production);
this._swUpdate.versionUpdates.subscribe((evt) => {
console.log('Version update', evt);
if (evt.type === 'VERSION_READY') {
console.log('tt');
this._swUpdate.activateUpdate().then(() => {
console.log('Update!');
this._notifications.add({
text: "New version available. DiunaBI will restart in 10 seconds.",
duration: 10000,
dismiss: () => {
window.location.reload()
},
btn: 'Cancel',
action: () => {
if (this._swUpdate.isEnabled && environment.production) {
this._swUpdate.versionUpdates.subscribe((evt) => {
console.log('versionUpdates', evt);
switch (evt.type) {
case 'VERSION_READY':
this._swUpdate.activateUpdate().then(() => {
this._notifications.add({
text: "Restart canceled.",
btn: "Hide"
});
}
})
});
}
})
text: "New version available. DiunaBI will restart in 10 seconds.",
duration: 10000,
dismiss: () => {
window.location.reload()
},
btn: 'Cancel',
action: () => {
this._notifications.add({
text: "Restart canceled.",
btn: "Hide"
});
}
})
});
break;
}
});
}
}
}