Skip to content

Commit

Permalink
'#2036: Use WA display name, as the contact's name, if available.
Browse files Browse the repository at this point in the history
  • Loading branch information
wladimirleite committed Jan 3, 2024
1 parent d0fc5d4 commit 4b370db
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -97,9 +97,13 @@ public String getTitle() {
}
} else {
title = "WhatsApp Chat"; //$NON-NLS-1$
if (remote != null && remote.getName() != null
&& (getPrintId() == null || !remote.getName().strip().equals(getPrintId().strip())))
if (remote != null && remote.getDisplayName() != null && !remote.getDisplayName().isBlank()
&& (getPrintId() == null || !remote.getDisplayName().strip().equals(getPrintId().strip()))) {
title += " - " + remote.getDisplayName().strip();
} else if (remote != null && remote.getName() != null
&& (getPrintId() == null || !remote.getName().strip().equals(getPrintId().strip()))) {
title += " - " + remote.getName().strip(); //$NON-NLS-1$
}
}
if (getPrintId() != null && !getPrintId().isBlank()) {
title += " - " + getPrintId().strip();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1069,7 +1069,10 @@ private String getBestContactName(boolean isFromMe, String remoteResource, WACon
if (number != null) {
WAContact contact = contactsDirectory.getContact(number);
if (contact != null) {
name = contact.getName();
name = contact.getDisplayName();
if (name == null || name.isBlank()) {
name = contact.getName();
}
}
if (number.endsWith(waSuffix)) {
number = number.substring(0, number.length() - waSuffix.length());
Expand Down

0 comments on commit 4b370db

Please sign in to comment.