Improve performance of GV2 profile fetch and mentions initialization.

This commit is contained in:
Cody Henthorne
2022-05-11 13:58:44 -04:00
committed by Alex Hart
parent c0db88960c
commit 12e6ebb4df
4 changed files with 22 additions and 14 deletions

View File

@@ -432,6 +432,22 @@ public class GroupDatabase extends Database {
return 0;
}
@WorkerThread
public @NonNull List<RecipientId> getGroupMemberIds(@NonNull GroupId groupId, @NonNull MemberSet memberSet) {
if (groupId.isV2()) {
return getGroup(groupId).map(g -> g.requireV2GroupProperties().getMemberRecipientIds(memberSet))
.orElse(Collections.emptyList());
} else {
List<RecipientId> currentMembers = getCurrentMembers(groupId);
if (!memberSet.includeSelf) {
currentMembers.remove(Recipient.self().getId());
}
return currentMembers;
}
}
@WorkerThread
public @NonNull List<Recipient> getGroupMembers(@NonNull GroupId groupId, @NonNull MemberSet memberSet) {
if (groupId.isV2()) {