mirror of
https://github.com/signalapp/Signal-Android.git
synced 2026-02-22 10:46:50 +00:00
Ensure recipients added to the cache have an identifier.
This commit is contained in:
@@ -100,7 +100,7 @@ public final class LiveRecipientCache {
|
||||
*/
|
||||
@AnyThread
|
||||
public void addToCache(@NonNull Collection<Recipient> newRecipients) {
|
||||
for (Recipient recipient : newRecipients) {
|
||||
newRecipients.stream().filter(this::isValidForCache).forEach(recipient -> {
|
||||
LiveRecipient live;
|
||||
boolean needsResolve;
|
||||
|
||||
@@ -131,7 +131,7 @@ public final class LiveRecipientCache {
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@NonNull Recipient getSelf() {
|
||||
@@ -205,4 +205,8 @@ public final class LiveRecipientCache {
|
||||
recipients.clear();
|
||||
}
|
||||
}
|
||||
|
||||
private boolean isValidForCache(@NonNull Recipient recipient) {
|
||||
return !recipient.getId().isUnknown() && (recipient.hasServiceIdentifier() || recipient.getGroupId().isPresent() || recipient.hasSmsAddress());
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user