Skip to content
Snippets Groups Projects
Commit 11dcd294 authored by jojohoch's avatar jojohoch
Browse files

[player] Send event about the presented pages when re-entering the unit

parent 781568b0
No related branches found
No related tags found
No related merge requests found
Pipeline #38476 passed
......@@ -108,18 +108,18 @@ export class UnitStateService {
if (ElementCodeStatusValue[status] > ElementCodeStatusValue[unitStateElementCode.status]) {
unitStateElementCode.status = status;
this._elementCodeChanged.next(unitStateElementCode);
this.checkPresentedPageStatus(this.elementIdPageIndexMap[id], true);
this.checkPresentedPageStatus(this.elementIdPageIndexMap[id]);
}
}
}
private buildPresentedPages(): void {
const uniqPages = [...new Set( Object.values(this.elementIdPageIndexMap))];
uniqPages.forEach((pageIndex, index) => this
.checkPresentedPageStatus(pageIndex, index === uniqPages.length - 1));
uniqPages.forEach(pageIndex => this
.checkPresentedPageStatus(pageIndex));
}
private checkPresentedPageStatus(pageIndex: number, emitEvent: boolean): void {
private checkPresentedPageStatus(pageIndex: number): void {
if (this.presentedPages.indexOf(pageIndex) === -1) {
const notDisplayedElements = Object.entries(this.elementIdPageIndexMap)
.filter((map: [string, number]): boolean => map[1] === pageIndex)
......@@ -129,9 +129,7 @@ export class UnitStateService {
ElementCodeStatusValue.DISPLAYED);
if (notDisplayedElements.length === 0) {
this.presentedPages.push(pageIndex);
if (emitEvent) {
this._presentedPageAdded.next(pageIndex);
}
this._presentedPageAdded.next(pageIndex);
}
} else {
LogService.warn(`player: page ${pageIndex} is already presented`);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment