fix mixup of search params in SearchDataSource.loadRange (#1666)
This commit is contained in:
parent
c379014d9a
commit
fde23f25d2
1 changed files with 10 additions and 4 deletions
|
@ -62,7 +62,7 @@ class SearchDataSource<T>(
|
||||||
resolve = true,
|
resolve = true,
|
||||||
limit = params.requestedLoadSize,
|
limit = params.requestedLoadSize,
|
||||||
offset = 0,
|
offset = 0,
|
||||||
following =false)
|
following = false)
|
||||||
.subscribe(
|
.subscribe(
|
||||||
{ data ->
|
{ data ->
|
||||||
val res = parser(data)
|
val res = parser(data)
|
||||||
|
@ -84,10 +84,16 @@ class SearchDataSource<T>(
|
||||||
override fun loadRange(params: LoadRangeParams, callback: LoadRangeCallback<T>) {
|
override fun loadRange(params: LoadRangeParams, callback: LoadRangeCallback<T>) {
|
||||||
networkState.postValue(NetworkState.LOADING)
|
networkState.postValue(NetworkState.LOADING)
|
||||||
retry = null
|
retry = null
|
||||||
if(source.exhausted) {
|
if (source.exhausted) {
|
||||||
return callback.onResult(emptyList())
|
return callback.onResult(emptyList())
|
||||||
}
|
}
|
||||||
mastodonApi.searchObservable(searchType.apiParameter, searchRequest, true, params.loadSize, params.startPosition, false)
|
mastodonApi.searchObservable(
|
||||||
|
query = searchRequest,
|
||||||
|
type = searchType.apiParameter,
|
||||||
|
resolve = true,
|
||||||
|
limit = params.loadSize,
|
||||||
|
offset = params.startPosition,
|
||||||
|
following = false)
|
||||||
.subscribe(
|
.subscribe(
|
||||||
{ data ->
|
{ data ->
|
||||||
// Working around Mastodon bug where exact match is returned no matter
|
// Working around Mastodon bug where exact match is returned no matter
|
||||||
|
@ -101,7 +107,7 @@ class SearchDataSource<T>(
|
||||||
} else {
|
} else {
|
||||||
parser(data)
|
parser(data)
|
||||||
}
|
}
|
||||||
if(res.isEmpty()) {
|
if (res.isEmpty()) {
|
||||||
source.exhausted = true
|
source.exhausted = true
|
||||||
}
|
}
|
||||||
callback.onResult(res)
|
callback.onResult(res)
|
||||||
|
|
Loading…
Add table
Reference in a new issue