documents preview - image
This commit is contained in:
@@ -3,7 +3,6 @@ import { Component, computed, effect, ElementRef, inject, NgZone, OnDestroy, sig
|
||||
import { toSignal } from '@angular/core/rxjs-interop';
|
||||
import { FormsModule } from '@angular/forms';
|
||||
import { ActivatedRoute, Router, RouterLink } from '@angular/router';
|
||||
import { OfficePdfPreviewComponent } from './office-pdf-preview.component';
|
||||
|
||||
import { PeerCallModalComponent } from './peer-call-modal.component';
|
||||
import { ChatSessionService } from './chat-session.service';
|
||||
@@ -17,7 +16,6 @@ import type { CallMode, ChatEntry, ConnectionState, PeerSummary } from './models
|
||||
FormsModule,
|
||||
RouterLink,
|
||||
JsonFileViewerComponent,
|
||||
OfficePdfPreviewComponent,
|
||||
PeerCallModalComponent,
|
||||
],
|
||||
templateUrl: './chat-page.component.html',
|
||||
@@ -646,31 +644,20 @@ export class ChatPageComponent implements OnDestroy {
|
||||
);
|
||||
}
|
||||
|
||||
hasPdfPreview(entry: ChatEntry): boolean {
|
||||
hasDocumentPreviewImage(entry: ChatEntry): boolean {
|
||||
return (
|
||||
entry.kind === 'file' &&
|
||||
(
|
||||
(
|
||||
entry.previewMimeType === 'application/pdf' &&
|
||||
!!entry.previewDownloadUrl
|
||||
) ||
|
||||
(
|
||||
!!entry.downloadUrl &&
|
||||
(
|
||||
entry.fileMimeType === 'application/pdf' ||
|
||||
entry.fileName?.toLowerCase().endsWith('.pdf') === true
|
||||
)
|
||||
)
|
||||
)
|
||||
!!entry.previewDownloadUrl &&
|
||||
(entry.previewMimeType?.startsWith('image/') ?? false)
|
||||
);
|
||||
}
|
||||
|
||||
pdfPreviewUrl(entry: ChatEntry): string | null {
|
||||
if (!this.hasPdfPreview(entry)) {
|
||||
documentPreviewImageUrl(entry: ChatEntry): string | null {
|
||||
if (!this.hasDocumentPreviewImage(entry)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return entry.previewDownloadUrl ?? entry.downloadUrl ?? null;
|
||||
return entry.previewDownloadUrl ?? null;
|
||||
}
|
||||
|
||||
isPeerTyping(peerId: string): boolean {
|
||||
|
||||
Reference in New Issue
Block a user