mirror of
https://github.com/element-hq/element-android
synced 2024-11-24 18:35:40 +03:00
Improve UI and UX when permission are not editable
This commit is contained in:
parent
81bdf506bc
commit
a28dfdc48e
2 changed files with 12 additions and 6 deletions
|
@ -73,11 +73,6 @@ class RoomPermissionsController @Inject constructor(
|
|||
stringProvider.getString(R.string.room_permissions_title)
|
||||
)
|
||||
|
||||
settingsInfoItem {
|
||||
id("notice")
|
||||
helperText(stringProvider.getString(R.string.room_permissions_notice))
|
||||
}
|
||||
|
||||
when (val content = data?.currentPowerLevelsContent) {
|
||||
is Success -> buildPermissions(data, content())
|
||||
else -> {
|
||||
|
@ -90,6 +85,12 @@ class RoomPermissionsController @Inject constructor(
|
|||
}
|
||||
|
||||
private fun buildPermissions(data: RoomPermissionsViewState, content: PowerLevelsContent) {
|
||||
val editable = data.actionPermissions.canChangePowerLevels
|
||||
settingsInfoItem {
|
||||
id("notice")
|
||||
helperText(stringProvider.getString(if (editable) R.string.room_permissions_notice else R.string.room_permissions_notice_read_only))
|
||||
}
|
||||
|
||||
allEditablePermissions.forEach { editablePermission ->
|
||||
val currentRole = getCurrentRole(editablePermission, content)
|
||||
buildProfileAction(
|
||||
|
@ -99,7 +100,11 @@ class RoomPermissionsController @Inject constructor(
|
|||
dividerColor = dividerColor,
|
||||
divider = true,
|
||||
editable = data.actionPermissions.canChangePowerLevels,
|
||||
action = { callback?.onEditPermission(editablePermission, currentRole) }
|
||||
action = {
|
||||
callback
|
||||
?.takeIf { editable }
|
||||
?.onEditPermission(editablePermission, currentRole)
|
||||
}
|
||||
)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -615,6 +615,7 @@
|
|||
|
||||
<string name="room_permissions_title">"Permissions"</string>
|
||||
<string name="room_permissions_notice">"Select the roles required to change various parts of the room"</string>
|
||||
<string name="room_permissions_notice_read_only">"You don't have permission to update the roles required to change various parts of the room"</string>
|
||||
|
||||
<string name="room_permissions_default_role">Default role</string>
|
||||
<string name="room_permissions_send_messages">Send messages</string>
|
||||
|
|
Loading…
Reference in a new issue