Skip to content

Выполненое задание по FLow#235

Open
BambinoGrandi wants to merge 3 commits intoOtus-Android:masterfrom
BambinoGrandi:home_work
Open

Выполненое задание по FLow#235
BambinoGrandi wants to merge 3 commits intoOtus-Android:masterfrom
BambinoGrandi:home_work

Conversation

@BambinoGrandi
Copy link

Описание

  • Сделан рефакторинг на Flow
  • Выполнены все задачи в SampleInteractor

Скриншоты

Снимок экрана 2026-01-25 в 19 12 45

withContext(Dispatchers.IO) {
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.

исправил

delay(refreshIntervalMs)
}
}.catch { error ->
Result.Error(

Choose a reason for hiding this comment

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

тут нужно ошибку эмитить, плюс перепробросить CancellationException дальше, иначе сломается механизм отмены корутин:

    if (e is CancellationException) throw e
    emit(Result.Error(e.message.orEmpty()))

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