Skip to content

Conversation

leftPartizan
Copy link

No description provided.

…. в useCase перенесена ссылка репозиторий, чтобы презентор работал не через репозитрий напрямую а через useCase

interface MvvmContract {

val listPosts: MutableLiveData<List<Post>>

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

лучше наружу выводить LiveData а не мутабельную. Вью не должна ничего постить во вьюмодель


private val repository: IRepository = Repository()

fun loadPosts(listPosts: MutableLiveData<List<Post>>, errorMessage: MutableLiveData<Throwable>) {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

лучше не нагружать юзкейс ещё логикой передачи данных во вьюмодель. Лучше просто получат их из источника и сортирует, а про то как их передать на вью, лучше пусть думает вьюмодель

import com.example.architecturebase.UseCases.UseCaseGetPosts
import com.example.architecturebase.network.model.Post

class ViewModelMvvm : LifecycleObserver, MvvmContract {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

нужно отнаследоваться именно от ViewModel от google

…ределил binding по красоте, ViewModelMvvm.kt теперь сама обрабатывет запросы из UseCaseGetPosts.kt, ViewModelMvvm.kt, наследуется от ViewModel, обнавлен MvvmContract.kt чтобы фрагмент не мог изменять LiveData
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants