fix update listening
This commit is contained in:
parent
239e86332f
commit
5e7d151cad
|
@ -10,6 +10,8 @@ export class ServiceWorkerService {
|
||||||
|
|
||||||
newAppVersionIsAvailable = new BehaviorSubject<boolean>(false);
|
newAppVersionIsAvailable = new BehaviorSubject<boolean>(false);
|
||||||
|
|
||||||
|
private isListening = false;
|
||||||
|
|
||||||
constructor(appRef: ApplicationRef, updates: SwUpdate) {
|
constructor(appRef: ApplicationRef, updates: SwUpdate) {
|
||||||
|
|
||||||
//https://angular.io/guide/service-worker-communications
|
//https://angular.io/guide/service-worker-communications
|
||||||
|
@ -30,9 +32,15 @@ export class ServiceWorkerService {
|
||||||
// });
|
// });
|
||||||
|
|
||||||
const updateCheckTimer$ = interval(6 * 60 * 60 * 1000);
|
const updateCheckTimer$ = interval(6 * 60 * 60 * 1000);
|
||||||
|
|
||||||
|
appRef.isStable.subscribe(() => {
|
||||||
|
if (this.isListening) return;
|
||||||
|
this.isListening = true;
|
||||||
|
|
||||||
updateCheckTimer$.subscribe(() => {
|
updateCheckTimer$.subscribe(() => {
|
||||||
updates.checkForUpdate();
|
updates.checkForUpdate();
|
||||||
});
|
});
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
loadNewAppVersion() {
|
loadNewAppVersion() {
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
"background_color": "#fafafa",
|
"background_color": "#fafafa",
|
||||||
"display": "standalone",
|
"display": "standalone",
|
||||||
"scope": "/",
|
"scope": "/",
|
||||||
"start_url": "/index.html",
|
"start_url": "/",
|
||||||
"icons": [
|
"icons": [
|
||||||
{
|
{
|
||||||
"src": "assets/icons/icon-72x72.png",
|
"src": "assets/icons/icon-72x72.png",
|
||||||
|
|
Loading…
Reference in New Issue