Skip to content
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

Create single threaded Feature with scheduler #158

Merged
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Updated MVICore demo to use featureScheduler
  • Loading branch information
LachlanMcKee committed Aug 3, 2022
commit 8651cca03c786b15021fa118de9fbbd95610510e
1 change: 1 addition & 0 deletions mvicore-demo/mvicore-demo-feature2/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -43,5 +43,6 @@ dependencies {
implementation deps('io.reactivex.rxjava2:rxandroid')

implementation project(":mvicore")
implementation project(":mvicore-android")
implementation project(':mvicore-demo:mvicore-demo-catapi')
}
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import com.badoo.feature2.Feature2.News
import com.badoo.feature2.Feature2.State
import com.badoo.feature2.Feature2.Wish
import com.badoo.feature2.Feature2.Wish.LoadNewImage
import com.badoo.mvicore.android.AndroidMainThreadFeatureScheduler
import com.badoo.mvicore.element.Actor
import com.badoo.mvicore.element.Bootstrapper
import com.badoo.mvicore.element.NewsPublisher
Expand All @@ -19,7 +20,6 @@ import com.badoo.mvicore.element.TimeCapsule
import com.badoo.mvicore.feature.ActorReducerFeature
import io.reactivex.Observable
import io.reactivex.Observable.just
import io.reactivex.android.schedulers.AndroidSchedulers
import kotlinx.android.parcel.Parcelize

class Feature2(
Expand All @@ -29,7 +29,8 @@ class Feature2(
bootstrapper = BootStrapperImpl(),
actor = ActorImpl(),
reducer = ReducerImpl(),
newsPublisher = NewsPublisherImpl()
newsPublisher = NewsPublisherImpl(),
featureScheduler = AndroidMainThreadFeatureScheduler
) {
init {
timeCapsule?.register(Feature2::class.java) { state.copy(
Expand Down Expand Up @@ -74,7 +75,6 @@ class Feature2(
fun loadRandomImage(): Observable<Response> {
return service.getRandomImage()
.randomlyThrowAnException()
.observeOn(AndroidSchedulers.mainThread())
}
}

Expand Down