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

View File

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

View File

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