From ab23ec3f352e4dae428e5c943a969d51dc7f051e Mon Sep 17 00:00:00 2001 From: ganfra Date: Thu, 4 Jul 2019 10:20:50 +0200 Subject: [PATCH] Fix https://github.com/matrix-org/riot-android-rageshakes/issues/5851 (DI) --- .../src/main/java/im/vector/riotx/core/di/ScreenComponent.kt | 3 +++ .../src/main/java/im/vector/riotx/core/di/ViewModelModule.kt | 5 +++++ .../riotx/features/settings/push/PushGatewaysFragment.kt | 5 +++++ 3 files changed, 13 insertions(+) diff --git a/vector/src/main/java/im/vector/riotx/core/di/ScreenComponent.kt b/vector/src/main/java/im/vector/riotx/core/di/ScreenComponent.kt index de5735f989..06f6512939 100644 --- a/vector/src/main/java/im/vector/riotx/core/di/ScreenComponent.kt +++ b/vector/src/main/java/im/vector/riotx/core/di/ScreenComponent.kt @@ -57,6 +57,7 @@ import im.vector.riotx.features.settings.VectorSettingsActivity import im.vector.riotx.features.settings.VectorSettingsNotificationPreferenceFragment import im.vector.riotx.features.settings.VectorSettingsNotificationsTroubleshootFragment import im.vector.riotx.features.settings.VectorSettingsPreferencesFragment +import im.vector.riotx.features.settings.push.PushGatewaysFragment @Component(dependencies = [VectorComponent::class], modules = [ViewModelModule::class, HomeModule::class]) @ScreenScope @@ -142,6 +143,8 @@ interface ScreenComponent { fun inject(vectorSettingsNotificationsTroubleshootFragment: VectorSettingsNotificationsTroubleshootFragment) + fun inject(pushGatewaysFragment: PushGatewaysFragment) + @Component.Factory interface Factory { fun create(vectorComponent: VectorComponent, diff --git a/vector/src/main/java/im/vector/riotx/core/di/ViewModelModule.kt b/vector/src/main/java/im/vector/riotx/core/di/ViewModelModule.kt index ab143c623c..234d4a0caf 100644 --- a/vector/src/main/java/im/vector/riotx/core/di/ViewModelModule.kt +++ b/vector/src/main/java/im/vector/riotx/core/di/ViewModelModule.kt @@ -53,6 +53,8 @@ import im.vector.riotx.features.roomdirectory.picker.RoomDirectoryPickerViewMode import im.vector.riotx.features.roomdirectory.picker.RoomDirectoryPickerViewModel_AssistedFactory import im.vector.riotx.features.roomdirectory.roompreview.RoomPreviewViewModel import im.vector.riotx.features.roomdirectory.roompreview.RoomPreviewViewModel_AssistedFactory +import im.vector.riotx.features.settings.push.PushGatewaysViewModel +import im.vector.riotx.features.settings.push.PushGatewaysViewModel_AssistedFactory import im.vector.riotx.features.workers.signout.SignOutViewModel @Module @@ -157,4 +159,7 @@ interface ViewModelModule { @Binds fun bindCreateRoomViewModelFactory(factory: CreateRoomViewModel_AssistedFactory): CreateRoomViewModel.Factory + @Binds + fun bindPushGatewaysViewModelFactory(factory: PushGatewaysViewModel_AssistedFactory): PushGatewaysViewModel.Factory + } \ No newline at end of file diff --git a/vector/src/main/java/im/vector/riotx/features/settings/push/PushGatewaysFragment.kt b/vector/src/main/java/im/vector/riotx/features/settings/push/PushGatewaysFragment.kt index 275e66a6da..207f9a668d 100644 --- a/vector/src/main/java/im/vector/riotx/features/settings/push/PushGatewaysFragment.kt +++ b/vector/src/main/java/im/vector/riotx/features/settings/push/PushGatewaysFragment.kt @@ -24,6 +24,7 @@ import com.airbnb.epoxy.TypedEpoxyController import com.airbnb.mvrx.fragmentViewModel import com.airbnb.mvrx.withState import im.vector.riotx.R +import im.vector.riotx.core.di.ScreenComponent import im.vector.riotx.core.platform.VectorBaseActivity import im.vector.riotx.core.platform.VectorBaseFragment import im.vector.riotx.core.resources.StringProvider @@ -45,6 +46,10 @@ class PushGatewaysFragment : VectorBaseFragment() { (activity as? VectorBaseActivity)?.supportActionBar?.setTitle(R.string.settings_notifications_targets) } + override fun injectWith(injector: ScreenComponent) { + injector.inject(this) + } + override fun onActivityCreated(savedInstanceState: Bundle?) { super.onActivityCreated(savedInstanceState) val lmgr = LinearLayoutManager(context, RecyclerView.VERTICAL, false)