При попытке внедрить сбой приложения со свойством lateinit ... не было инициализировано исключение. Я понимаю, что мне нужно добавить свое приложение в график, но мне это не удается. Каков наилучший способ сделать это?
class App : Application() {
@Inject
lateinit var localeManager: Lazy<LocaleManager>
val appComponent: AppComponent by lazy {
DaggerAppComponent.factory().create(applicationContext)
}
override fun attachBaseContext(base: Context) {
super.attachBaseContext(localeManager.get().setLocale(base))
}
override fun onConfigurationChanged(newConfig: Configuration) {
super.onConfigurationChanged(newConfig)
localeManager.get().setLocale(this)
}
}
@Singleton
@Component(modules = [NetworkModule::class, AppSubcomponents::class])
interface AppComponent {
@Component.Factory
interface Factory {
fun create(@BindsInstance context: Context): AppComponent
}
fun registrationComponent(): RegistrationComponent.Factory
fun lobbyComponent(): PropertyComponent.Factory
fun supplierComponent(): SupplierComponent.Factory
fun notificationComponent(): NotificationComponent.Factory
fun serviceComponent(): ServiceComponent.Factory
fun settingsComponent() : SettingsComponent.Factory
fun cardComponent() : CardComponent.Factory
fun inject(activity: MainActivity)
}
class LocaleManager @Inject constructor(val storage: UserStorage) {
//some code
}