From 7dcd6221aad88c68d54729f166702dfe32aaa135 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 f02038db..f170f35e 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)