mirror of
https://code.briarproject.org/briar/briar.git
synced 2026-02-12 02:39:05 +01:00
Only cache attachment items that include size.
This commit is contained in:
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user