kopia lustrzana https://github.com/ryukoposting/Signal-Android
Ensure recipients added to the cache have an identifier.
rodzic
ab5d3badc2
commit
e47db0d532
|
@ -100,7 +100,7 @@ public final class LiveRecipientCache {
|
||||||
*/
|
*/
|
||||||
@AnyThread
|
@AnyThread
|
||||||
public void addToCache(@NonNull Collection<Recipient> newRecipients) {
|
public void addToCache(@NonNull Collection<Recipient> newRecipients) {
|
||||||
for (Recipient recipient : newRecipients) {
|
newRecipients.stream().filter(this::isValidForCache).forEach(recipient -> {
|
||||||
LiveRecipient live;
|
LiveRecipient live;
|
||||||
boolean needsResolve;
|
boolean needsResolve;
|
||||||
|
|
||||||
|
@ -131,7 +131,7 @@ public final class LiveRecipientCache {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@NonNull Recipient getSelf() {
|
@NonNull Recipient getSelf() {
|
||||||
|
@ -205,4 +205,8 @@ public final class LiveRecipientCache {
|
||||||
recipients.clear();
|
recipients.clear();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private boolean isValidForCache(@NonNull Recipient recipient) {
|
||||||
|
return !recipient.getId().isUnknown() && (recipient.hasServiceIdentifier() || recipient.getGroupId().isPresent() || recipient.hasSmsAddress());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Ładowanie…
Reference in New Issue