Last active
August 16, 2018 02:19
-
-
Save paulocns/fbe799caca0540b4d7a90c215403f743 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class SearchShows @Inject | |
constructor(private val showRepository: ShowRepository) : | |
UseCase<List<ShowResponse>>() { | |
var query: String? = null | |
override suspend fun executeOnBackground(): List<ShowResponse> { | |
query?.let { query -> | |
return showRepository.searchShow(query).map { | |
background { | |
val rating: Rating = showRepository.showRating(it.show!!.ids!!.trakt!!) | |
ShowResponse(it.show.title!!, rating.rating) | |
} | |
}.map { | |
it.await() | |
} | |
} | |
return arrayListOf() | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment