Show contact profile photo instead of system contact.

This commit is contained in:
Alex Hart
2021-01-13 11:36:39 -04:00
committed by Greyson Parrelli
parent cee2702fdf
commit 2d20ceea01
10 changed files with 80 additions and 26 deletions

View File

@@ -24,17 +24,19 @@ public final class SignalAccountRecord implements SignalRecord {
private final Optional<String> avatarUrlPath;
private final Optional<byte[]> profileKey;
private final List<PinnedConversation> pinnedConversations;
private final boolean preferContactAvatars;
public SignalAccountRecord(StorageId id, AccountRecord proto) {
this.id = id;
this.proto = proto;
this.hasUnknownFields = ProtoUtil.hasUnknownFields(proto);
this.givenName = OptionalUtil.absentIfEmpty(proto.getGivenName());
this.familyName = OptionalUtil.absentIfEmpty(proto.getFamilyName());
this.profileKey = OptionalUtil.absentIfEmpty(proto.getProfileKey());
this.avatarUrlPath = OptionalUtil.absentIfEmpty(proto.getAvatarUrlPath());
this.pinnedConversations = new ArrayList<>(proto.getPinnedConversationsCount());
this.givenName = OptionalUtil.absentIfEmpty(proto.getGivenName());
this.familyName = OptionalUtil.absentIfEmpty(proto.getFamilyName());
this.profileKey = OptionalUtil.absentIfEmpty(proto.getProfileKey());
this.avatarUrlPath = OptionalUtil.absentIfEmpty(proto.getAvatarUrlPath());
this.pinnedConversations = new ArrayList<>(proto.getPinnedConversationsCount());
this.preferContactAvatars = proto.getPreferContactAvatars();
for (AccountRecord.PinnedConversation conversation : proto.getPinnedConversationsList()) {
pinnedConversations.add(PinnedConversation.fromRemote(conversation));
@@ -106,6 +108,10 @@ public final class SignalAccountRecord implements SignalRecord {
return pinnedConversations;
}
public boolean isPreferContactAvatars() {
return preferContactAvatars;
}
AccountRecord toProto() {
return proto;
}
@@ -300,6 +306,12 @@ public final class SignalAccountRecord implements SignalRecord {
return this;
}
public Builder setPreferContactAvatars(boolean preferContactAvatars) {
builder.setPreferContactAvatars(preferContactAvatars);
return this;
}
public SignalAccountRecord build() {
AccountRecord proto = builder.build();

View File

@@ -134,4 +134,5 @@ message AccountRecord {
PhoneNumberSharingMode phoneNumberSharingMode = 12;
bool unlistedPhoneNumber = 13;
repeated PinnedConversation pinnedConversations = 14;
bool preferContactAvatars = 15;
}