Skip to content

Conversation

@AleksVira
Copy link

No description provided.

import kotlinx.coroutines.withContext

sealed class Result {
data class Success(val fact: Fact) : Result()

Choose a reason for hiding this comment

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

тут по условиям должен быть дженерик

Copy link
Author

Choose a reason for hiding this comment

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

Ок, сделал дженериком.

catsRepository.listenForCatFacts().collect {
_catsLiveData.value = it
}
catsRepository.listenForCatFacts()

Choose a reason for hiding this comment

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

ошибки при получении по сети лучше бы обработать в репозитории, зачем вьюмодели о них что-то знать? это не ее ответственность

Copy link
Author

Choose a reason for hiding this comment

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

Согласен, избавил ViewModel от несвойственной ему работы

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.

2 participants