Skip to content

Conversation

@RubberBigPepper
Copy link

Первый вариант домашки с Retrofit и rxJava

Copy link
Contributor

@antonkazakov antonkazakov left a comment

Choose a reason for hiding this comment

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

Привет. Оставил вопросы

}.dispose()
}
)
TimeUnit.MILLISECONDS.sleep(2000)
Copy link
Contributor

Choose a reason for hiding this comment

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

Предлагаю эту задачу решить через операторы, в целом применение Thread.sleep не лучшая практика

Copy link
Author

Choose a reason for hiding this comment

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

Переделал через операторы

_catsLiveData.value = ServerError
}
})
private val flowableFacts = getFacts().subscribeOn(Schedulers.io())
Copy link
Contributor

Choose a reason for hiding this comment

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

Не совсем понял зачем эта проперти нужна? Почему недостаточно функции getFacts

Copy link
Author

Choose a reason for hiding this comment

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

Я так вижу, в принципе, все можно и внутри getFacts сделать. А да, вот зачем я ее оставил - чтобы отписаться проще было.

Copy link
Contributor

@antonkazakov antonkazakov Jun 16, 2024

Choose a reason for hiding this comment

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

А каким образом она помогает отписаться? Если тебе нужно отписаться то в случае с 1 подпиской просто сохрани ссылку на диспозабл, в случае с >1 подпиской сохрани их в CompositeDisposable.
Если я сейчас дерну публичную функцию getFacts то мне нужно будет во вью/фрагменте подписываться чтоли?

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