mirror of
https://github.com/AsamK/signal-cli.git
synced 2026-08-12 03:16:22 +00:00
Use nickname for displaying recipient names
This commit is contained in:
parent
854cb35d15
commit
fd3f572499
@ -80,6 +80,21 @@ public record Contact(
|
||||
return givenName + " " + familyName;
|
||||
}
|
||||
|
||||
public String getDisplayNickname() {
|
||||
final var noNickGivenName = Util.isEmpty(nickNameGivenName);
|
||||
final var noNickFamilyName = Util.isEmpty(nickNameFamilyName);
|
||||
|
||||
if (noNickGivenName && noNickFamilyName) {
|
||||
return null;
|
||||
} else if (noNickGivenName) {
|
||||
return nickNameFamilyName;
|
||||
} else if (noNickFamilyName) {
|
||||
return nickNameGivenName;
|
||||
}
|
||||
|
||||
return nickNameGivenName + " " + nickNameFamilyName;
|
||||
}
|
||||
|
||||
public static final class Builder {
|
||||
|
||||
private String givenName;
|
||||
|
||||
@ -1706,8 +1706,15 @@ public class ManagerImpl implements Manager {
|
||||
}
|
||||
|
||||
final var contact = account.getContactStore().getContact(recipientId);
|
||||
if (contact != null && !Util.isEmpty(contact.getName())) {
|
||||
return contact.getName();
|
||||
if (contact != null) {
|
||||
final var nickname = contact.getDisplayNickname();
|
||||
if (!Util.isEmpty(nickname)) {
|
||||
return nickname;
|
||||
}
|
||||
|
||||
if (!Util.isEmpty(contact.getName())) {
|
||||
return contact.getName();
|
||||
}
|
||||
}
|
||||
|
||||
final var profile = context.getProfileHelper().getRecipientProfile(recipientId);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user