android10 / Android-CleanArchitecture-Kotlin

This is a movies sample app in Kotlin, which is part of a serie of blog posts I have written about architecting android application using different approaches.
https://fernandocejas.com/2018/05/07/architecting-android-reloaded/
4.64k stars 921 forks source link

abstract class UseCase actual layer placement? #82

Open mochadwi opened 4 years ago

mochadwi commented 4 years ago
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