Ensure recipient models are up-to-date.
parent
c2459d0a31
commit
be4daff0f3
|
@ -84,7 +84,7 @@ public abstract class DisplayRecord {
|
|||
public abstract SpannableString getDisplayBody(@NonNull Context context);
|
||||
|
||||
public Recipient getRecipient() {
|
||||
return recipient;
|
||||
return recipient.live().get();
|
||||
}
|
||||
|
||||
public long getDateSent() {
|
||||
|
|
|
@ -188,7 +188,7 @@ public abstract class MessageRecord extends DisplayRecord {
|
|||
}
|
||||
|
||||
public Recipient getIndividualRecipient() {
|
||||
return individualRecipient;
|
||||
return individualRecipient.live().get();
|
||||
}
|
||||
|
||||
public int getRecipientDeviceId() {
|
||||
|
|
|
@ -444,8 +444,8 @@ public class MessageNotifier {
|
|||
while ((record = reader.getNext()) != null) {
|
||||
long id = record.getId();
|
||||
boolean mms = record.isMms() || record.isMmsNotification();
|
||||
Recipient recipient = record.getIndividualRecipient();
|
||||
Recipient conversationRecipient = record.getRecipient();
|
||||
Recipient recipient = record.getIndividualRecipient().resolve();
|
||||
Recipient conversationRecipient = record.getRecipient().resolve();
|
||||
long threadId = record.getThreadId();
|
||||
CharSequence body = record.getDisplayBody(context);
|
||||
Recipient threadRecipients = null;
|
||||
|
|
|
@ -227,10 +227,10 @@ public class Recipient {
|
|||
}
|
||||
|
||||
public @NonNull MaterialColor getColor() {
|
||||
if (isGroup()) return MaterialColor.GROUP;
|
||||
else if (color != null) return color;
|
||||
else if (name != null) return ContactColors.generateFor(name);
|
||||
else return ContactColors.UNKNOWN_COLOR;
|
||||
if (isGroup()) return MaterialColor.GROUP;
|
||||
else if (color != null) return color;
|
||||
else if (name != null) return ContactColors.generateFor(name);
|
||||
else return ContactColors.UNKNOWN_COLOR;
|
||||
}
|
||||
|
||||
public @NonNull Address requireAddress() {
|
||||
|
@ -262,15 +262,16 @@ public class Recipient {
|
|||
}
|
||||
|
||||
public boolean isGroup() {
|
||||
return address != null && address.isGroup();
|
||||
return requireAddress().isGroup();
|
||||
}
|
||||
|
||||
public boolean isMmsGroup() {
|
||||
return address != null && address.isMmsGroup();
|
||||
return requireAddress().isMmsGroup();
|
||||
}
|
||||
|
||||
public boolean isPushGroup() {
|
||||
return address != null && address.isGroup() && !address.isMmsGroup();
|
||||
Address address = requireAddress();
|
||||
return address.isGroup() && !address.isMmsGroup();
|
||||
}
|
||||
|
||||
public @NonNull List<Recipient> getParticipants() {
|
||||
|
@ -278,9 +279,7 @@ public class Recipient {
|
|||
}
|
||||
|
||||
public @NonNull String toShortString() {
|
||||
return getName() == null ? address == null ? ""
|
||||
: address.serialize()
|
||||
: getName();
|
||||
return Optional.fromNullable(getName()).or(Optional.of(requireAddress().serialize())).get();
|
||||
}
|
||||
|
||||
public @NonNull Drawable getFallbackContactPhotoDrawable(Context context, boolean inverted) {
|
||||
|
|
Loading…
Reference in New Issue