mirror of
https://github.com/signalapp/Signal-Android.git
synced 2025-12-24 13:08:46 +00:00
Add support for syncing default reactions.
This commit is contained in:
committed by
Alex Hart
parent
2281e83607
commit
7267d77dcb
@@ -32,6 +32,7 @@ public final class SignalAccountRecord implements SignalRecord {
|
||||
private final Optional<byte[]> profileKey;
|
||||
private final List<PinnedConversation> pinnedConversations;
|
||||
private final Payments payments;
|
||||
private final List<String> defaultReactions;
|
||||
|
||||
public SignalAccountRecord(StorageId id, AccountRecord proto) {
|
||||
this.id = id;
|
||||
@@ -44,6 +45,7 @@ public final class SignalAccountRecord implements SignalRecord {
|
||||
this.avatarUrlPath = OptionalUtil.absentIfEmpty(proto.getAvatarUrlPath());
|
||||
this.pinnedConversations = new ArrayList<>(proto.getPinnedConversationsCount());
|
||||
this.payments = new Payments(proto.getPayments().getEnabled(), OptionalUtil.absentIfEmpty(proto.getPayments().getEntropy()));
|
||||
this.defaultReactions = new ArrayList<>(proto.getPreferredReactionEmojiList());
|
||||
|
||||
for (AccountRecord.PinnedConversation conversation : proto.getPinnedConversationsList()) {
|
||||
pinnedConversations.add(PinnedConversation.fromRemote(conversation));
|
||||
@@ -142,6 +144,10 @@ public final class SignalAccountRecord implements SignalRecord {
|
||||
diff.add("E164");
|
||||
}
|
||||
|
||||
if (!Objects.equals(this.getDefaultReactions(), that.getDefaultReactions())) {
|
||||
diff.add("DefaultReactions");
|
||||
}
|
||||
|
||||
if (!Objects.equals(this.hasUnknownFields(), that.hasUnknownFields())) {
|
||||
diff.add("UnknownFields");
|
||||
}
|
||||
@@ -232,6 +238,10 @@ public final class SignalAccountRecord implements SignalRecord {
|
||||
return proto.getE164();
|
||||
}
|
||||
|
||||
public List<String> getDefaultReactions() {
|
||||
return defaultReactions;
|
||||
}
|
||||
|
||||
AccountRecord toProto() {
|
||||
return proto;
|
||||
}
|
||||
@@ -501,6 +511,12 @@ public final class SignalAccountRecord implements SignalRecord {
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder setDefaultReactions(List<String> defaultReactions) {
|
||||
builder.clearPreferredReactionEmoji();
|
||||
builder.addAllPreferredReactionEmoji(defaultReactions);
|
||||
return this;
|
||||
}
|
||||
|
||||
public SignalAccountRecord build() {
|
||||
AccountRecord proto = builder.build();
|
||||
|
||||
|
||||
@@ -147,4 +147,5 @@ message AccountRecord {
|
||||
uint32 universalExpireTimer = 17;
|
||||
bool primarySendsSms = 18;
|
||||
string e164 = 19;
|
||||
repeated string preferredReactionEmoji = 20;
|
||||
}
|
||||
Reference in New Issue
Block a user