-
Notifications
You must be signed in to change notification settings - Fork 186
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
Rx Homework #52
base: master
Are you sure you want to change the base?
Rx Homework #52
Conversation
catsService.getCatFact() | ||
.subscribeOn(Schedulers.io()) | ||
.onErrorResumeNext(localCatFactsGenerator.generateCatFact()) | ||
.delay(2000, TimeUnit.MILLISECONDS) |
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.
Тут есть проблема, что если перевести девайс в авиа режим то берется только один факт из локального списка и обновление прекращается, а должны продолжать обновляться каждые 2 секунды
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.
Поправил
@@ -25,6 +28,9 @@ class LocalCatFactsGenerator( | |||
*/ | |||
fun generateCatFactPeriodically(): Flowable<Fact> { | |||
val success = Fact(context.resources.getStringArray(R.array.local_cat_facts)[Random.nextInt(5)]) | |||
return Flowable.empty() | |||
return Flowable.create<Fact?>( { emitter -> |
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.
тут получается мы создаем поток данных один раз берем факт о коте, засыпаем на две секунды и больше ничего не происходит, можно посмотреть в сторону Flowable.interval()
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.
Поправил
No description provided.