Add call tab event grouping.

This commit is contained in:
Alex Hart
2023-04-12 13:22:33 -03:00
committed by Greyson Parrelli
parent fd1ff5e438
commit e8570c3680
11 changed files with 164 additions and 69 deletions

View File

@@ -40,13 +40,14 @@ class ConversationSettingsRepository(
private val groupManagementRepository: GroupManagementRepository = GroupManagementRepository(context)
) {
fun getCallEvents(callMessageIds: LongArray): Single<List<Pair<CallTable.Call, MessageRecord>>> {
return if (callMessageIds.isEmpty()) {
fun getCallEvents(callRowIds: LongArray): Single<List<Pair<CallTable.Call, MessageRecord>>> {
return if (callRowIds.isEmpty()) {
Single.just(emptyList())
} else {
Single.fromCallable {
val callMap = SignalDatabase.calls.getCalls(callMessageIds.toList())
SignalDatabase.messages.getMessages(callMessageIds.toList()).iterator().asSequence()
val callMap = SignalDatabase.calls.getCallsByRowIds(callRowIds.toList())
val messageIds = callMap.values.mapNotNull { it.messageId }
SignalDatabase.messages.getMessages(messageIds).iterator().asSequence()
.filter { callMap.containsKey(it.id) }
.map { callMap[it.id]!! to it }
.toList()