Check last entry

Signed-off-by: alperozturk <alper_ozturk@proton.me>
This commit is contained in:
alperozturk 2024-06-26 14:36:01 +02:00
parent 59e721c405
commit a971dbd5d2
No known key found for this signature in database
GPG key ID: 4E577DC593B59BDF

View file

@ -43,7 +43,6 @@ class UnifiedSearchViewModel(application: Application) : AndroidViewModel(applic
null
}
}
fun name(): String? = results.lastOrNull()?.name
}
@ -197,11 +196,13 @@ class UnifiedSearchViewModel(application: Application) : AndroidViewModel(applic
searchResults.value = results
.filter { it.value.results.isNotEmpty() }
.map { (key, value) ->
val isLastEntryHaveValue = results[key]?.results?.last()?.entries?.isEmpty() != true
UnifiedSearchSection(
providerID = key,
name = value.name()!!,
entries = value.results.flatMap { it.entries },
hasMoreResults = results.isNotEmpty() && results[key]?.nextCursor() != null
hasMoreResults = isLastEntryHaveValue && results[key]?.nextCursor() != null
)
}
.sortedWith { o1, o2 ->