Hide set admin button when adding a new participant to an existing chat room, must be added first before being set as admin
This commit is contained in:
parent
136ab1e11c
commit
20afd5bdeb
4 changed files with 9 additions and 3 deletions
|
@ -26,5 +26,7 @@ data class GroupChatRoomMember(
|
|||
val address: Address,
|
||||
var isAdmin: Boolean = false,
|
||||
val securityLevel: ChatRoomSecurityLevel = ChatRoomSecurityLevel.ClearText,
|
||||
val hasLimeX3DHCapability: Boolean = false
|
||||
val hasLimeX3DHCapability: Boolean = false,
|
||||
// A participant not yet added to a group can't be set admin at the same time it's added
|
||||
val canBeSetAdmin: Boolean = false
|
||||
)
|
||||
|
|
|
@ -35,9 +35,13 @@ class GroupInfoParticipantData(private val participant: GroupChatRoomMember) : G
|
|||
|
||||
val showAdminControls = MutableLiveData<Boolean>()
|
||||
|
||||
// A participant not yet added to a group can't be set admin at the same time it's added
|
||||
val canBeSetAdmin = MutableLiveData<Boolean>()
|
||||
|
||||
init {
|
||||
isAdmin.value = participant.isAdmin
|
||||
showAdminControls.value = false
|
||||
canBeSetAdmin.value = participant.canBeSetAdmin
|
||||
}
|
||||
|
||||
fun setAdmin() {
|
||||
|
|
|
@ -206,7 +206,7 @@ class GroupInfoViewModel(val chatRoom: ChatRoom?) : ErrorReportingViewModel() {
|
|||
|
||||
if (chatRoom != null) {
|
||||
for (participant in chatRoom.participants) {
|
||||
list.add(GroupChatRoomMember(participant.address, participant.isAdmin, participant.securityLevel))
|
||||
list.add(GroupChatRoomMember(participant.address, participant.isAdmin, participant.securityLevel, canBeSetAdmin = true))
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -47,7 +47,7 @@
|
|||
android:src="@drawable/chat_group_delete" />
|
||||
|
||||
<LinearLayout
|
||||
android:visibility="@{data.showAdminControls ? View.VISIBLE : View.GONE}"
|
||||
android:visibility="@{data.showAdminControls && data.canBeSetAdmin ? View.VISIBLE : View.GONE}"
|
||||
android:id="@+id/adminLayout"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
|
|
Loading…
Reference in a new issue