This commit is contained in:
2024-12-23 14:33:49 +01:00
parent cbbb2329bb
commit 29a016dbf0
3 changed files with 23 additions and 13 deletions

View File

@@ -6,7 +6,8 @@ import {
ChangeDetectorRef,
HostBinding,
AfterViewInit,
Renderer2
Renderer2,
NgZone
} from '@angular/core';
import { ActivatedRoute } from '@angular/router';
import { DomSanitizer, SafeHtml } from '@angular/platform-browser';
@@ -34,6 +35,7 @@ interface CssVariables {
tileRowGapinPercent: string;
flaggeLeft: string;
flaggeBottom: string;
reload: string;
}
const TVTEXTSETTINGS_INTERVAL_MS = 60000;
@@ -117,7 +119,7 @@ export class AvisoPage implements OnInit, OnDestroy, AfterViewInit {
private toggleDivInterval: any;
private currentCssVariables: CssVariables | null = null;
// NEU: Für den globalen Wechseltext
public toggleWechselText: boolean = false;
private GLOBAL_WECHSELTEXT_INTERVAL: any;
@@ -140,7 +142,8 @@ export class AvisoPage implements OnInit, OnDestroy, AfterViewInit {
private avisoService: AvisoService,
private cdr: ChangeDetectorRef,
private sanitizer: DomSanitizer,
private renderer: Renderer2
private renderer: Renderer2,
private ngZone: NgZone
) { }
private convertToPx(fontSize: string): number {
@@ -219,7 +222,7 @@ export class AvisoPage implements OnInit, OnDestroy, AfterViewInit {
});
// TV Settings laden
interval(TVSETTINGS_INTERVAL_MS)
interval((this.avisoTvSettings[0]?.seitenwechselInSek * 1000 - 1000) || TVSETTINGS_INTERVAL_MS)
.pipe(
switchMap(() => this.loadAvisoTvSettings()),
takeUntil(this.destroy$)
@@ -405,6 +408,7 @@ export class AvisoPage implements OnInit, OnDestroy, AfterViewInit {
tileRowGapinPercent: `${settings.kachelRowGapInPercent}px`,
flaggeLeft: `${settings.flaggeLeft}vw`,
flaggeBottom: `${settings.flaggeBottom}vh`,
reload: `${settings.reload}`,
};
if (this.currentCssVariables && this.hasCssVariablesChanged(newCssVariables)) {
@@ -700,22 +704,27 @@ export class AvisoPage implements OnInit, OnDestroy, AfterViewInit {
if (!aviso || !aviso.avisoTVHinweis) {
return;
}
// "true" => normaler Inhalt, "false" => Hinweis
if (this.avisoStates[key]) {
if (this.avisoStates[key]) {
this.avisoTimeouts[key] = setTimeout(() => {
this.avisoStates[key] = false;
this.startAvisoCycle(key);
this.cdr.detectChanges();
this.ngZone.run(() => {
this.avisoStates[key] = false;
this.startAvisoCycle(key);
this.cdr.detectChanges();
});
}, this.contentDuration);
} else {
this.avisoTimeouts[key] = setTimeout(() => {
this.avisoStates[key] = true;
this.startAvisoCycle(key);
this.cdr.detectChanges();
this.ngZone.run(() => {
this.avisoStates[key] = true;
this.startAvisoCycle(key);
this.cdr.detectChanges();
});
}, this.avisoHinweisDuration);
}
}
private findAvisoByKey(key: string): AvisoDto | undefined {
for (const page of this.pages) {
for (const aviso of page) {

View File

@@ -29,6 +29,7 @@ export interface TvSettings {
logo: string;
flaggeLeft: string;
flaggeBottom: string;
reload: boolean;
}
export interface AvisoTvTextSettingsDto {

View File

@@ -3,7 +3,7 @@
<head>
<meta charset="utf-8" />
<title>Ionic App</title>
<title>VERAG AG TV-APP</title>
<base href="/" />