Merge pull request #6112 from tsiegleauq/remove-cd-from-ap-completely

Remove CD from Cinema completely
This commit is contained in:
Emanuel Schütze 2021-06-10 11:59:25 +02:00 committed by GitHub
commit bf22e1b6e1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1,4 +1,4 @@
import { AfterViewInit, ChangeDetectionStrategy, ChangeDetectorRef, Component, OnInit, ViewChild } from '@angular/core'; import { Component, OnInit } from '@angular/core';
import { MatSnackBar } from '@angular/material/snack-bar'; import { MatSnackBar } from '@angular/material/snack-bar';
import { Title } from '@angular/platform-browser'; import { Title } from '@angular/platform-browser';
@ -19,10 +19,9 @@ import { CurrentListOfSpeakersService } from 'app/site/projector/services/curren
@Component({ @Component({
selector: 'os-cinema', selector: 'os-cinema',
templateUrl: './cinema.component.html', templateUrl: './cinema.component.html',
styleUrls: ['./cinema.component.scss'], styleUrls: ['./cinema.component.scss']
changeDetection: ChangeDetectionStrategy.Default
}) })
export class CinemaComponent extends BaseViewComponentDirective implements OnInit, AfterViewInit { export class CinemaComponent extends BaseViewComponentDirective implements OnInit {
public listOfSpeakers: ViewListOfSpeakers; public listOfSpeakers: ViewListOfSpeakers;
public projector: ViewProjector; public projector: ViewProjector;
private currentProjectorElement: ProjectorElement; private currentProjectorElement: ProjectorElement;
@ -93,18 +92,14 @@ export class CinemaComponent extends BaseViewComponentDirective implements OnIni
snackBar: MatSnackBar, snackBar: MatSnackBar,
private operator: OperatorService, private operator: OperatorService,
private projectorService: ProjectorService, private projectorService: ProjectorService,
private projectorRepo: ProjectorRepositoryService, projectorRepo: ProjectorRepositoryService,
private closService: CurrentListOfSpeakersService, closService: CurrentListOfSpeakersService,
private listOfSpeakersRepo: ListOfSpeakersRepositoryService, private listOfSpeakersRepo: ListOfSpeakersRepositoryService
private cd: ChangeDetectorRef
) { ) {
super(title, translate, snackBar); super(title, translate, snackBar);
}
public ngOnInit(): void {
super.setTitle('Autopilot');
this.subscriptions.push( this.subscriptions.push(
this.projectorRepo.getReferenceProjectorObservable().subscribe(refProjector => { projectorRepo.getReferenceProjectorObservable().subscribe(refProjector => {
this.projector = refProjector; this.projector = refProjector;
this.currentProjectorElement = refProjector?.firstUnstableElement || null; this.currentProjectorElement = refProjector?.firstUnstableElement || null;
if (this.currentProjectorElement) { if (this.currentProjectorElement) {
@ -114,17 +109,15 @@ export class CinemaComponent extends BaseViewComponentDirective implements OnIni
} else { } else {
this.projectedViewModel = null; this.projectedViewModel = null;
} }
this.delayedCheck();
}), }),
this.closService.currentListOfSpeakersObservable.subscribe(clos => { closService.currentListOfSpeakersObservable.subscribe(clos => {
this.listOfSpeakers = clos; this.listOfSpeakers = clos;
this.cd.markForCheck();
}) })
); );
} }
public ngAfterViewInit(): void { public ngOnInit(): void {
this.delayedCheck(); super.setTitle('Autopilot');
} }
public async toggleListOfSpeakersOpen(): Promise<void> { public async toggleListOfSpeakersOpen(): Promise<void> {
@ -134,16 +127,4 @@ export class CinemaComponent extends BaseViewComponentDirective implements OnIni
public async readdLastSpeaker(): Promise<void> { public async readdLastSpeaker(): Promise<void> {
await this.listOfSpeakersRepo.readdLastSpeaker(this.listOfSpeakers).catch(this.raiseError); await this.listOfSpeakersRepo.readdLastSpeaker(this.listOfSpeakers).catch(this.raiseError);
} }
/**
* Ref Projector Update fireing and Projector content updates
* are not in sync.
* This is a deep projector issue, OpenSlides has no chance
* to really know when the projector content is ready
*/
private delayedCheck(): void {
setTimeout(() => {
this.cd.markForCheck();
}, 2000);
}
} }