From 935bcaeb85d27d86b1c0828a45a71f3410b1ef13 Mon Sep 17 00:00:00 2001 From: John Gibbon Date: Fri, 15 Jan 2021 21:34:58 +0100 Subject: [PATCH] Fix Locations --- qml/components/messageContent/MessageLocation.qml | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/qml/components/messageContent/MessageLocation.qml b/qml/components/messageContent/MessageLocation.qml index fa7c35a..c6c46d7 100644 --- a/qml/components/messageContent/MessageLocation.qml +++ b/qml/components/messageContent/MessageLocation.qml @@ -51,17 +51,16 @@ MessageContentBase { Connections { target: tdLibWrapper onFileUpdated: { - if(fileInformation["@extra"] !== imagePreviewItem.fileExtra) { + if(fileInformation["@extra"] !== imagePreviewItem.fileExtra && (!imagePreviewItem.pictureFileInformation || imagePreviewItem.pictureFileInformation.id !== fileInformation.id)) { return; } - - if(!imagePreviewItem.pictureFileInformation) { - imagePreviewItem.pictureFileInformation = fileInformation; - tdLibWrapper.downloadFile(imagePreviewItem.pictureFileInformation.id); - } else if(imagePreviewItem.pictureFileInformation && fileInformation.id === imagePreviewItem.pictureFileInformation.id) { - imagePreviewItem.pictureFileInformation = fileInformation; + if(fileInformation.local.is_downloading_completed) { singleImage.source = fileInformation.local.path; + } else if(fileInformation.local.can_be_downloaded && !fileInformation.local.is_downloading_active) { + tdLibWrapper.downloadFile(fileInformation.id); } + + imagePreviewItem.pictureFileInformation = fileInformation; } }