diff --git a/res/layout/conversation_item_thumbnail.xml b/res/layout/conversation_item_thumbnail.xml
index fe438060da..bff1a90fa8 100644
--- a/res/layout/conversation_item_thumbnail.xml
+++ b/res/layout/conversation_item_thumbnail.xml
@@ -45,15 +45,4 @@
app:footer_text_color="@android:color/white"
app:footer_icon_color="@android:color/white"/>
-
-
diff --git a/res/layout/thumbnail_view.xml b/res/layout/thumbnail_view.xml
index a9f979014c..96ec33477e 100644
--- a/res/layout/thumbnail_view.xml
+++ b/res/layout/thumbnail_view.xml
@@ -22,6 +22,15 @@
android:src="@drawable/ic_caption_28"
android:visibility="gone" />
+
+
insertAttachmentsForMessage(long mmsId, @NonNull List attachments, @NonNull List quoteAttachment)
throws MmsException
{
diff --git a/src/org/thoughtcrime/securesms/jobs/AttachmentUploadJob.java b/src/org/thoughtcrime/securesms/jobs/AttachmentUploadJob.java
index 766e8f20f6..a356deabec 100644
--- a/src/org/thoughtcrime/securesms/jobs/AttachmentUploadJob.java
+++ b/src/org/thoughtcrime/securesms/jobs/AttachmentUploadJob.java
@@ -87,13 +87,20 @@ public class AttachmentUploadJob extends BaseJob implements InjectableType {
// Only upload attachment if necessary
if (databaseAttachment.getUrl().isEmpty()) {
- MediaConstraints mediaConstraints = MediaConstraints.getPushMediaConstraints();
- Attachment scaledAttachment = scaleAndStripExif(database, mediaConstraints, databaseAttachment);
- SignalServiceAttachment localAttachment = getAttachmentFor(scaledAttachment);
- SignalServiceAttachmentPointer remoteAttachment = messageSender.uploadAttachment(localAttachment.asStream(), databaseAttachment.isSticker(), new SignalServiceAddress(destination.serialize()));
- Attachment attachment = PointerAttachment.forPointer(Optional.of(remoteAttachment), null, databaseAttachment.getFastPreflightId()).get();
+ final Attachment attachment;
+ try {
+ MediaConstraints mediaConstraints = MediaConstraints.getPushMediaConstraints();
+ Attachment scaledAttachment = scaleAndStripExif(database, mediaConstraints, databaseAttachment);
+ SignalServiceAttachment localAttachment = getAttachmentFor(scaledAttachment);
+ SignalServiceAttachmentPointer remoteAttachment = messageSender.uploadAttachment(localAttachment.asStream(), databaseAttachment.isSticker(), new SignalServiceAddress(destination.serialize()));
+ attachment = PointerAttachment.forPointer(Optional.of(remoteAttachment), null, databaseAttachment.getFastPreflightId()).get();
+ } catch (Exception e) {
+ // On any error make sure we mark the related DB record's transfer state as failed.
+ database.updateAttachmentAfterUploadFailed(databaseAttachment.getAttachmentId());
+ throw e;
+ }
- database.updateAttachmentAfterUpload(databaseAttachment.getAttachmentId(), attachment);
+ database.updateAttachmentAfterUploadSucceeded(databaseAttachment.getAttachmentId(), attachment);
}
}