RED-6558, fixed download notifications redirect.
This commit is contained in:
parent
bf191d25ea
commit
421e26a922
@ -1,28 +1,36 @@
|
||||
import { Injectable } from '@angular/core';
|
||||
import { CanActivate } from '@angular/router';
|
||||
import { CanActivate, Router } from '@angular/router';
|
||||
import { REDDocumentViewer } from './document-viewer.service';
|
||||
import { PdfViewer } from './pdf-viewer.service';
|
||||
import { REDAnnotationManager } from './annotation-manager.service';
|
||||
import { ViewerHeaderService } from './viewer-header.service';
|
||||
import { LoadingService } from '@iqser/common-ui';
|
||||
import { WebViewerInstance } from '@pdftron/webviewer';
|
||||
|
||||
@Injectable()
|
||||
export class WebViewerLoadedGuard implements CanActivate {
|
||||
constructor(
|
||||
private readonly _documentViewer: REDDocumentViewer,
|
||||
private readonly _pdf: PdfViewer,
|
||||
private readonly _router: Router,
|
||||
private readonly _annotationManager: REDAnnotationManager,
|
||||
private readonly _viewerHeaderService: ViewerHeaderService,
|
||||
private readonly _loadingService: LoadingService,
|
||||
) {}
|
||||
|
||||
async canActivate() {
|
||||
async canActivate(_, state) {
|
||||
if (this._pdf.instance) {
|
||||
return true;
|
||||
}
|
||||
|
||||
this._loadingService.start();
|
||||
const instance = await this._pdf.init(document.getElementById('viewer'));
|
||||
|
||||
let instance: WebViewerInstance | undefined;
|
||||
try {
|
||||
instance = await this._pdf.init(document.getElementById('viewer'));
|
||||
} catch {
|
||||
return this._router.navigateByUrl(state.url);
|
||||
}
|
||||
|
||||
this._annotationManager.init(instance.Core.annotationManager);
|
||||
this._documentViewer.init(instance.Core.documentViewer);
|
||||
|
||||
@ -1 +1 @@
|
||||
Subproject commit 7e4e51f82c0b6748ab1b791139c73f934120694e
|
||||
Subproject commit 77a84882cc7e5a44a35363cc779e2788acc6755a
|
||||
Loading…
x
Reference in New Issue
Block a user