-
-
Save jmfayard/5313e2fa8afdbba84bb94ea5a0a52792 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
interface CatApi | |
interface CatService | |
interface CatRepository | |
interface Scheduler | |
interface Context | |
abstract class Application { | |
abstract fun onCreate() | |
} | |
abstract class AppCompatActivity | |
fun app(): AppComponent = TODO("") | |
fun common(): CommonComponent = TODO() | |
fun api(): ApiComponent = TODO() | |
interface AppComponent { | |
val moshi: Moshi | |
val context: Context | |
val retrofit: Retrofit | |
val okHttpClient: OkHttpClient | |
val catApi: CatApi | |
val catRepository: CatRepository | |
val catService: CatService | |
val mainThread: Scheduler | |
val backgroundThread: Scheduler | |
companion object { | |
lateinit var instance: AppComponent | |
} | |
} | |
interface ApiComponent: AppComponent { | |
companion object { | |
lateinit var instance: ApiComponent | |
} | |
} | |
interface CommonComponent : ApiComponent { | |
companion object { | |
lateinit var instance: CommonComponent | |
} | |
} | |
// Implement the union of all properties | |
abstract class ComponentsImplementation( | |
override val moshi: Moshi, | |
override val context: Context | |
) : CommonComponent, AppComponent |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment