diff --git a/app/src/main/java/org/thoughtcrime/securesms/calls/log/CallLogPagedDataSource.kt b/app/src/main/java/org/thoughtcrime/securesms/calls/log/CallLogPagedDataSource.kt index 3da5392b5d..07ac84802c 100644 --- a/app/src/main/java/org/thoughtcrime/securesms/calls/log/CallLogPagedDataSource.kt +++ b/app/src/main/java/org/thoughtcrime/securesms/calls/log/CallLogPagedDataSource.kt @@ -7,7 +7,8 @@ import org.signal.paging.PagedDataSource class CallLogPagedDataSource( private val query: String?, private val filter: CallLogFilter, - private val repository: CallRepository + private val repository: CallRepository, + private val hasSelection: Boolean ) : PagedDataSource { companion object { @@ -46,7 +47,7 @@ class CallLogPagedDataSource( val clearFilterStart = callEventStart + callEventsCount var remaining = length - if (start < callLinkStart) { + if (start < callLinkStart && !hasSelection) { callLogRows.add(CallLogRow.CreateCallLink) remaining -= 1 } diff --git a/app/src/main/java/org/thoughtcrime/securesms/calls/log/CallLogViewModel.kt b/app/src/main/java/org/thoughtcrime/securesms/calls/log/CallLogViewModel.kt index 96f0375f55..1c6e9568da 100644 --- a/app/src/main/java/org/thoughtcrime/securesms/calls/log/CallLogViewModel.kt +++ b/app/src/main/java/org/thoughtcrime/securesms/calls/log/CallLogViewModel.kt @@ -59,14 +59,21 @@ class CallLogViewModel( init { disposables.add(callLogStore) - disposables += distinctQueryFilterPairs.subscribe { (query, filter) -> - pagedData.onNext( - PagedData.createForObservable( - CallLogPagedDataSource(query, filter, callLogRepository), - pagingConfig + disposables += distinctQueryFilterPairs + .switchMap { (query, filter) -> + selected.map { + Triple(query, filter, it != CallLogSelectionState.empty()) + } + } + .distinctUntilChanged() + .subscribe { (query, filter, hasSelection) -> + pagedData.onNext( + PagedData.createForObservable( + CallLogPagedDataSource(query, filter, callLogRepository, hasSelection), + pagingConfig + ) ) - ) - } + } disposables += pagedData.map { it.controller }.subscribe { controller.set(it)