mirror of
https://github.com/signalapp/Signal-Android.git
synced 2025-12-23 20:48:43 +00:00
Hide create call link button while in multiselect mode.
This commit is contained in:
@@ -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<CallLogRow.Id, CallLogRow> {
|
||||
|
||||
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
|
||||
}
|
||||
|
||||
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user