Introduced ability to override AndroidMainThreadFeatureScheduler via plugin - #194
Introduced ability to override AndroidMainThreadFeatureScheduler via plugin#194LachlanMcKee wants to merge 1 commit into
Conversation
d2370fc to
f474107
Compare
| /** | ||
| * Overrides the [AndroidMainThreadFeatureScheduler]. | ||
| */ | ||
| fun setMainThreadFeatureScheduler(schedulerProvider: () -> FeatureScheduler) { |
There was a problem hiding this comment.
What is the point of using provider if you invoke it instantly?
Wanted to make it lazy?
There was a problem hiding this comment.
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.
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.
Hide? We have reset() for reset. Otherwise not clear what to use: AndroidMainThreadFeatureScheduler or AndroidMainThreadFeatureScheduler.Default.
There was a problem hiding this comment.
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.mdif required.