mirror of
https://github.com/element-hq/element-android
synced 2024-11-28 13:38:49 +03:00
Fix latest small bugs
This commit is contained in:
parent
1cb91ca5df
commit
a7b72ed39d
4 changed files with 16 additions and 6 deletions
|
@ -42,6 +42,7 @@ import im.vector.app.features.home.HomeDetailViewModel
|
|||
import im.vector.app.features.home.PromoteRestrictedViewModel
|
||||
import im.vector.app.features.home.UnknownDeviceDetectorSharedViewModel
|
||||
import im.vector.app.features.home.UnreadMessagesSharedViewModel
|
||||
import im.vector.app.features.home.UserColorAccountDataViewModel
|
||||
import im.vector.app.features.home.room.breadcrumbs.BreadcrumbsViewModel
|
||||
import im.vector.app.features.home.room.detail.RoomDetailViewModel
|
||||
import im.vector.app.features.home.room.detail.composer.MessageComposerViewModel
|
||||
|
@ -412,6 +413,11 @@ interface MavericksViewModelModule {
|
|||
@MavericksViewModelKey(RoomMemberProfileViewModel::class)
|
||||
fun roomMemberProfileViewModelFactory(factory: RoomMemberProfileViewModel.Factory): MavericksAssistedViewModelFactory<*, *>
|
||||
|
||||
@Binds
|
||||
@IntoMap
|
||||
@MavericksViewModelKey(UserColorAccountDataViewModel::class)
|
||||
fun userColorAccountDataViewModelFactory(factory: UserColorAccountDataViewModel.Factory): MavericksAssistedViewModelFactory<*, *>
|
||||
|
||||
@Binds
|
||||
@IntoMap
|
||||
@MavericksViewModelKey(RoomPreviewViewModel::class)
|
||||
|
|
|
@ -28,5 +28,5 @@ sealed class RoomMemberProfileAction : VectorViewModelAction {
|
|||
object VerifyUser : RoomMemberProfileAction()
|
||||
object ShareRoomMemberProfile : RoomMemberProfileAction()
|
||||
data class SetPowerLevel(val previousValue: Int, val newValue: Int, val askForValidation: Boolean) : RoomMemberProfileAction()
|
||||
data class SetUserColorOverride(val newColor: String) : RoomMemberProfileAction()
|
||||
data class SetUserColorOverride(val newColorSpec: String) : RoomMemberProfileAction()
|
||||
}
|
||||
|
|
|
@ -179,7 +179,7 @@ class RoomMemberProfileController @Inject constructor(
|
|||
editable = false,
|
||||
title = stringProvider.getString(R.string.room_member_override_nick_color),
|
||||
subtitle = state.userColorOverride,
|
||||
divider = false,
|
||||
divider = !state.isMine,
|
||||
action = { callback?.onOverrideColorClicked() }
|
||||
)
|
||||
|
||||
|
|
|
@ -174,10 +174,14 @@ class RoomMemberProfileViewModel @AssistedInject constructor(
|
|||
}
|
||||
|
||||
private fun handleSetUserColorOverride(action: RoomMemberProfileAction.SetUserColorOverride) {
|
||||
val newOverrideColorSpecs = session.accountDataService().getUserAccountDataEvent(UserAccountDataTypes.TYPE_OVERRIDE_COLORS)
|
||||
?.content?.toMap().orEmpty().toMutableMap()
|
||||
if (matrixItemColorProvider.setOverrideColor(initialState.userId, action.newColor)) {
|
||||
newOverrideColorSpecs[initialState.userId] = action.newColor
|
||||
val newOverrideColorSpecs = session.accountDataService()
|
||||
.getUserAccountDataEvent(UserAccountDataTypes.TYPE_OVERRIDE_COLORS)
|
||||
?.content
|
||||
?.toModel<Map<String, String>>()
|
||||
.orEmpty()
|
||||
.toMutableMap()
|
||||
if (matrixItemColorProvider.setOverrideColor(initialState.userId, action.newColorSpec)) {
|
||||
newOverrideColorSpecs[initialState.userId] = action.newColorSpec
|
||||
} else {
|
||||
newOverrideColorSpecs.remove(initialState.userId)
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue