-
Notifications
You must be signed in to change notification settings - Fork 90
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
Introduced ability to override AndroidMainThreadFeatureScheduler via plugin #194
base: master
Are you sure you want to change the base?
Introduced ability to override AndroidMainThreadFeatureScheduler via plugin #194
Conversation
d2370fc
to
f474107
Compare
/** | ||
* Overrides the [AndroidMainThreadFeatureScheduler]. | ||
*/ | ||
fun setMainThreadFeatureScheduler(schedulerProvider: () -> FeatureScheduler) { |
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.
What is the point of using provider if you invoke it instantly?
Wanted to make it lazy?
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.
RxJava uses these as functions. I assume this is because some users may want to do some lazy initialisation.
It thought it would be wise to leave a similar option for users.
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.
Because in RxJava these providers are actually lazy and invoked only when we invoke Schedulers.io()
(or other getter).
In our case we just create a lamda and instantly invoke it.
* The default implementation of the [AndroidMainThreadFeatureScheduler] which delegates to the | ||
* RxAndroid main thread scheduler | ||
*/ | ||
object Default : FeatureScheduler { |
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.
Hide? We have reset()
for reset. Otherwise not clear what to use: AndroidMainThreadFeatureScheduler
or AndroidMainThreadFeatureScheduler.Default
.
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.
seems reasonable
Description
Introduced mechanism to override the AndroidMainThreadFeatureScheduler via plugin.
This makes it easier to test logic (similar to overriding RxJava schedulers)
Check list
CHANGELOG.md
if required.