Document: Do not open big media in MV (#6144)
This commit is contained in:
parent
428d7bb36c
commit
17dd4d47b0
@ -454,6 +454,7 @@ export function buildApiDocument(document: GramJs.TypeDocument): ApiDocument | u
|
|||||||
mediaSize = {
|
mediaSize = {
|
||||||
width,
|
width,
|
||||||
height,
|
height,
|
||||||
|
fromDocumentAttribute: true,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
} else if (SUPPORTED_VIDEO_CONTENT_TYPES.has(mimeType)) {
|
} else if (SUPPORTED_VIDEO_CONTENT_TYPES.has(mimeType)) {
|
||||||
|
|||||||
@ -153,7 +153,7 @@ export interface ApiDocument {
|
|||||||
previewPhotoSizes?: ApiPhotoSize[];
|
previewPhotoSizes?: ApiPhotoSize[];
|
||||||
previewBlobUrl?: string;
|
previewBlobUrl?: string;
|
||||||
innerMediaType?: 'photo' | 'video';
|
innerMediaType?: 'photo' | 'video';
|
||||||
mediaSize?: ApiDimensions;
|
mediaSize?: ApiDimensions & { fromDocumentAttribute?: boolean };
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface ApiContact {
|
export interface ApiContact {
|
||||||
|
|||||||
@ -119,7 +119,9 @@ const Document = ({
|
|||||||
const localBlobUrl = hasPreview ? document.previewBlobUrl : undefined;
|
const localBlobUrl = hasPreview ? document.previewBlobUrl : undefined;
|
||||||
const previewData = useMedia(getDocumentMediaHash(document, 'pictogram'), !isIntersecting);
|
const previewData = useMedia(getDocumentMediaHash(document, 'pictogram'), !isIntersecting);
|
||||||
|
|
||||||
const withMediaViewer = onMediaClick && document.innerMediaType;
|
const shouldForceDownload = document.innerMediaType === 'photo' && !document.mediaSize?.fromDocumentAttribute;
|
||||||
|
|
||||||
|
const withMediaViewer = onMediaClick && document.innerMediaType && !shouldForceDownload;
|
||||||
|
|
||||||
const handleDownload = useLastCallback(() => {
|
const handleDownload = useLastCallback(() => {
|
||||||
downloadMedia({ media: document, originMessage: message });
|
downloadMedia({ media: document, originMessage: message });
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user