mirror of
https://github.com/nextcloud/android.git
synced 2024-11-22 21:25:35 +03:00
Check last entry
Signed-off-by: alperozturk <alper_ozturk@proton.me>
This commit is contained in:
parent
59e721c405
commit
a971dbd5d2
1 changed files with 3 additions and 2 deletions
|
@ -43,7 +43,6 @@ class UnifiedSearchViewModel(application: Application) : AndroidViewModel(applic
|
||||||
null
|
null
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fun name(): String? = results.lastOrNull()?.name
|
fun name(): String? = results.lastOrNull()?.name
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -197,11 +196,13 @@ class UnifiedSearchViewModel(application: Application) : AndroidViewModel(applic
|
||||||
searchResults.value = results
|
searchResults.value = results
|
||||||
.filter { it.value.results.isNotEmpty() }
|
.filter { it.value.results.isNotEmpty() }
|
||||||
.map { (key, value) ->
|
.map { (key, value) ->
|
||||||
|
val isLastEntryHaveValue = results[key]?.results?.last()?.entries?.isEmpty() != true
|
||||||
|
|
||||||
UnifiedSearchSection(
|
UnifiedSearchSection(
|
||||||
providerID = key,
|
providerID = key,
|
||||||
name = value.name()!!,
|
name = value.name()!!,
|
||||||
entries = value.results.flatMap { it.entries },
|
entries = value.results.flatMap { it.entries },
|
||||||
hasMoreResults = results.isNotEmpty() && results[key]?.nextCursor() != null
|
hasMoreResults = isLastEntryHaveValue && results[key]?.nextCursor() != null
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
.sortedWith { o1, o2 ->
|
.sortedWith { o1, o2 ->
|
||||||
|
|
Loading…
Reference in a new issue