diff --git a/projects/player/src/app/components/unit/unit.component.ts b/projects/player/src/app/components/unit/unit.component.ts index c7f9688c37ffd69bd5c5952d89dd6e7a7d3fce9d..36aa01daccffd0c72f048bfb623128878e08fc51 100644 --- a/projects/player/src/app/components/unit/unit.component.ts +++ b/projects/player/src/app/components/unit/unit.component.ts @@ -54,16 +54,10 @@ export class UnitComponent implements OnInit { try { LogService.debug('player: unitDefinition', message.unitDefinition); const unitDefinition = JSON.parse(message.unitDefinition as string); - if (!VersionManager.hasCompatibleVersion(unitDefinition)) { - if (VersionManager.isNewer(unitDefinition)) { - throw Error(this.translateService.instant('errorMessage.unitDefinitionIsNewer')); - } - throw Error(this.translateService.instant('errorMessage.unitDefinitionIsOutdated')); - } + this.checkUnitdefinitionVersion(unitDefinition); const unit: Unit = new Unit(unitDefinition); this.pages = unit.pages; this.playerConfig = message.playerConfig || {}; - LogService.info('player: unitStateElementCodes', this.unitStateService.elementCodes); this.metaDataService.resourceURL = this.playerConfig.directDownloadUrl; this.veronaPostService.sessionID = message.sessionId; this.initElementCodes(message, unit); @@ -89,6 +83,15 @@ export class UnitComponent implements OnInit { } } + private checkUnitdefinitionVersion(unitDefinition: Record<string, unknown>): void { + if (!VersionManager.hasCompatibleVersion(unitDefinition)) { + if (VersionManager.isNewer(unitDefinition)) { + throw Error(this.translateService.instant('errorMessage.unitDefinitionIsNewer')); + } + throw Error(this.translateService.instant('errorMessage.unitDefinitionIsOutdated')); + } + } + private showErrorDialog(text: string): void { this.dialog.open(UnitDefErrorDialogComponent, { data: { text: text },