This commit is contained in:
Benoit Marty 2020-11-26 20:58:41 +01:00 committed by Benoit Marty
parent 63b068f426
commit 41dd67f1c1
6 changed files with 20 additions and 20 deletions

View File

@ -36,7 +36,7 @@ import im.vector.app.features.reactions.EmojiChooserViewModel
import im.vector.app.features.roomdirectory.RoomDirectorySharedActionViewModel
import im.vector.app.features.roomprofile.RoomProfileSharedActionViewModel
import im.vector.app.features.roomprofile.alias.detail.RoomAliasBottomSheetSharedActionViewModel
import im.vector.app.features.roomprofile.settings.historyvisibility.SetRoomHistoryVisibilitySharedActionViewModel
import im.vector.app.features.roomprofile.settings.historyvisibility.RoomHistoryVisibilitySharedActionViewModel
import im.vector.app.features.userdirectory.UserListSharedActionViewModel
@Module
@ -114,8 +114,8 @@ interface ViewModelModule {
@Binds
@IntoMap
@ViewModelKey(SetRoomHistoryVisibilitySharedActionViewModel::class)
fun bindSetRoomHistoryVisibilitySharedActionViewModel(viewModel: SetRoomHistoryVisibilitySharedActionViewModel): ViewModel
@ViewModelKey(RoomHistoryVisibilitySharedActionViewModel::class)
fun bindRoomHistoryVisibilitySharedActionViewModel(viewModel: RoomHistoryVisibilitySharedActionViewModel): ViewModel
@Binds
@IntoMap

View File

@ -40,7 +40,7 @@ import im.vector.app.features.home.AvatarRenderer
import im.vector.app.features.roomprofile.RoomProfileArgs
import im.vector.app.features.roomprofile.RoomProfileSharedAction
import im.vector.app.features.roomprofile.RoomProfileSharedActionViewModel
import im.vector.app.features.roomprofile.settings.historyvisibility.SetRoomHistoryVisibilitySharedActionViewModel
import im.vector.app.features.roomprofile.settings.historyvisibility.RoomHistoryVisibilitySharedActionViewModel
import im.vector.app.features.roomprofile.settings.historyvisibility.RoomHistoryVisibilityBottomSheet
import kotlinx.android.synthetic.main.fragment_room_setting_generic.*
import kotlinx.android.synthetic.main.merge_overlay_waiting_view.*
@ -61,7 +61,7 @@ class RoomSettingsFragment @Inject constructor(
private val viewModel: RoomSettingsViewModel by fragmentViewModel()
private lateinit var roomProfileSharedActionViewModel: RoomProfileSharedActionViewModel
private lateinit var sharedActionViewModel: SetRoomHistoryVisibilitySharedActionViewModel
private lateinit var roomHistoryVisibilitySharedActionViewModel: RoomHistoryVisibilitySharedActionViewModel
private val roomProfileArgs: RoomProfileArgs by args()
private val galleryOrCameraDialogHelper = GalleryOrCameraDialogHelper(this, colorProvider)
@ -72,7 +72,7 @@ class RoomSettingsFragment @Inject constructor(
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
super.onViewCreated(view, savedInstanceState)
roomProfileSharedActionViewModel = activityViewModelProvider.get(RoomProfileSharedActionViewModel::class.java)
setupRoomHistoryVisibilitySharedViewModel()
setupRoomHistoryVisibilitySharedActionViewModel()
controller.callback = this
setupToolbar(roomSettingsToolbar)
roomSettingsRecyclerView.configureWith(controller, hasFixedSize = true)
@ -91,9 +91,9 @@ class RoomSettingsFragment @Inject constructor(
}
}
private fun setupRoomHistoryVisibilitySharedViewModel() {
sharedActionViewModel = activityViewModelProvider.get(SetRoomHistoryVisibilitySharedActionViewModel::class.java)
sharedActionViewModel
private fun setupRoomHistoryVisibilitySharedActionViewModel() {
roomHistoryVisibilitySharedActionViewModel = activityViewModelProvider.get(RoomHistoryVisibilitySharedActionViewModel::class.java)
roomHistoryVisibilitySharedActionViewModel
.observe()
.subscribe { action ->
viewModel.handle(RoomSettingsAction.SetRoomHistoryVisibility(action.roomHistoryVisibility))

View File

@ -20,7 +20,7 @@ import androidx.annotation.DrawableRes
import im.vector.app.core.ui.bottomsheet.BottomSheetGenericAction
import org.matrix.android.sdk.api.session.room.model.RoomHistoryVisibility
class BottomSheetRoomHistoryVisibilityAction(
class RoomHistoryVisibilityAction(
val roomHistoryVisibility: RoomHistoryVisibility,
title: String,
@DrawableRes iconResId: Int,

View File

@ -33,9 +33,9 @@ data class RoomHistoryVisibilityBottomSheetArgs(
val currentRoomHistoryVisibility: RoomHistoryVisibility
) : Parcelable
class RoomHistoryVisibilityBottomSheet : BottomSheetGeneric<RoomHistoryVisibilityState, BottomSheetRoomHistoryVisibilityAction>() {
class RoomHistoryVisibilityBottomSheet : BottomSheetGeneric<RoomHistoryVisibilityState, RoomHistoryVisibilityAction>() {
private lateinit var roomHistoryVisibilitySharedActionViewModel: SetRoomHistoryVisibilitySharedActionViewModel
private lateinit var roomHistoryVisibilitySharedActionViewModel: RoomHistoryVisibilitySharedActionViewModel
@Inject lateinit var controller: RoomHistoryVisibilityController
@Inject lateinit var roomHistoryVisibilityViewModelFactory: RoomHistoryVisibilityViewModel.Factory
private val viewModel: RoomHistoryVisibilityViewModel by fragmentViewModel(RoomHistoryVisibilityViewModel::class)
@ -44,14 +44,14 @@ class RoomHistoryVisibilityBottomSheet : BottomSheetGeneric<RoomHistoryVisibilit
injector.inject(this)
}
override fun getController(): BottomSheetGenericController<RoomHistoryVisibilityState, BottomSheetRoomHistoryVisibilityAction> = controller
override fun getController(): BottomSheetGenericController<RoomHistoryVisibilityState, RoomHistoryVisibilityAction> = controller
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
super.onViewCreated(view, savedInstanceState)
roomHistoryVisibilitySharedActionViewModel = activityViewModelProvider.get(SetRoomHistoryVisibilitySharedActionViewModel::class.java)
roomHistoryVisibilitySharedActionViewModel = activityViewModelProvider.get(RoomHistoryVisibilitySharedActionViewModel::class.java)
}
override fun didSelectAction(action: BottomSheetRoomHistoryVisibilityAction) {
override fun didSelectAction(action: RoomHistoryVisibilityAction) {
roomHistoryVisibilitySharedActionViewModel.post(action)
dismiss()
}

View File

@ -23,9 +23,9 @@ import javax.inject.Inject
class RoomHistoryVisibilityController @Inject constructor(
private val historyVisibilityFormatter: RoomHistoryVisibilityFormatter
) : BottomSheetGenericController<RoomHistoryVisibilityState, BottomSheetRoomHistoryVisibilityAction>() {
) : BottomSheetGenericController<RoomHistoryVisibilityState, RoomHistoryVisibilityAction>() {
override fun getActions(state: RoomHistoryVisibilityState): List<BottomSheetRoomHistoryVisibilityAction> {
override fun getActions(state: RoomHistoryVisibilityState): List<RoomHistoryVisibilityAction> {
return listOf(
RoomHistoryVisibility.WORLD_READABLE,
RoomHistoryVisibility.SHARED,
@ -33,7 +33,7 @@ class RoomHistoryVisibilityController @Inject constructor(
RoomHistoryVisibility.JOINED
)
.map { roomHistoryVisibility ->
BottomSheetRoomHistoryVisibilityAction(
RoomHistoryVisibilityAction(
roomHistoryVisibility = roomHistoryVisibility,
title = historyVisibilityFormatter.getSetting(roomHistoryVisibility),
iconResId = 0,

View File

@ -19,5 +19,5 @@ package im.vector.app.features.roomprofile.settings.historyvisibility
import im.vector.app.core.platform.VectorSharedActionViewModel
import javax.inject.Inject
class SetRoomHistoryVisibilitySharedActionViewModel @Inject constructor()
: VectorSharedActionViewModel<BottomSheetRoomHistoryVisibilityAction>()
class RoomHistoryVisibilitySharedActionViewModel @Inject constructor()
: VectorSharedActionViewModel<RoomHistoryVisibilityAction>()