From fde23f25d209778736f89c44bb0a3fb837c615f4 Mon Sep 17 00:00:00 2001 From: Konrad Pozniak Date: Fri, 7 Feb 2020 20:23:36 +0100 Subject: [PATCH] fix mixup of search params in SearchDataSource.loadRange (#1666) --- .../components/search/adapter/SearchDataSource.kt | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/app/src/main/java/com/keylesspalace/tusky/components/search/adapter/SearchDataSource.kt b/app/src/main/java/com/keylesspalace/tusky/components/search/adapter/SearchDataSource.kt index f02038dbd..f170f35ec 100644 --- a/app/src/main/java/com/keylesspalace/tusky/components/search/adapter/SearchDataSource.kt +++ b/app/src/main/java/com/keylesspalace/tusky/components/search/adapter/SearchDataSource.kt @@ -62,7 +62,7 @@ class SearchDataSource( resolve = true, limit = params.requestedLoadSize, offset = 0, - following =false) + following = false) .subscribe( { data -> val res = parser(data) @@ -84,10 +84,16 @@ class SearchDataSource( override fun loadRange(params: LoadRangeParams, callback: LoadRangeCallback) { networkState.postValue(NetworkState.LOADING) retry = null - if(source.exhausted) { + if (source.exhausted) { 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( { data -> // Working around Mastodon bug where exact match is returned no matter @@ -101,7 +107,7 @@ class SearchDataSource( } else { parser(data) } - if(res.isEmpty()) { + if (res.isEmpty()) { source.exhausted = true } callback.onResult(res)