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
class GitRepoRepository @Inject constructor(var netManager: NetManager) { | |
... | |
} |
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
@Singleton | |
class NetManager @Inject constructor(var applicationContext: Context) { | |
... | |
} |
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
@Module | |
internal abstract class MainActivityModule { | |
@Module | |
companion object { | |
@JvmStatic | |
@Provides | |
internal fun providesMainViewModelFactory(gitRepoRepository: GitRepoRepository) | |
: MainViewModelFactory { |
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
@Singleton | |
@Component( | |
modules = [AndroidSupportInjectionModule::class, | |
AppModule::class]) | |
interface AppComponent : AndroidInjector<ModernApplication> { | |
@Component.Builder | |
abstract class Builder : AndroidInjector.Builder<ModernApplication>() | |
} |
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
@Singleton | |
@Component( | |
modules = [AndroidSupportInjectionModule::class, | |
AppModule::class, | |
AndroidManagersModule::class, | |
DataModule::class]) | |
interface AppComponent : AndroidInjector<ModernApplication> { | |
@Component.Builder | |
abstract class Builder : AndroidInjector.Builder<ModernApplication>() |
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
@Module | |
class DataModule { | |
@Provides | |
fun providesGitRepoRepsitory(netManager: NetManager): GitRepoRepository { | |
return GitRepoRepository(netManager) | |
} | |
} |
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
@Module | |
internal abstract class MainActivityModule { | |
@ContributesAndroidInjector() | |
internal abstract fun mainActivity(): MainActivity | |
} |
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
class ModernApplication : DaggerApplication(){ | |
override fun applicationInjector(): AndroidInjector<out DaggerApplication> { | |
return DaggerAppComponent.builder().create(this) | |
} | |
} |
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
@Singleton | |
@Component( | |
modules = [AndroidSupportInjectionModule::class, | |
AppModule::class, | |
AndroidManagersModule::class, | |
DataModule::class, | |
MainActivityModule::class]) | |
interface AppComponent : AndroidInjector<ModernApplication> { | |
@Component.Builder |
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
@Module | |
class AndroidManagersModule { | |
@Singleton @Provides | |
fun providesNetManager(applicationContext: ModernApplication): NetManager { | |
return NetManager(applicationContext) | |
} | |
} |