Added support for multi-image receive.

This commit is contained in:
Greyson Parrelli
2018-11-08 23:33:37 -08:00
parent e665252b86
commit 47a10a0288
55 changed files with 1277 additions and 186 deletions

View File

@@ -37,10 +37,13 @@ public abstract class Attachment {
private final boolean quote;
@Nullable
private final String caption;
public Attachment(@NonNull String contentType, int transferState, long size, @Nullable String fileName,
@Nullable String location, @Nullable String key, @Nullable String relay,
@Nullable byte[] digest, @Nullable String fastPreflightId, boolean voiceNote,
int width, int height, boolean quote)
int width, int height, boolean quote, @Nullable String caption)
{
this.contentType = contentType;
this.transferState = transferState;
@@ -55,6 +58,7 @@ public abstract class Attachment {
this.width = width;
this.height = height;
this.quote = quote;
this.caption = caption;
}
@Nullable
@@ -126,4 +130,8 @@ public abstract class Attachment {
public boolean isQuote() {
return quote;
}
public @Nullable String getCaption() {
return caption;
}
}

View File

@@ -17,9 +17,9 @@ public class DatabaseAttachment extends Attachment {
String contentType, int transferProgress, long size,
String fileName, String location, String key, String relay,
byte[] digest, String fastPreflightId, boolean voiceNote,
int width, int height, boolean quote)
int width, int height, boolean quote, @Nullable String caption)
{
super(contentType, transferProgress, size, fileName, location, key, relay, digest, fastPreflightId, voiceNote, width, height, quote);
super(contentType, transferProgress, size, fileName, location, key, relay, digest, fastPreflightId, voiceNote, width, height, quote, caption);
this.attachmentId = attachmentId;
this.hasData = hasData;
this.hasThumbnail = hasThumbnail;

View File

@@ -10,7 +10,7 @@ import org.thoughtcrime.securesms.database.MmsDatabase;
public class MmsNotificationAttachment extends Attachment {
public MmsNotificationAttachment(int status, long size) {
super("application/mms", getTransferStateFromStatus(status), size, null, null, null, null, null, null, false, 0, 0, false);
super("application/mms", getTransferStateFromStatus(status), size, null, null, null, null, null, null, false, 0, 0, false, null);
}
@Nullable

View File

@@ -19,9 +19,9 @@ public class PointerAttachment extends Attachment {
@Nullable String fileName, @NonNull String location,
@Nullable String key, @Nullable String relay,
@Nullable byte[] digest, boolean voiceNote,
int width, int height)
int width, int height, @Nullable String caption)
{
super(contentType, transferState, size, fileName, location, key, relay, digest, null, voiceNote, width, height, false);
super(contentType, transferState, size, fileName, location, key, relay, digest, null, voiceNote, width, height, false, caption);
}
@Nullable
@@ -87,7 +87,8 @@ public class PointerAttachment extends Attachment {
pointer.get().asPointer().getDigest().orNull(),
pointer.get().asPointer().getVoiceNote(),
pointer.get().asPointer().getWidth(),
pointer.get().asPointer().getHeight()));
pointer.get().asPointer().getHeight(),
pointer.get().asPointer().getCaption().orNull()));
}
@@ -104,6 +105,7 @@ public class PointerAttachment extends Attachment {
thumbnail != null ? thumbnail.asPointer().getDigest().orNull() : null,
false,
thumbnail != null ? thumbnail.asPointer().getWidth() : 0,
thumbnail != null ? thumbnail.asPointer().getHeight() : 0));
thumbnail != null ? thumbnail.asPointer().getHeight() : 0,
thumbnail != null ? thumbnail.asPointer().getCaption().orNull() : null));
}
}

View File

@@ -10,17 +10,17 @@ public class UriAttachment extends Attachment {
private final @Nullable Uri thumbnailUri;
public UriAttachment(@NonNull Uri uri, @NonNull String contentType, int transferState, long size,
@Nullable String fileName, boolean voiceNote, boolean quote)
@Nullable String fileName, boolean voiceNote, boolean quote, @Nullable String caption)
{
this(uri, uri, contentType, transferState, size, 0, 0, fileName, null, voiceNote, quote);
this(uri, uri, contentType, transferState, size, 0, 0, fileName, null, voiceNote, quote, caption);
}
public UriAttachment(@NonNull Uri dataUri, @Nullable Uri thumbnailUri,
@NonNull String contentType, int transferState, long size, int width, int height,
@Nullable String fileName, @Nullable String fastPreflightId,
boolean voiceNote, boolean quote)
boolean voiceNote, boolean quote, @Nullable String caption)
{
super(contentType, transferState, size, fileName, null, null, null, null, fastPreflightId, voiceNote, width, height, quote);
super(contentType, transferState, size, fileName, null, null, null, null, fastPreflightId, voiceNote, width, height, quote, caption);
this.dataUri = dataUri;
this.thumbnailUri = thumbnailUri;
}