|
|
@ -52,8 +52,8 @@ public class MultipleRecipientNotificationBuilder extends AbstractNotificationBu
|
|
|
|
|
|
|
|
|
|
|
|
public void setMostRecentSender(Recipient recipient, Recipient threadRecipient) {
|
|
|
|
public void setMostRecentSender(Recipient recipient, Recipient threadRecipient) {
|
|
|
|
String displayName = recipient.toShortString();
|
|
|
|
String displayName = recipient.toShortString();
|
|
|
|
if (threadRecipient.isOpenGroupRecipient()) {
|
|
|
|
if (threadRecipient.isGroupRecipient()) {
|
|
|
|
displayName = getOpenGroupDisplayName(recipient);
|
|
|
|
displayName = getGroupDisplayName(recipient, threadRecipient.isOpenGroupRecipient());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (privacy.isDisplayContact()) {
|
|
|
|
if (privacy.isDisplayContact()) {
|
|
|
|
setContentText(context.getString(R.string.MessageNotifier_most_recent_from_s, displayName));
|
|
|
|
setContentText(context.getString(R.string.MessageNotifier_most_recent_from_s, displayName));
|
|
|
@ -78,8 +78,8 @@ public class MultipleRecipientNotificationBuilder extends AbstractNotificationBu
|
|
|
|
|
|
|
|
|
|
|
|
public void addMessageBody(@NonNull Recipient sender, Recipient threadRecipient, @Nullable CharSequence body) {
|
|
|
|
public void addMessageBody(@NonNull Recipient sender, Recipient threadRecipient, @Nullable CharSequence body) {
|
|
|
|
String displayName = sender.toShortString();
|
|
|
|
String displayName = sender.toShortString();
|
|
|
|
if (threadRecipient.isOpenGroupRecipient()) {
|
|
|
|
if (threadRecipient.isGroupRecipient()) {
|
|
|
|
displayName = getOpenGroupDisplayName(sender);
|
|
|
|
displayName = getGroupDisplayName(sender, threadRecipient.isOpenGroupRecipient());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (privacy.isDisplayMessage()) {
|
|
|
|
if (privacy.isDisplayMessage()) {
|
|
|
|
SpannableStringBuilder builder = new SpannableStringBuilder();
|
|
|
|
SpannableStringBuilder builder = new SpannableStringBuilder();
|
|
|
@ -113,14 +113,15 @@ public class MultipleRecipientNotificationBuilder extends AbstractNotificationBu
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* @param recipient the * individual * recipient for which to get the open group display name.
|
|
|
|
* @param recipient the * individual * recipient for which to get the display name.
|
|
|
|
|
|
|
|
* @param openGroupRecipient whether in an open group context
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
private String getOpenGroupDisplayName(Recipient recipient) {
|
|
|
|
private String getGroupDisplayName(Recipient recipient, boolean openGroupRecipient) {
|
|
|
|
SessionContactDatabase contactDB = DatabaseComponent.get(context).sessionContactDatabase();
|
|
|
|
SessionContactDatabase contactDB = DatabaseComponent.get(context).sessionContactDatabase();
|
|
|
|
String sessionID = recipient.getAddress().serialize();
|
|
|
|
String sessionID = recipient.getAddress().serialize();
|
|
|
|
Contact contact = contactDB.getContactWithSessionID(sessionID);
|
|
|
|
Contact contact = contactDB.getContactWithSessionID(sessionID);
|
|
|
|
if (contact == null) { return sessionID; }
|
|
|
|
if (contact == null) { return sessionID; }
|
|
|
|
String displayName = contact.displayName(Contact.ContactContext.OPEN_GROUP);
|
|
|
|
String displayName = contact.displayName(openGroupRecipient ? Contact.ContactContext.OPEN_GROUP : Contact.ContactContext.REGULAR);
|
|
|
|
if (displayName == null) { return sessionID; }
|
|
|
|
if (displayName == null) { return sessionID; }
|
|
|
|
return displayName;
|
|
|
|
return displayName;
|
|
|
|
}
|
|
|
|
}
|
|
|
|