fix update listening

This commit is contained in:
Nicolas Constant 2020-02-27 20:25:37 -05:00
parent 239e86332f
commit 5e7d151cad
No known key found for this signature in database
GPG Key ID: 1E9F677FB01A5688
2 changed files with 11 additions and 3 deletions

View File

@ -10,6 +10,8 @@ export class ServiceWorkerService {
newAppVersionIsAvailable = new BehaviorSubject<boolean>(false);
private isListening = false;
constructor(appRef: ApplicationRef, updates: SwUpdate) {
//https://angular.io/guide/service-worker-communications
@ -30,9 +32,15 @@ export class ServiceWorkerService {
// });
const updateCheckTimer$ = interval(6 * 60 * 60 * 1000);
appRef.isStable.subscribe(() => {
if (this.isListening) return;
this.isListening = true;
updateCheckTimer$.subscribe(() => {
updates.checkForUpdate();
});
});
}
loadNewAppVersion() {

View File

@ -5,7 +5,7 @@
"background_color": "#fafafa",
"display": "standalone",
"scope": "/",
"start_url": "/index.html",
"start_url": "/",
"icons": [
{
"src": "assets/icons/icon-72x72.png",