Add support for separate story view receipt control.

This reverts commit 1046265d23.
This commit is contained in:
Alex Hart
2022-10-13 12:46:13 -03:00
committed by Cody Henthorne
parent 2f2711c9a3
commit ca36eaacce
23 changed files with 332 additions and 48 deletions

View File

@@ -10,6 +10,7 @@ import org.whispersystems.signalservice.api.push.SignalServiceAddress;
import org.whispersystems.signalservice.api.util.OptionalUtil;
import org.whispersystems.signalservice.api.util.ProtoUtil;
import org.whispersystems.signalservice.internal.storage.protos.AccountRecord;
import org.whispersystems.signalservice.internal.storage.protos.OptionalBool;
import java.util.ArrayList;
import java.util.Arrays;
@@ -182,6 +183,10 @@ public final class SignalAccountRecord implements SignalRecord {
diff.add("StoriesDisabled");
}
if (getStoryViewReceiptsState() != that.getStoryViewReceiptsState()) {
diff.add("StoryViewedReceipts");
}
return diff.toString();
} else {
return "Different class. " + getClass().getSimpleName() + " | " + other.getClass().getSimpleName();
@@ -300,6 +305,10 @@ public final class SignalAccountRecord implements SignalRecord {
return proto.getStoriesDisabled();
}
public OptionalBool getStoryViewReceiptsState() {
return proto.getStoryViewReceiptsEnabled();
}
public AccountRecord toProto() {
return proto;
}
@@ -657,6 +666,11 @@ public final class SignalAccountRecord implements SignalRecord {
return this;
}
public Builder setStoryViewReceiptsState(OptionalBool storyViewedReceiptsEnabled) {
builder.setStoryViewReceiptsEnabled(storyViewedReceiptsEnabled);
return this;
}
private static AccountRecord.Builder parseUnknowns(byte[] serializedUnknowns) {
try {
return AccountRecord.parseFrom(serializedUnknowns).toBuilder();

View File

@@ -10,6 +10,12 @@ package signalservice;
option java_package = "org.whispersystems.signalservice.internal.storage.protos";
option java_multiple_files = true;
enum OptionalBool {
UNSET = 0;
ENABLED = 1;
DISABLED = 2;
}
message StorageManifest {
uint64 version = 1;
bytes value = 2;
@@ -176,6 +182,7 @@ message AccountRecord {
bool hasViewedOnboardingStory = 27;
reserved /* storiesDisabled */ 28;
bool storiesDisabled = 29;
OptionalBool storyViewReceiptsEnabled = 30;
}
message StoryDistributionListRecord {