-
Notifications
You must be signed in to change notification settings - Fork 205
rxJava homework #156
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
rxJava homework #156
Conversation
antonkazakov
left a comment
There was a problem hiding this 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) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Предлагаю эту задачу решить через операторы, в целом применение Thread.sleep не лучшая практика
There was a problem hiding this comment.
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()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Не совсем понял зачем эта проперти нужна? Почему недостаточно функции getFacts
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Я так вижу, в принципе, все можно и внутри getFacts сделать. А да, вот зачем я ее оставил - чтобы отписаться проще было.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
А каким образом она помогает отписаться? Если тебе нужно отписаться то в случае с 1 подпиской просто сохрани ссылку на диспозабл, в случае с >1 подпиской сохрани их в CompositeDisposable.
Если я сейчас дерну публичную функцию getFacts то мне нужно будет во вью/фрагменте подписываться чтоли?
Первый вариант домашки с Retrofit и rxJava