diff --git a/apps/red-ui/src/app/modules/dossier/screens/file-preview-screen/file-preview-screen.component.html b/apps/red-ui/src/app/modules/dossier/screens/file-preview-screen/file-preview-screen.component.html index 3b8387637..b18e1c5fe 100644 --- a/apps/red-ui/src/app/modules/dossier/screens/file-preview-screen/file-preview-screen.component.html +++ b/apps/red-ui/src/app/modules/dossier/screens/file-preview-screen/file-preview-screen.component.html @@ -95,7 +95,11 @@ icon="red:needs-work" > - + ; readonly dossier$: Observable; - readonly viewDocumentInfo$: Observable; readonly file$: Observable; readonly fileId: string; ready = false; @@ -121,7 +120,6 @@ export class FilePreviewScreenComponent extends AutoUnsubscribe implements OnIni }), shareLast(), ); - this.viewDocumentInfo$ = this._viewDocumentInfo$; this.canPerformAnnotationActions$ = this._canPerformAnnotationActions$; document.documentElement.addEventListener('fullscreenchange', () => { @@ -147,18 +145,6 @@ export class FilePreviewScreenComponent extends AutoUnsubscribe implements OnIni return this.viewModeService.isStandard ? currentPage : currentPage % 2 === 0 ? currentPage / 2 : (currentPage + 1) / 2; } - private get _viewDocumentInfo$() { - return this.documentInfoService.shown$.pipe( - tap(value => { - if (value) { - this.multiSelectService.deactivate(); - this.excludedPagesService.hide(); - } - }), - shareDistinctLast(), - ); - } - private get _canPerformAnnotationActions$() { return combineLatest([this.file$, this.viewModeService.viewMode$]).pipe( map(([file, viewMode]) => this.permissionsService.canPerformAnnotationActions(file) && viewMode === 'STANDARD'), diff --git a/apps/red-ui/src/app/modules/dossier/screens/file-preview-screen/services/document-info.service.ts b/apps/red-ui/src/app/modules/dossier/screens/file-preview-screen/services/document-info.service.ts index 156fcd7c6..60023ef3a 100644 --- a/apps/red-ui/src/app/modules/dossier/screens/file-preview-screen/services/document-info.service.ts +++ b/apps/red-ui/src/app/modules/dossier/screens/file-preview-screen/services/document-info.service.ts @@ -1,11 +1,13 @@ import { Injectable } from '@angular/core'; import { BehaviorSubject, merge, Observable } from 'rxjs'; import { shareLast } from '@iqser/common-ui'; -import { filter, map, startWith, withLatestFrom } from 'rxjs/operators'; +import { filter, map, startWith, tap, withLatestFrom } from 'rxjs/operators'; import { DossierTemplatesService } from '@services/entity-services/dossier-templates.service'; import { FileAttributesService } from '@services/entity-services/file-attributes.service'; import { FilesMapService } from '@services/entity-services/files-map.service'; import { File, IFileAttributeConfig } from '@red/domain'; +import { MultiSelectService } from './multi-select.service'; +import { ExcludedPagesService } from './excluded-pages.service'; @Injectable() export class DocumentInfoService { @@ -17,8 +19,18 @@ export class DocumentInfoService { private readonly _dossierTemplatesService: DossierTemplatesService, private readonly _fileAttributesService: FileAttributesService, private readonly _filesMapService: FilesMapService, + private readonly _multiSelectService: MultiSelectService, + private readonly _excludedPagesService: ExcludedPagesService, ) { - this.shown$ = this._show$.asObservable().pipe(shareLast()); + this.shown$ = this._show$.asObservable().pipe( + tap(show => { + if (show) { + this._multiSelectService.deactivate(); + this._excludedPagesService.hide(); + } + }), + shareLast(), + ); this.hidden$ = this.shown$.pipe( map(value => !value), shareLast(),