mirror of
https://github.com/signalapp/Signal-Android.git
synced 2025-12-24 13:08:46 +00:00
Render gifs in gif search as MP4s.
This commit is contained in:
committed by
Greyson Parrelli
parent
fcc5db2fe6
commit
c31146e902
@@ -452,6 +452,7 @@ public class SignalServiceMessageSender {
|
||||
attachment.getFileName(),
|
||||
attachment.getVoiceNote(),
|
||||
attachment.isBorderless(),
|
||||
attachment.isGif(),
|
||||
attachment.getCaption(),
|
||||
attachment.getBlurHash(),
|
||||
attachment.getUploadTimestamp());
|
||||
@@ -492,6 +493,7 @@ public class SignalServiceMessageSender {
|
||||
attachment.getFileName(),
|
||||
attachment.getVoiceNote(),
|
||||
attachment.isBorderless(),
|
||||
attachment.isGif(),
|
||||
attachment.getCaption(),
|
||||
attachment.getBlurHash(),
|
||||
attachment.getUploadTimestamp());
|
||||
@@ -1562,6 +1564,10 @@ public class SignalServiceMessageSender {
|
||||
builder.setFlags(AttachmentPointer.Flags.BORDERLESS_VALUE);
|
||||
}
|
||||
|
||||
if (attachment.isGif()) {
|
||||
builder.setFlags(AttachmentPointer.Flags.GIF_VALUE);
|
||||
}
|
||||
|
||||
if (attachment.getCaption().isPresent()) {
|
||||
builder.setCaption(attachment.getCaption().get());
|
||||
}
|
||||
|
||||
@@ -41,7 +41,7 @@ public abstract class SignalServiceAttachment {
|
||||
}
|
||||
|
||||
public static SignalServiceAttachmentStream emptyStream(String contentType) {
|
||||
return new SignalServiceAttachmentStream(new ByteArrayInputStream(new byte[0]), contentType, 0, Optional.absent(), false, false, null, null);
|
||||
return new SignalServiceAttachmentStream(new ByteArrayInputStream(new byte[0]), contentType, 0, Optional.absent(), false, false, false, null, null);
|
||||
}
|
||||
|
||||
public static class Builder {
|
||||
@@ -54,6 +54,7 @@ public abstract class SignalServiceAttachment {
|
||||
private CancelationSignal cancelationSignal;
|
||||
private boolean voiceNote;
|
||||
private boolean borderless;
|
||||
private boolean gif;
|
||||
private int width;
|
||||
private int height;
|
||||
private String caption;
|
||||
@@ -103,6 +104,11 @@ public abstract class SignalServiceAttachment {
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder withGif(boolean gif) {
|
||||
this.gif = gif;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder withWidth(int width) {
|
||||
this.width = width;
|
||||
return this;
|
||||
@@ -144,6 +150,7 @@ public abstract class SignalServiceAttachment {
|
||||
Optional.fromNullable(fileName),
|
||||
voiceNote,
|
||||
borderless,
|
||||
gif,
|
||||
Optional.<byte[]>absent(),
|
||||
width,
|
||||
height,
|
||||
|
||||
@@ -27,6 +27,7 @@ public class SignalServiceAttachmentPointer extends SignalServiceAttachment {
|
||||
private final Optional<String> fileName;
|
||||
private final boolean voiceNote;
|
||||
private final boolean borderless;
|
||||
private final boolean gif;
|
||||
private final int width;
|
||||
private final int height;
|
||||
private final Optional<String> caption;
|
||||
@@ -45,6 +46,7 @@ public class SignalServiceAttachmentPointer extends SignalServiceAttachment {
|
||||
Optional<String> fileName,
|
||||
boolean voiceNote,
|
||||
boolean borderless,
|
||||
boolean gif,
|
||||
Optional<String> caption,
|
||||
Optional<String> blurHash,
|
||||
long uploadTimestamp)
|
||||
@@ -64,6 +66,7 @@ public class SignalServiceAttachmentPointer extends SignalServiceAttachment {
|
||||
this.caption = caption;
|
||||
this.blurHash = blurHash;
|
||||
this.uploadTimestamp = uploadTimestamp;
|
||||
this.gif = gif;
|
||||
}
|
||||
|
||||
public int getCdnNumber() {
|
||||
@@ -112,6 +115,10 @@ public class SignalServiceAttachmentPointer extends SignalServiceAttachment {
|
||||
return borderless;
|
||||
}
|
||||
|
||||
public boolean isGif() {
|
||||
return gif;
|
||||
}
|
||||
|
||||
public int getWidth() {
|
||||
return width;
|
||||
}
|
||||
|
||||
@@ -25,6 +25,7 @@ public class SignalServiceAttachmentStream extends SignalServiceAttachment {
|
||||
private final Optional<byte[]> preview;
|
||||
private final boolean voiceNote;
|
||||
private final boolean borderless;
|
||||
private final boolean gif;
|
||||
private final int width;
|
||||
private final int height;
|
||||
private final long uploadTimestamp;
|
||||
@@ -38,10 +39,11 @@ public class SignalServiceAttachmentStream extends SignalServiceAttachment {
|
||||
Optional<String> fileName,
|
||||
boolean voiceNote,
|
||||
boolean borderless,
|
||||
boolean gif,
|
||||
ProgressListener listener,
|
||||
CancelationSignal cancelationSignal)
|
||||
{
|
||||
this(inputStream, contentType, length, fileName, voiceNote, borderless, Optional.<byte[]>absent(), 0, 0, System.currentTimeMillis(), Optional.<String>absent(), Optional.<String>absent(), listener, cancelationSignal, Optional.absent());
|
||||
this(inputStream, contentType, length, fileName, voiceNote, borderless, gif, Optional.<byte[]>absent(), 0, 0, System.currentTimeMillis(), Optional.<String>absent(), Optional.<String>absent(), listener, cancelationSignal, Optional.absent());
|
||||
}
|
||||
|
||||
public SignalServiceAttachmentStream(InputStream inputStream,
|
||||
@@ -50,6 +52,7 @@ public class SignalServiceAttachmentStream extends SignalServiceAttachment {
|
||||
Optional<String> fileName,
|
||||
boolean voiceNote,
|
||||
boolean borderless,
|
||||
boolean gif,
|
||||
Optional<byte[]> preview,
|
||||
int width,
|
||||
int height,
|
||||
@@ -67,6 +70,7 @@ public class SignalServiceAttachmentStream extends SignalServiceAttachment {
|
||||
this.listener = listener;
|
||||
this.voiceNote = voiceNote;
|
||||
this.borderless = borderless;
|
||||
this.gif = gif;
|
||||
this.preview = preview;
|
||||
this.width = width;
|
||||
this.height = height;
|
||||
@@ -119,6 +123,10 @@ public class SignalServiceAttachmentStream extends SignalServiceAttachment {
|
||||
return borderless;
|
||||
}
|
||||
|
||||
public boolean isGif() {
|
||||
return gif;
|
||||
}
|
||||
|
||||
public int getWidth() {
|
||||
return width;
|
||||
}
|
||||
|
||||
@@ -978,6 +978,7 @@ public final class SignalServiceContent {
|
||||
pointer.hasFileName() ? Optional.of(pointer.getFileName()) : Optional.<String>absent(),
|
||||
(pointer.getFlags() & SignalServiceProtos.AttachmentPointer.Flags.VOICE_MESSAGE_VALUE) != 0,
|
||||
(pointer.getFlags() & SignalServiceProtos.AttachmentPointer.Flags.BORDERLESS_VALUE) != 0,
|
||||
(pointer.getFlags() & SignalServiceProtos.AttachmentPointer.Flags.GIF_VALUE) != 0,
|
||||
pointer.hasCaption() ? Optional.of(pointer.getCaption()) : Optional.<String>absent(),
|
||||
pointer.hasBlurHash() ? Optional.of(pointer.getBlurHash()) : Optional.<String>absent(),
|
||||
pointer.hasUploadTimestamp() ? pointer.getUploadTimestamp() : 0);
|
||||
@@ -1037,6 +1038,7 @@ public final class SignalServiceContent {
|
||||
Optional.<String>absent(),
|
||||
false,
|
||||
false,
|
||||
false,
|
||||
Optional.<String>absent(),
|
||||
Optional.<String>absent(),
|
||||
pointer.hasUploadTimestamp() ? pointer.getUploadTimestamp() : 0);
|
||||
|
||||
@@ -57,7 +57,7 @@ public class DeviceContactsInputStream extends ChunkedInputStream {
|
||||
InputStream avatarStream = new LimitedInputStream(in, avatarLength);
|
||||
String avatarContentType = details.getAvatar().getContentType();
|
||||
|
||||
avatar = Optional.of(new SignalServiceAttachmentStream(avatarStream, avatarContentType, avatarLength, Optional.<String>absent(), false, false, null, null));
|
||||
avatar = Optional.of(new SignalServiceAttachmentStream(avatarStream, avatarContentType, avatarLength, Optional.<String>absent(), false, false, false, null, null));
|
||||
}
|
||||
|
||||
if (details.hasVerified()) {
|
||||
|
||||
@@ -52,7 +52,7 @@ public class DeviceGroupsInputStream extends ChunkedInputStream{
|
||||
InputStream avatarStream = new ChunkedInputStream.LimitedInputStream(in, avatarLength);
|
||||
String avatarContentType = details.getAvatar().getContentType();
|
||||
|
||||
avatar = Optional.of(new SignalServiceAttachmentStream(avatarStream, avatarContentType, avatarLength, Optional.<String>absent(), false, false, null, null));
|
||||
avatar = Optional.of(new SignalServiceAttachmentStream(avatarStream, avatarContentType, avatarLength, Optional.<String>absent(), false, false, false, null, null));
|
||||
}
|
||||
|
||||
if (details.hasExpireTimer() && details.getExpireTimer() > 0) {
|
||||
|
||||
@@ -501,6 +501,7 @@ message AttachmentPointer {
|
||||
enum Flags {
|
||||
VOICE_MESSAGE = 1;
|
||||
BORDERLESS = 2;
|
||||
GIF = 3;
|
||||
}
|
||||
|
||||
oneof attachment_identifier {
|
||||
|
||||
Reference in New Issue
Block a user