#3733 On first view of DepictionUpload suggestions don't show - remove zip which was only taking 1 value from the processor (#3737)

This commit is contained in:
Seán Mac Gillicuddy 2020-05-12 14:38:45 +01:00 committed by GitHub
parent 057d11a0e0
commit affcd8a6d7
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 9 deletions

View file

@ -9,7 +9,6 @@ import fr.free.nrw.commons.wikidata.WikidataDisambiguationItems
import io.reactivex.Flowable
import io.reactivex.Scheduler
import io.reactivex.disposables.CompositeDisposable
import io.reactivex.functions.BiFunction
import io.reactivex.processors.PublishProcessor
import timber.log.Timber
import java.lang.reflect.Proxy
@ -59,12 +58,8 @@ class DepictsPresenter @Inject constructor(
)
}
private fun searchResultsWithTerm(it: String): Flowable<Pair<List<DepictedItem>, String>> {
return Flowable.zip(
searchResults(it),
Flowable.just(it),
BiFunction { results: List<DepictedItem>, term: String -> Pair(results, term) }
)
private fun searchResultsWithTerm(term: String): Flowable<Pair<List<DepictedItem>, String>> {
return searchResults(term).map { Pair(it, term) }
}
private fun searchResults(it: String): Flowable<List<DepictedItem>> {

View file

@ -13,7 +13,7 @@ import javax.inject.Singleton
@Singleton
class DepictModel @Inject constructor(private val depictsClient: DepictsClient) {
var nearbyPlaces: BehaviorProcessor<List<Place>> = BehaviorProcessor.createDefault(emptyList())
val nearbyPlaces: BehaviorProcessor<List<Place>> = BehaviorProcessor.createDefault(emptyList())
companion object {
@ -45,7 +45,7 @@ class DepictModel @Inject constructor(private val depictsClient: DepictsClient)
}
fun cleanUp() {
nearbyPlaces = BehaviorProcessor.createDefault(emptyList())
nearbyPlaces.offer(emptyList())
}
}