mirror of
https://github.com/danog/telegram-tt.git
synced 2024-12-14 10:09:07 +01:00
Downloads (Follow-up) (#1510)
This commit is contained in:
parent
f32195571e
commit
74a0f96b6c
@ -88,7 +88,7 @@ const Photo: FC<OwnProps> = ({
|
|||||||
isUploading, isTransferring, transferProgress,
|
isUploading, isTransferring, transferProgress,
|
||||||
} = getMediaTransferState(
|
} = getMediaTransferState(
|
||||||
message,
|
message,
|
||||||
uploadProgress || isDownloading ? downloadProgress : loadProgress,
|
uploadProgress || (isDownloading ? downloadProgress : loadProgress),
|
||||||
shouldLoad && !fullMediaData,
|
shouldLoad && !fullMediaData,
|
||||||
);
|
);
|
||||||
const wasLoadDisabled = usePrevious(isLoadAllowed) === false;
|
const wasLoadDisabled = usePrevious(isLoadAllowed) === false;
|
||||||
|
@ -102,7 +102,7 @@ const Video: FC<OwnProps> = ({
|
|||||||
const { isBuffered, bufferingHandlers } = useBuffering(!shouldAutoLoad);
|
const { isBuffered, bufferingHandlers } = useBuffering(!shouldAutoLoad);
|
||||||
const { isUploading, isTransferring, transferProgress } = getMediaTransferState(
|
const { isUploading, isTransferring, transferProgress } = getMediaTransferState(
|
||||||
message,
|
message,
|
||||||
uploadProgress || isDownloading ? downloadProgress : loadProgress,
|
uploadProgress || (isDownloading ? downloadProgress : loadProgress),
|
||||||
(shouldLoad && !isBuffered) || isDownloading,
|
(shouldLoad && !isBuffered) || isDownloading,
|
||||||
);
|
);
|
||||||
const wasLoadDisabled = usePrevious(isLoadAllowed) === false;
|
const wasLoadDisabled = usePrevious(isLoadAllowed) === false;
|
||||||
|
@ -258,7 +258,7 @@ export function getMessageContentFilename(message: ApiMessage) {
|
|||||||
const baseFilename = getMessageKey(message);
|
const baseFilename = getMessageKey(message);
|
||||||
|
|
||||||
if (photo) {
|
if (photo) {
|
||||||
return `${baseFilename}.png`;
|
return `${baseFilename}.jpg`;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (content.voice) {
|
if (content.voice) {
|
||||||
|
@ -84,7 +84,8 @@ export function cancelProgress(progressCallback: ApiOnProgress) {
|
|||||||
progressCallbacks.forEach((map, url) => {
|
progressCallbacks.forEach((map, url) => {
|
||||||
map.forEach((callback) => {
|
map.forEach((callback) => {
|
||||||
if (callback === progressCallback) {
|
if (callback === progressCallback) {
|
||||||
const parentCallback = cancellableCallbacks.get(url)!;
|
const parentCallback = cancellableCallbacks.get(url);
|
||||||
|
if (!parentCallback) return;
|
||||||
|
|
||||||
cancelApiProgress(parentCallback);
|
cancelApiProgress(parentCallback);
|
||||||
cancellableCallbacks.delete(url);
|
cancellableCallbacks.delete(url);
|
||||||
|
Loading…
Reference in New Issue
Block a user