private fun observeQueryChanges() {
viewModel.searchParams.observe(this, Observer {
viewModel.searchPosts(it)
})
}
This can actually be moved into Transformations.switchMap(searchParams) { searchPosts(it) } inside the ViewModel. That way you don't need to observe the changes here, you can just observe the posts themselves.
Thanks for the feedback! Totally, there are a few things that I could improve on this architecture, I need to update a few things here though, for example, I've changed a bit the API of the Interactors so I can actually dispose them when the ViewModel gets destroyed.
Please let me know if you see anything else that you think could be improved. 🤓💪
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
Hey!
This can actually be moved into
Transformations.switchMap(searchParams) { searchPosts(it) }
inside the ViewModel. That way you don't need to observe the changes here, you can just observe the posts themselves.Thanks for the feedback! Totally, there are a few things that I could improve on this architecture, I need to update a few things here though, for example, I've changed a bit the API of the Interactors so I can actually dispose them when the ViewModel gets destroyed.
Please let me know if you see anything else that you think could be improved. 🤓💪