|
@@ -1,14 +1,21 @@
|
|
|
package com.mrozon.healthdiary
|
|
package com.mrozon.healthdiary
|
|
|
|
|
|
|
|
import android.app.Application
|
|
import android.app.Application
|
|
|
|
|
+import com.mrozon.core_api.providers.AppWithFacade
|
|
|
|
|
+import com.mrozon.core_api.providers.ProvidersFacade
|
|
|
|
|
+import com.mrozon.healthdiary.di.FacadeComponent
|
|
|
import timber.log.Timber
|
|
import timber.log.Timber
|
|
|
|
|
|
|
|
-class App: Application() {
|
|
|
|
|
|
|
+class App: Application(), AppWithFacade {
|
|
|
|
|
+
|
|
|
|
|
+ companion object {
|
|
|
|
|
+ private var facadeComponent: FacadeComponent? = null
|
|
|
|
|
+ }
|
|
|
|
|
|
|
|
override fun onCreate() {
|
|
override fun onCreate() {
|
|
|
super.onCreate()
|
|
super.onCreate()
|
|
|
initTimber()
|
|
initTimber()
|
|
|
- initDagger()
|
|
|
|
|
|
|
+ (getFacade() as FacadeComponent).inject(this)
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
private fun initTimber() {
|
|
private fun initTimber() {
|
|
@@ -16,11 +23,8 @@ class App: Application() {
|
|
|
Timber.plant(Timber.DebugTree())
|
|
Timber.plant(Timber.DebugTree())
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- private fun initDagger() {
|
|
|
|
|
-// DaggerAppComponent.builder()
|
|
|
|
|
-// .application(this)
|
|
|
|
|
-// .build()
|
|
|
|
|
-// .inject(this)
|
|
|
|
|
|
|
+ override fun getFacade(): ProvidersFacade {
|
|
|
|
|
+ return facadeComponent ?: FacadeComponent.init(this).also { facadeComponent = it }
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|