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

abstract class UseCase actual layer placement? #82

Open
mochadwi opened this issue Aug 23, 2019 · 0 comments
Open

abstract class UseCase actual layer placement? #82

mochadwi opened this issue Aug 23, 2019 · 0 comments

Comments

@mochadwi
Copy link

mochadwi commented Aug 23, 2019

abstract class UseCase<out Type, in Params> where Type : Any {

    abstract suspend fun run(params: Params): Either<Failure, Type>

    operator fun invoke(params: Params, onResult: (Either<Failure, Type>) -> Unit = {}) {
        val job = async(CommonPool) { run(params) }
        launch(UI) { onResult(job.await()) }
    }

    class None
}

I've somewhat confused with this. Does this abstract class use case violate the domain layer? Usecase should be dumb and doesn't know the coroutines?

cmiiw @android10

@mochadwi mochadwi changed the title abstract class UseCase the recommended ways? abstract class UseCase actual layer placement? Aug 23, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant