Room history visibility: from ugly dialog to nice bottom sheet.

Including a reusable bottom sheet pattern, for future join rules setting bottom sheet
This commit is contained in:
Benoit Marty 2020-11-26 19:03:49 +01:00 committed by Benoit Marty
parent bb5d5ffc92
commit 4171311095
15 changed files with 477 additions and 34 deletions

View File

@ -68,6 +68,7 @@ import im.vector.app.features.roommemberprofile.RoomMemberProfileActivity
import im.vector.app.features.roommemberprofile.devices.DeviceListBottomSheet
import im.vector.app.features.roomprofile.RoomProfileActivity
import im.vector.app.features.roomprofile.alias.detail.RoomAliasBottomSheet
import im.vector.app.features.roomprofile.settings.historyvisibility.RoomHistoryVisibilityBottomSheet
import im.vector.app.features.settings.VectorSettingsActivity
import im.vector.app.features.settings.devices.DeviceVerificationInfoBottomSheet
import im.vector.app.features.share.IncomingShareActivity
@ -155,6 +156,7 @@ interface ScreenComponent {
fun inject(bottomSheet: DisplayReadReceiptsBottomSheet)
fun inject(bottomSheet: RoomListQuickActionsBottomSheet)
fun inject(bottomSheet: RoomAliasBottomSheet)
fun inject(bottomSheet: RoomHistoryVisibilityBottomSheet)
fun inject(bottomSheet: VerificationBottomSheet)
fun inject(bottomSheet: DeviceVerificationInfoBottomSheet)
fun inject(bottomSheet: DeviceListBottomSheet)

View File

@ -36,6 +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.userdirectory.UserListSharedActionViewModel
@Module
@ -111,6 +112,11 @@ interface ViewModelModule {
@ViewModelKey(RoomAliasBottomSheetSharedActionViewModel::class)
fun bindRoomAliasBottomSheetSharedActionViewModel(viewModel: RoomAliasBottomSheetSharedActionViewModel): ViewModel
@Binds
@IntoMap
@ViewModelKey(SetRoomHistoryVisibilitySharedActionViewModel::class)
fun bindSetRoomHistoryVisibilitySharedActionViewModel(viewModel: SetRoomHistoryVisibilitySharedActionViewModel): ViewModel
@Binds
@IntoMap
@ViewModelKey(RoomDirectorySharedActionViewModel::class)

View File

@ -0,0 +1,61 @@
/*
* Copyright 2019 New Vector Ltd
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package im.vector.app.core.ui.bottomsheet
import android.os.Bundle
import android.view.View
import androidx.annotation.CallSuper
import androidx.recyclerview.widget.RecyclerView
import butterknife.BindView
import im.vector.app.R
import im.vector.app.core.extensions.cleanup
import im.vector.app.core.extensions.configureWith
import im.vector.app.core.platform.VectorBaseBottomSheetDialogFragment
import javax.inject.Inject
/**
* Generic Bottom sheet with actions
*/
abstract class BottomSheetGeneric<STATE : BottomSheetGenericState, ACTION : BottomSheetGenericAction> :
VectorBaseBottomSheetDialogFragment(),
BottomSheetGenericController.Listener<ACTION> {
@Inject lateinit var sharedViewPool: RecyclerView.RecycledViewPool
@BindView(R.id.bottomSheetRecyclerView)
lateinit var recyclerView: RecyclerView
final override val showExpanded = true
final override fun getLayoutResId() = R.layout.bottom_sheet_generic_list
abstract fun getController(): BottomSheetGenericController<STATE, ACTION>
@CallSuper
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
super.onViewCreated(view, savedInstanceState)
recyclerView.configureWith(getController(), viewPool = sharedViewPool, hasFixedSize = false, disableItemAnimation = true)
getController().listener = this
}
@CallSuper
override fun onDestroyView() {
recyclerView.cleanup()
getController().listener = null
super.onDestroyView()
}
}

View File

@ -0,0 +1,43 @@
/*
* Copyright (c) 2020 New Vector Ltd
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package im.vector.app.core.ui.bottomsheet
import androidx.annotation.DrawableRes
import androidx.annotation.StringRes
import im.vector.app.core.epoxy.bottomsheet.BottomSheetActionItem_
import im.vector.app.core.platform.VectorSharedAction
/**
* Parent class for a bottom sheet action
*/
open class BottomSheetGenericAction(
@StringRes open val titleRes: Int,
@DrawableRes open val iconResId: Int,
open val isSelected: Boolean,
open val destructive: Boolean
) : VectorSharedAction {
fun toBottomSheetItem(): BottomSheetActionItem_ {
return BottomSheetActionItem_().apply {
id("action_$titleRes")
iconRes(iconResId)
textRes(titleRes)
selected(isSelected)
destructive(destructive)
}
}
}

View File

@ -0,0 +1,43 @@
/*
* Copyright 2019 New Vector Ltd
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package im.vector.app.core.ui.bottomsheet
import android.view.View
import com.airbnb.epoxy.TypedEpoxyController
/**
* Epoxy controller for generic bottom sheet actions
*/
abstract class BottomSheetGenericController<State : BottomSheetGenericState, Action: BottomSheetGenericAction>
: TypedEpoxyController<State>() {
var listener: Listener<Action>? = null
abstract fun getActions(state: State): List<Action>
override fun buildModels(state: State?) {
state ?: return
getActions(state).forEach { action ->
action.toBottomSheetItem()
.listener(View.OnClickListener { listener?.didSelectAction(action) })
.addTo(this)
}
}
interface Listener<Action> {
fun didSelectAction(action: Action)
}
}

View File

@ -0,0 +1,25 @@
/*
* Copyright 2019 New Vector Ltd
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
package im.vector.app.core.ui.bottomsheet
import im.vector.app.core.platform.VectorSharedAction
import im.vector.app.core.platform.VectorSharedActionViewModel
/**
* Activity shared view model to handle bottom sheet quick actions
*/
abstract class BottomSheetGenericSharedActionViewModel<Action : VectorSharedAction> : VectorSharedActionViewModel<Action>()

View File

@ -0,0 +1,21 @@
/*
* Copyright 2019 New Vector Ltd
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package im.vector.app.core.ui.bottomsheet
import com.airbnb.mvrx.MvRxState
abstract class BottomSheetGenericState : MvRxState

View File

@ -16,6 +16,7 @@
package im.vector.app.features.home.room.detail.timeline.format
import androidx.annotation.StringRes
import im.vector.app.R
import im.vector.app.core.resources.StringProvider
import org.matrix.android.sdk.api.session.room.model.RoomHistoryVisibility
@ -26,11 +27,16 @@ class RoomHistoryVisibilityFormatter @Inject constructor(
) {
fun format(roomHistoryVisibility: RoomHistoryVisibility): String {
return stringProvider.getString(getStringResId(roomHistoryVisibility))
}
@StringRes
fun getStringResId(roomHistoryVisibility: RoomHistoryVisibility): Int {
return when (roomHistoryVisibility) {
RoomHistoryVisibility.SHARED -> stringProvider.getString(R.string.notice_room_visibility_shared)
RoomHistoryVisibility.INVITED -> stringProvider.getString(R.string.notice_room_visibility_invited)
RoomHistoryVisibility.JOINED -> stringProvider.getString(R.string.notice_room_visibility_joined)
RoomHistoryVisibility.WORLD_READABLE -> stringProvider.getString(R.string.notice_room_visibility_world_readable)
RoomHistoryVisibility.SHARED -> R.string.notice_room_visibility_shared
RoomHistoryVisibility.INVITED -> R.string.notice_room_visibility_invited
RoomHistoryVisibility.JOINED -> R.string.notice_room_visibility_joined
RoomHistoryVisibility.WORLD_READABLE -> R.string.notice_room_visibility_world_readable
}
}
}

View File

@ -37,15 +37,13 @@ import im.vector.app.core.platform.VectorBaseFragment
import im.vector.app.core.resources.ColorProvider
import im.vector.app.core.utils.toast
import im.vector.app.features.home.AvatarRenderer
import im.vector.app.features.home.room.detail.timeline.format.RoomHistoryVisibilityFormatter
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.RoomHistoryVisibilityBottomSheet
import kotlinx.android.synthetic.main.fragment_room_setting_generic.*
import kotlinx.android.synthetic.main.merge_overlay_waiting_view.*
import org.matrix.android.sdk.api.session.events.model.toModel
import org.matrix.android.sdk.api.session.room.model.RoomHistoryVisibility
import org.matrix.android.sdk.api.session.room.model.RoomHistoryVisibilityContent
import org.matrix.android.sdk.api.util.toMatrixItem
import java.util.UUID
import javax.inject.Inject
@ -53,7 +51,6 @@ import javax.inject.Inject
class RoomSettingsFragment @Inject constructor(
val viewModelFactory: RoomSettingsViewModel.Factory,
private val controller: RoomSettingsController,
private val roomHistoryVisibilityFormatter: RoomHistoryVisibilityFormatter,
colorProvider: ColorProvider,
private val avatarRenderer: AvatarRenderer
) :
@ -64,6 +61,7 @@ class RoomSettingsFragment @Inject constructor(
private val viewModel: RoomSettingsViewModel by fragmentViewModel()
private lateinit var roomProfileSharedActionViewModel: RoomProfileSharedActionViewModel
private lateinit var sharedActionViewModel: SetRoomHistoryVisibilitySharedActionViewModel
private val roomProfileArgs: RoomProfileArgs by args()
private val galleryOrCameraDialogHelper = GalleryOrCameraDialogHelper(this, colorProvider)
@ -74,6 +72,7 @@ class RoomSettingsFragment @Inject constructor(
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
super.onViewCreated(view, savedInstanceState)
roomProfileSharedActionViewModel = activityViewModelProvider.get(RoomProfileSharedActionViewModel::class.java)
setupRoomHistoryVisibilitySharedViewModel()
controller.callback = this
setupToolbar(roomSettingsToolbar)
roomSettingsRecyclerView.configureWith(controller, hasFixedSize = true)
@ -92,6 +91,16 @@ class RoomSettingsFragment @Inject constructor(
}
}
private fun setupRoomHistoryVisibilitySharedViewModel() {
sharedActionViewModel = activityViewModelProvider.get(SetRoomHistoryVisibilitySharedActionViewModel::class.java)
sharedActionViewModel
.observe()
.subscribe { action ->
viewModel.handle(RoomSettingsAction.SetRoomHistoryVisibility(action.roomHistoryVisibility))
}
.disposeOnDestroyView()
}
private fun showSuccess() {
activity?.toast(R.string.room_settings_save_success)
}
@ -141,30 +150,9 @@ class RoomSettingsFragment @Inject constructor(
}
override fun onHistoryVisibilityClicked() = withState(viewModel) { state ->
val historyVisibilities = arrayOf(
RoomHistoryVisibility.SHARED,
RoomHistoryVisibility.INVITED,
RoomHistoryVisibility.JOINED,
RoomHistoryVisibility.WORLD_READABLE
)
val currentHistoryVisibility = state.newHistoryVisibility ?: state.currentHistoryVisibility
val currentHistoryVisibilityIndex = historyVisibilities.indexOf(currentHistoryVisibility)
AlertDialog.Builder(requireContext()).apply {
setTitle(R.string.room_settings_room_read_history_rules_pref_title)
setSingleChoiceItems(
historyVisibilities
.map { roomHistoryVisibilityFormatter.format(it) }
.toTypedArray(),
currentHistoryVisibilityIndex) { dialog, which ->
if (which != currentHistoryVisibilityIndex) {
viewModel.handle(RoomSettingsAction.SetRoomHistoryVisibility(historyVisibilities[which]))
}
dialog.cancel()
}
show()
}
return@withState
RoomHistoryVisibilityBottomSheet.newInstance(currentHistoryVisibility)
.show(childFragmentManager, "RoomHistoryVisibilityBottomSheet")
}
override fun onRoomAliasesClicked() {
@ -185,10 +173,10 @@ class RoomSettingsFragment @Inject constructor(
override fun onAvatarDelete() {
withState(viewModel) {
when (it.avatarAction) {
RoomSettingsViewState.AvatarAction.None -> {
RoomSettingsViewState.AvatarAction.None -> {
viewModel.handle(RoomSettingsAction.SetAvatarAction(RoomSettingsViewState.AvatarAction.DeleteAvatar))
}
RoomSettingsViewState.AvatarAction.DeleteAvatar -> {
RoomSettingsViewState.AvatarAction.DeleteAvatar -> {
/* Should not happen */
Unit
}

View File

@ -0,0 +1,35 @@
/*
* Copyright (c) 2020 New Vector Ltd
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package im.vector.app.features.roomprofile.settings.historyvisibility
import androidx.annotation.DrawableRes
import androidx.annotation.StringRes
import im.vector.app.core.ui.bottomsheet.BottomSheetGenericAction
import org.matrix.android.sdk.api.session.room.model.RoomHistoryVisibility
class BottomSheetRoomHistoryVisibilityAction(
val roomHistoryVisibility: RoomHistoryVisibility,
@StringRes titleRes: Int,
@DrawableRes iconResId: Int,
isSelected: Boolean,
destructive: Boolean
) : BottomSheetGenericAction(
titleRes = titleRes,
iconResId = iconResId,
isSelected = isSelected,
destructive = destructive
)

View File

@ -0,0 +1,71 @@
/*
* Copyright (c) 2020 New Vector Ltd
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package im.vector.app.features.roomprofile.settings.historyvisibility
import android.os.Bundle
import android.os.Parcelable
import android.view.View
import com.airbnb.mvrx.fragmentViewModel
import com.airbnb.mvrx.withState
import im.vector.app.core.di.ScreenComponent
import im.vector.app.core.ui.bottomsheet.BottomSheetGeneric
import im.vector.app.core.ui.bottomsheet.BottomSheetGenericController
import kotlinx.android.parcel.Parcelize
import org.matrix.android.sdk.api.session.room.model.RoomHistoryVisibility
import javax.inject.Inject
@Parcelize
data class RoomHistoryVisibilityBottomSheetArgs(
val currentRoomHistoryVisibility: RoomHistoryVisibility
) : Parcelable
class RoomHistoryVisibilityBottomSheet : BottomSheetGeneric<RoomHistoryVisibilityState, BottomSheetRoomHistoryVisibilityAction>() {
private lateinit var roomHistoryVisibilitySharedActionViewModel: SetRoomHistoryVisibilitySharedActionViewModel
@Inject lateinit var controller: RoomHistoryVisibilityController
@Inject lateinit var roomHistoryVisibilityViewModelFactory: RoomHistoryVisibilityViewModel.Factory
private val viewModel: RoomHistoryVisibilityViewModel by fragmentViewModel(RoomHistoryVisibilityViewModel::class)
override fun injectWith(injector: ScreenComponent) {
injector.inject(this)
}
override fun getController(): BottomSheetGenericController<RoomHistoryVisibilityState, BottomSheetRoomHistoryVisibilityAction> = controller
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
super.onViewCreated(view, savedInstanceState)
roomHistoryVisibilitySharedActionViewModel = activityViewModelProvider.get(SetRoomHistoryVisibilitySharedActionViewModel::class.java)
}
override fun didSelectAction(action: BottomSheetRoomHistoryVisibilityAction) {
roomHistoryVisibilitySharedActionViewModel.post(action)
dismiss()
}
override fun invalidate() = withState(viewModel) {
controller.setData(it)
super.invalidate()
}
companion object {
fun newInstance(currentRoomHistoryVisibility: RoomHistoryVisibility): RoomHistoryVisibilityBottomSheet {
return RoomHistoryVisibilityBottomSheet().apply {
setArguments(RoomHistoryVisibilityBottomSheetArgs(currentRoomHistoryVisibility))
}
}
}
}

View File

@ -0,0 +1,45 @@
/*
* Copyright (c) 2020 New Vector Ltd
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package im.vector.app.features.roomprofile.settings.historyvisibility
import im.vector.app.core.ui.bottomsheet.BottomSheetGenericController
import im.vector.app.features.home.room.detail.timeline.format.RoomHistoryVisibilityFormatter
import org.matrix.android.sdk.api.session.room.model.RoomHistoryVisibility
import javax.inject.Inject
class RoomHistoryVisibilityController @Inject constructor(
private val historyVisibilityFormatter: RoomHistoryVisibilityFormatter
) : BottomSheetGenericController<RoomHistoryVisibilityState, BottomSheetRoomHistoryVisibilityAction>() {
override fun getActions(state: RoomHistoryVisibilityState): List<BottomSheetRoomHistoryVisibilityAction> {
return listOf(
RoomHistoryVisibility.SHARED,
RoomHistoryVisibility.INVITED,
RoomHistoryVisibility.JOINED,
RoomHistoryVisibility.WORLD_READABLE
)
.map { roomHistoryVisibility ->
BottomSheetRoomHistoryVisibilityAction(
roomHistoryVisibility = roomHistoryVisibility,
titleRes = historyVisibilityFormatter.getStringResId(roomHistoryVisibility),
iconResId = 0,
isSelected = roomHistoryVisibility == state.currentRoomHistoryVisibility,
destructive = false
)
}
}
}

View File

@ -0,0 +1,27 @@
/*
* Copyright (c) 2020 New Vector Ltd
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package im.vector.app.features.roomprofile.settings.historyvisibility
import im.vector.app.core.ui.bottomsheet.BottomSheetGenericState
import org.matrix.android.sdk.api.session.room.model.RoomHistoryVisibility
data class RoomHistoryVisibilityState(
val currentRoomHistoryVisibility: RoomHistoryVisibility = RoomHistoryVisibility.SHARED
) : BottomSheetGenericState() {
constructor(args: RoomHistoryVisibilityBottomSheetArgs) : this(currentRoomHistoryVisibility = args.currentRoomHistoryVisibility)
}

View File

@ -0,0 +1,47 @@
/*
* Copyright (c) 2020 New Vector Ltd
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package im.vector.app.features.roomprofile.settings.historyvisibility
import com.airbnb.mvrx.FragmentViewModelContext
import com.airbnb.mvrx.MvRxViewModelFactory
import com.airbnb.mvrx.ViewModelContext
import com.squareup.inject.assisted.Assisted
import com.squareup.inject.assisted.AssistedInject
import im.vector.app.core.platform.EmptyAction
import im.vector.app.core.platform.EmptyViewEvents
import im.vector.app.core.platform.VectorViewModel
class RoomHistoryVisibilityViewModel @AssistedInject constructor(@Assisted initialState: RoomHistoryVisibilityState)
: VectorViewModel<RoomHistoryVisibilityState, EmptyAction, EmptyViewEvents>(initialState) {
@AssistedInject.Factory
interface Factory {
fun create(initialState: RoomHistoryVisibilityState): RoomHistoryVisibilityViewModel
}
companion object : MvRxViewModelFactory<RoomHistoryVisibilityViewModel, RoomHistoryVisibilityState> {
@JvmStatic
override fun create(viewModelContext: ViewModelContext, state: RoomHistoryVisibilityState): RoomHistoryVisibilityViewModel? {
val fragment: RoomHistoryVisibilityBottomSheet = (viewModelContext as FragmentViewModelContext).fragment()
return fragment.roomHistoryVisibilityViewModelFactory.create(state)
}
}
override fun handle(action: EmptyAction) {
// No op
}
}

View File

@ -0,0 +1,23 @@
/*
* Copyright 2019 New Vector Ltd
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
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>()