From e448dc682328f689234b1dd19b34ee3380294e4e Mon Sep 17 00:00:00 2001 From: fmodf Date: Tue, 16 Jul 2024 19:17:19 +0200 Subject: [PATCH] wip --- .../AppCore/Middlewares/FileMiddleware.swift | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/ConversationsClassic/AppCore/Middlewares/FileMiddleware.swift b/ConversationsClassic/AppCore/Middlewares/FileMiddleware.swift index 6008dd2..9b25e36 100644 --- a/ConversationsClassic/AppCore/Middlewares/FileMiddleware.swift +++ b/ConversationsClassic/AppCore/Middlewares/FileMiddleware.swift @@ -30,21 +30,19 @@ final class FileMiddleware { // for outgoing messages with shared attachments for message in messages where message.attachmentLocalPath != nil && message.attachmentRemotePath == nil && message.pending { - if wSelf.downloadingMessageIDs.contains(message.id) { - continue - } - wSelf.downloadingMessageIDs.insert(message.id) DispatchQueue.main.async { store.dispatch(.xmppAction(.xmppSharingTryUpload(message))) } } // for outgoing messages with shared attachments which are already uploaded - // but have no thumbnail - for message in messages where message.attachmentLocalName != nil && message.attachmentRemotePath != nil && message.attachmentThumbnailName == nil && !message.pending && !message.sentError { - DispatchQueue.main.async { - // swiftlint:disable:next force_unwrapping - store.dispatch(.fileAction(.createAttachmentThumbnail(messageId: message.id, localName: message.attachmentLocalName!))) + // but have no thumbnail (only for images) + for message in messages where !message.pending && !message.sentError && message.attachmentType == .image { + if message.attachmentLocalName != nil && message.attachmentRemotePath != nil && message.attachmentThumbnailName == nil { + DispatchQueue.main.async { + // swiftlint:disable:next force_unwrapping + store.dispatch(.fileAction(.createAttachmentThumbnail(messageId: message.id, localName: message.attachmentLocalName!))) + } } }