Commit b6b15fe6 authored by akwizgran's avatar akwizgran

Only cache attachment items that include size.

parent f3bbc717
Pipeline #3604 passed with stage
in 8 minutes and 51 seconds
......@@ -119,7 +119,7 @@ class AttachmentCreationTask {
AttachmentItem item =
retriever.getAttachmentItem(header, a, needsSize);
if (item.hasError()) throw new IOException();
retriever.cachePut(item);
if (needsSize) retriever.cachePut(item);
return new AttachmentItemResult(uri, item);
} catch (DbException | IOException e) {
logException(LOG, WARNING, e);
......
......@@ -545,6 +545,8 @@ public class ConversationActivity extends BriarActivity
// TODO move getting the items off to IoExecutor, if size == 1
List<AttachmentItem> items =
attachmentRetriever.getAttachmentItems(attachments);
if (items.size() == 1)
attachmentRetriever.cachePut(items.get(0));
displayMessageAttachments(messageId, items);
} catch (DbException e) {
logException(LOG, WARNING, e);
......@@ -555,9 +557,6 @@ public class ConversationActivity extends BriarActivity
private void displayMessageAttachments(MessageId m,
List<AttachmentItem> items) {
runOnUiThreadUnlessDestroyed(() -> {
for (AttachmentItem item : items) {
attachmentRetriever.cachePut(item);
}
Pair<Integer, ConversationMessageItem> pair =
adapter.getMessageItem(m);
if (pair != null) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment