mirror of
https://github.com/signalapp/Signal-Android.git
synced 2026-05-02 14:43:09 +01:00
Populate incoming attachments with width and height from message
This commit is contained in:
@@ -32,10 +32,13 @@ public abstract class Attachment {
|
||||
private final String fastPreflightId;
|
||||
|
||||
private final boolean voiceNote;
|
||||
private final int width;
|
||||
private final int height;
|
||||
|
||||
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)
|
||||
@Nullable byte[] digest, @Nullable String fastPreflightId, boolean voiceNote,
|
||||
int width, int height)
|
||||
{
|
||||
this.contentType = contentType;
|
||||
this.transferState = transferState;
|
||||
@@ -47,6 +50,8 @@ public abstract class Attachment {
|
||||
this.digest = digest;
|
||||
this.fastPreflightId = fastPreflightId;
|
||||
this.voiceNote = voiceNote;
|
||||
this.width = width;
|
||||
this.height = height;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@@ -106,4 +111,12 @@ public abstract class Attachment {
|
||||
public boolean isVoiceNote() {
|
||||
return voiceNote;
|
||||
}
|
||||
|
||||
public int getWidth() {
|
||||
return width;
|
||||
}
|
||||
|
||||
public int getHeight() {
|
||||
return height;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -16,9 +16,10 @@ public class DatabaseAttachment extends Attachment {
|
||||
boolean hasData, boolean hasThumbnail,
|
||||
String contentType, int transferProgress, long size,
|
||||
String fileName, String location, String key, String relay,
|
||||
byte[] digest, String fastPreflightId, boolean voiceNote)
|
||||
byte[] digest, String fastPreflightId, boolean voiceNote,
|
||||
int width, int height)
|
||||
{
|
||||
super(contentType, transferProgress, size, fileName, location, key, relay, digest, fastPreflightId, voiceNote);
|
||||
super(contentType, transferProgress, size, fileName, location, key, relay, digest, fastPreflightId, voiceNote, width, height);
|
||||
this.attachmentId = attachmentId;
|
||||
this.hasData = hasData;
|
||||
this.hasThumbnail = hasThumbnail;
|
||||
|
||||
@@ -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);
|
||||
super("application/mms", getTransferStateFromStatus(status), size, null, null, null, null, null, null, false, 0, 0);
|
||||
}
|
||||
|
||||
@Nullable
|
||||
|
||||
@@ -17,9 +17,10 @@ public class PointerAttachment extends Attachment {
|
||||
private PointerAttachment(@NonNull String contentType, int transferState, long size,
|
||||
@Nullable String fileName, @NonNull String location,
|
||||
@NonNull String key, @NonNull String relay,
|
||||
@Nullable byte[] digest, boolean voiceNote)
|
||||
@Nullable byte[] digest, boolean voiceNote,
|
||||
int width, int height)
|
||||
{
|
||||
super(contentType, transferState, size, fileName, location, key, relay, digest, null, voiceNote);
|
||||
super(contentType, transferState, size, fileName, location, key, relay, digest, null, voiceNote, width, height);
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@@ -50,7 +51,9 @@ public class PointerAttachment extends Attachment {
|
||||
String.valueOf(pointer.asPointer().getId()),
|
||||
encodedKey, pointer.asPointer().getRelay().orNull(),
|
||||
pointer.asPointer().getDigest().orNull(),
|
||||
pointer.asPointer().getVoiceNote()));
|
||||
pointer.asPointer().getVoiceNote(),
|
||||
pointer.asPointer().getWidth(),
|
||||
pointer.asPointer().getHeight()));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -20,7 +20,7 @@ public class UriAttachment extends Attachment {
|
||||
@Nullable String fileName, @Nullable String fastPreflightId,
|
||||
boolean voiceNote)
|
||||
{
|
||||
super(contentType, transferState, size, fileName, null, null, null, null, fastPreflightId, voiceNote);
|
||||
super(contentType, transferState, size, fileName, null, null, null, null, fastPreflightId, voiceNote, 0, 0);
|
||||
this.dataUri = dataUri;
|
||||
this.thumbnailUri = thumbnailUri;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user