Skip to content

Instantly share code, notes, and snippets.

@lamvann
Created July 30, 2019 15:42
Show Gist options
  • Save lamvann/ca221d74abe68a964dba5a4b1f02b3de to your computer and use it in GitHub Desktop.
Save lamvann/ca221d74abe68a964dba5a4b1f02b3de to your computer and use it in GitHub Desktop.
@Component(
modules = [
ApiModule::class,
ContractModule::class,
ActivityBindingModule::class,
AndroidSupportInjectionModule::class
]
)
@Singleton
interface AppComponent : AndroidInjector<PresentationApp> {
/*
* We will call this builder interface from our custom Application class.
* This will set our application object to the AppComponent.
* So inside the AppComponent the application instance is available.
* So this application instance can be accessed by our modules
* such as ApiModule when needed
*
* */
/*
* This is our custom Application class
* */
override fun inject(presentationApp: PresentationApp)
@Component.Builder
interface Builder {
@BindsInstance
fun application(application: Application): Builder
fun build(): AppComponent
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment