Downloads (Follow-up) (#1510)

This commit is contained in:
Alexander Zinchuk 2021-10-22 02:24:39 +03:00
parent f32195571e
commit 74a0f96b6c
4 changed files with 5 additions and 4 deletions

View File

@ -88,7 +88,7 @@ const Photo: FC<OwnProps> = ({
isUploading, isTransferring, transferProgress,
} = getMediaTransferState(
message,
uploadProgress || isDownloading ? downloadProgress : loadProgress,
uploadProgress || (isDownloading ? downloadProgress : loadProgress),
shouldLoad && !fullMediaData,
);
const wasLoadDisabled = usePrevious(isLoadAllowed) === false;

View File

@ -102,7 +102,7 @@ const Video: FC<OwnProps> = ({
const { isBuffered, bufferingHandlers } = useBuffering(!shouldAutoLoad);
const { isUploading, isTransferring, transferProgress } = getMediaTransferState(
message,
uploadProgress || isDownloading ? downloadProgress : loadProgress,
uploadProgress || (isDownloading ? downloadProgress : loadProgress),
(shouldLoad && !isBuffered) || isDownloading,
);
const wasLoadDisabled = usePrevious(isLoadAllowed) === false;

View File

@ -258,7 +258,7 @@ export function getMessageContentFilename(message: ApiMessage) {
const baseFilename = getMessageKey(message);
if (photo) {
return `${baseFilename}.png`;
return `${baseFilename}.jpg`;
}
if (content.voice) {

View File

@ -84,7 +84,8 @@ export function cancelProgress(progressCallback: ApiOnProgress) {
progressCallbacks.forEach((map, url) => {
map.forEach((callback) => {
if (callback === progressCallback) {
const parentCallback = cancellableCallbacks.get(url)!;
const parentCallback = cancellableCallbacks.get(url);
if (!parentCallback) return;
cancelApiProgress(parentCallback);
cancellableCallbacks.delete(url);