mirror of
https://github.com/signalapp/Signal-Android.git
synced 2025-12-24 21:15:48 +00:00
Implement support for 'allows replies' toggle.
This commit is contained in:
@@ -770,6 +770,8 @@ public class SignalServiceMessageSender {
|
||||
builder.setTextAttachment(createTextAttachment(message.getTextAttachment().get()));
|
||||
}
|
||||
|
||||
builder.setAllowsReplies(message.getAllowsReplies().or(true));
|
||||
|
||||
return container.setStoryMessage(builder).build();
|
||||
}
|
||||
|
||||
|
||||
@@ -958,11 +958,13 @@ public final class SignalServiceContent {
|
||||
if (content.hasFileAttachment()) {
|
||||
return SignalServiceStoryMessage.forFileAttachment(profileKey,
|
||||
createGroupV2Info(content),
|
||||
createAttachmentPointer(content.getFileAttachment()));
|
||||
createAttachmentPointer(content.getFileAttachment()),
|
||||
content.getAllowsReplies());
|
||||
} else {
|
||||
return SignalServiceStoryMessage.forTextAttachment(profileKey,
|
||||
createGroupV2Info(content),
|
||||
createTextAttachment(content.getTextAttachment()));
|
||||
createTextAttachment(content.getTextAttachment()),
|
||||
content.getAllowsReplies());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -7,27 +7,32 @@ public class SignalServiceStoryMessage {
|
||||
private final Optional<SignalServiceGroupV2> groupContext;
|
||||
private final Optional<SignalServiceAttachment> fileAttachment;
|
||||
private final Optional<SignalServiceTextAttachment> textAttachment;
|
||||
private final Optional<Boolean> allowsReplies;
|
||||
|
||||
private SignalServiceStoryMessage(byte[] profileKey,
|
||||
SignalServiceGroupV2 groupContext,
|
||||
SignalServiceAttachment fileAttachment,
|
||||
SignalServiceTextAttachment textAttachment) {
|
||||
SignalServiceTextAttachment textAttachment,
|
||||
boolean allowsReplies) {
|
||||
this.profileKey = Optional.fromNullable(profileKey);
|
||||
this.groupContext = Optional.fromNullable(groupContext);
|
||||
this.fileAttachment = Optional.fromNullable(fileAttachment);
|
||||
this.textAttachment = Optional.fromNullable(textAttachment);
|
||||
this.allowsReplies = Optional.of(allowsReplies);
|
||||
}
|
||||
|
||||
public static SignalServiceStoryMessage forFileAttachment(byte[] profileKey,
|
||||
SignalServiceGroupV2 groupContext,
|
||||
SignalServiceAttachment fileAttachment) {
|
||||
return new SignalServiceStoryMessage(profileKey, groupContext, fileAttachment, null);
|
||||
SignalServiceAttachment fileAttachment,
|
||||
boolean allowsReplies) {
|
||||
return new SignalServiceStoryMessage(profileKey, groupContext, fileAttachment, null, allowsReplies);
|
||||
}
|
||||
|
||||
public static SignalServiceStoryMessage forTextAttachment(byte[] profileKey,
|
||||
SignalServiceGroupV2 groupContext,
|
||||
SignalServiceTextAttachment textAttachment) {
|
||||
return new SignalServiceStoryMessage(profileKey, groupContext, null, textAttachment);
|
||||
SignalServiceTextAttachment textAttachment,
|
||||
boolean allowsReplies) {
|
||||
return new SignalServiceStoryMessage(profileKey, groupContext, null, textAttachment, allowsReplies);
|
||||
}
|
||||
|
||||
public Optional<byte[]> getProfileKey() {
|
||||
@@ -45,4 +50,8 @@ public class SignalServiceStoryMessage {
|
||||
public Optional<SignalServiceTextAttachment> getTextAttachment() {
|
||||
return textAttachment;
|
||||
}
|
||||
|
||||
public Optional<Boolean> getAllowsReplies() {
|
||||
return allowsReplies;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -350,12 +350,13 @@ message TypingMessage {
|
||||
}
|
||||
|
||||
message StoryMessage {
|
||||
optional bytes profileKey = 1;
|
||||
optional GroupContextV2 group = 2;
|
||||
optional bytes profileKey = 1;
|
||||
optional GroupContextV2 group = 2;
|
||||
oneof attachment {
|
||||
AttachmentPointer fileAttachment = 3;
|
||||
TextAttachment textAttachment = 4;
|
||||
}
|
||||
optional bool allowsReplies = 5;
|
||||
}
|
||||
|
||||
message Preview {
|
||||
|
||||
Reference in New Issue
Block a user