Skip to content

Commit 7f4e96d

Browse files
Fix GIF attachment flags.
1 parent f7bd6bc commit 7f4e96d

File tree

3 files changed

+6
-47
lines changed

3 files changed

+6
-47
lines changed

libsignal-service/src/main/java/org/whispersystems/signalservice/api/util/AttachmentPointerUtil.java

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
import org.whispersystems.signalservice.api.messages.SignalServiceAttachmentPointer;
55
import org.whispersystems.signalservice.api.messages.SignalServiceAttachmentRemoteId;
66
import org.whispersystems.signalservice.internal.push.AttachmentPointer;
7-
import org.whispersystems.util.FlagUtil;
87

98
import java.io.IOException;
109
import java.util.Objects;
@@ -30,9 +29,9 @@ public static SignalServiceAttachmentPointer createSignalAttachmentPointer(Attac
3029
pointer.incrementalMac != null ? Optional.of(pointer.incrementalMac.toByteArray()) : Optional.empty(),
3130
pointer.chunkSize != null ? pointer.chunkSize : 0,
3231
pointer.fileName != null ? Optional.of(pointer.fileName) : Optional.empty(),
33-
((pointer.flags != null ? pointer.flags : 0) & FlagUtil.toBinaryFlag(AttachmentPointer.Flags.VOICE_MESSAGE.getValue())) != 0,
34-
((pointer.flags != null ? pointer.flags : 0) & FlagUtil.toBinaryFlag(AttachmentPointer.Flags.BORDERLESS.getValue())) != 0,
35-
((pointer.flags != null ? pointer.flags : 0) & FlagUtil.toBinaryFlag(AttachmentPointer.Flags.GIF.getValue())) != 0,
32+
((pointer.flags != null ? pointer.flags : 0) & AttachmentPointer.Flags.VOICE_MESSAGE.getValue()) != 0,
33+
((pointer.flags != null ? pointer.flags : 0) & AttachmentPointer.Flags.BORDERLESS.getValue()) != 0,
34+
((pointer.flags != null ? pointer.flags : 0) & AttachmentPointer.Flags.GIF.getValue()) != 0,
3635
pointer.caption != null ? Optional.of(pointer.caption) : Optional.empty(),
3736
pointer.blurHash != null ? Optional.of(pointer.blurHash) : Optional.empty(),
3837
pointer.uploadTimestamp != null ? pointer.uploadTimestamp : 0,
@@ -83,15 +82,15 @@ public static AttachmentPointer createAttachmentPointer(SignalServiceAttachmentP
8382
int flags = 0;
8483

8584
if (attachment.getVoiceNote()) {
86-
flags |= FlagUtil.toBinaryFlag(AttachmentPointer.Flags.VOICE_MESSAGE.getValue());
85+
flags |= AttachmentPointer.Flags.VOICE_MESSAGE.getValue();
8786
}
8887

8988
if (attachment.isBorderless()) {
90-
flags |= FlagUtil.toBinaryFlag(AttachmentPointer.Flags.BORDERLESS.getValue());
89+
flags |= AttachmentPointer.Flags.BORDERLESS.getValue();
9190
}
9291

9392
if (attachment.isGif()) {
94-
flags |= FlagUtil.toBinaryFlag(AttachmentPointer.Flags.GIF.getValue());
93+
flags |= AttachmentPointer.Flags.GIF.getValue();
9594
}
9695

9796
builder.flags(flags);

libsignal-service/src/main/java/org/whispersystems/util/FlagUtil.java

Lines changed: 0 additions & 19 deletions
This file was deleted.

libsignal-service/src/test/java/org/whispersystems/util/FlagUtilTest.kt

Lines changed: 0 additions & 21 deletions
This file was deleted.

0 commit comments

Comments
 (0)