mirror of
https://code.briarproject.org/briar/briar.git
synced 2026-02-15 20:29:52 +01:00
Only cache attachment items that include size.
This commit is contained in:
@@ -119,7 +119,7 @@ class AttachmentCreationTask {
|
|||||||
AttachmentItem item =
|
AttachmentItem item =
|
||||||
retriever.getAttachmentItem(header, a, needsSize);
|
retriever.getAttachmentItem(header, a, needsSize);
|
||||||
if (item.hasError()) throw new IOException();
|
if (item.hasError()) throw new IOException();
|
||||||
retriever.cachePut(item);
|
if (needsSize) retriever.cachePut(item);
|
||||||
return new AttachmentItemResult(uri, item);
|
return new AttachmentItemResult(uri, item);
|
||||||
} catch (DbException | IOException e) {
|
} catch (DbException | IOException e) {
|
||||||
logException(LOG, WARNING, 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
|
// TODO move getting the items off to IoExecutor, if size == 1
|
||||||
List<AttachmentItem> items =
|
List<AttachmentItem> items =
|
||||||
attachmentRetriever.getAttachmentItems(attachments);
|
attachmentRetriever.getAttachmentItems(attachments);
|
||||||
|
if (items.size() == 1)
|
||||||
|
attachmentRetriever.cachePut(items.get(0));
|
||||||
displayMessageAttachments(messageId, items);
|
displayMessageAttachments(messageId, items);
|
||||||
} catch (DbException e) {
|
} catch (DbException e) {
|
||||||
logException(LOG, WARNING, e);
|
logException(LOG, WARNING, e);
|
||||||
@@ -555,9 +557,6 @@ public class ConversationActivity extends BriarActivity
|
|||||||
private void displayMessageAttachments(MessageId m,
|
private void displayMessageAttachments(MessageId m,
|
||||||
List<AttachmentItem> items) {
|
List<AttachmentItem> items) {
|
||||||
runOnUiThreadUnlessDestroyed(() -> {
|
runOnUiThreadUnlessDestroyed(() -> {
|
||||||
for (AttachmentItem item : items) {
|
|
||||||
attachmentRetriever.cachePut(item);
|
|
||||||
}
|
|
||||||
Pair<Integer, ConversationMessageItem> pair =
|
Pair<Integer, ConversationMessageItem> pair =
|
||||||
adapter.getMessageItem(m);
|
adapter.getMessageItem(m);
|
||||||
if (pair != null) {
|
if (pair != null) {
|
||||||
|
|||||||
Reference in New Issue
Block a user