Closed devKshitijJain closed 6 years ago
Oh you mean like this?
class ApplicationClazz : DaggerApplication() {
private val appComponent = DaggerAppComponent.builder()
.application(this)
.build()
override fun onCreate() {
super.onCreate()
if (!LeakCanary.isInAnalyzerProcess(this)) {
LeakCanary.install(this)
}
if(BuildConfig.DEBUG) {
Timber.plant(Timber.DebugTree())
}
appComponent.inject(this)
PreferenceComponent_PrefAppComponent.init(this)
}
override fun applicationInjector(): AndroidInjector<out DaggerApplication> {
return appComponent
}
}
I think it looks better than before too. Thank you!!
If you want to contribute any codes or change something, welcome to Pull Request! :)
Let's discuss the approach that you have followed. I think we can make the code more robust and better. Add me on FB @kjain9878
Refactored with PR
okay, Thanks!!
https://github.com/skydoves/GithubFollows/blob/966f1a36ca70b3bbdc4a49916ba49a66bb3f50d1/app/src/main/java/com/skydoves/githubfollows/ApplicationClazz.kt#L24
Here you are calling
and then you are returning
can't you just make a var for
DaggerAppComponent.builder().application(this).build()
and then just call inject on that above.