Merge pull request #5166 from tsiegleauq/service-worker-regression

Re-enable Service Worker
This commit is contained in:
Sean 2019-12-17 11:01:31 +01:00 committed by GitHub
commit 7a26a87cf8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 13 additions and 3 deletions

View File

@ -1,6 +1,6 @@
{ {
"name": "OpenSlides3-Client", "name": "OpenSlides3-Client",
"version": "3.0.0-alpha", "version": "3.1.1",
"repository": { "repository": {
"type": "git", "type": "git",
"url": "git://github.com/OpenSlides/OpenSlides.git" "url": "git://github.com/OpenSlides/OpenSlides.git"

View File

@ -1,7 +1,8 @@
import { Component } from '@angular/core'; import { ApplicationRef, Component } from '@angular/core';
import { Router } from '@angular/router'; import { Router } from '@angular/router';
import { TranslateService } from '@ngx-translate/core'; import { TranslateService } from '@ngx-translate/core';
import { filter, take } from 'rxjs/operators';
import { ConfigService } from './core/ui-services/config.service'; import { ConfigService } from './core/ui-services/config.service';
import { ConstantsService } from './core/core-services/constants.service'; import { ConstantsService } from './core/core-services/constants.service';
@ -64,6 +65,7 @@ export class AppComponent {
*/ */
public constructor( public constructor(
translate: TranslateService, translate: TranslateService,
appRef: ApplicationRef,
servertimeService: ServertimeService, servertimeService: ServertimeService,
router: Router, router: Router,
operator: OperatorService, operator: OperatorService,
@ -93,7 +95,15 @@ export class AppComponent {
this.overloadFlatMap(); this.overloadFlatMap();
this.overloadModulo(); this.overloadModulo();
servertimeService.startScheduler(); // Wait until the App reaches a stable state.
// Required for the Service Worker.
appRef.isStable
.pipe(
// take only the stable state
filter(s => s),
take(1)
)
.subscribe(() => servertimeService.startScheduler());
} }
/** /**