From 4ba1a34f387bdd4d2eca54e47897245ebab5661e Mon Sep 17 00:00:00 2001 From: Benoit Marty Date: Fri, 10 Jul 2020 09:46:34 +0200 Subject: [PATCH] Hide right arrow if threepid invite can not be revoked --- .../vector/riotx/core/epoxy/profiles/ProfileMatrixItem.kt | 6 +++++- .../roomprofile/members/RoomMemberListController.kt | 1 + 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/vector/src/main/java/im/vector/riotx/core/epoxy/profiles/ProfileMatrixItem.kt b/vector/src/main/java/im/vector/riotx/core/epoxy/profiles/ProfileMatrixItem.kt index d6629c708e..b89da07984 100644 --- a/vector/src/main/java/im/vector/riotx/core/epoxy/profiles/ProfileMatrixItem.kt +++ b/vector/src/main/java/im/vector/riotx/core/epoxy/profiles/ProfileMatrixItem.kt @@ -20,6 +20,7 @@ package im.vector.riotx.core.epoxy.profiles import android.view.View import android.widget.ImageView import android.widget.TextView +import androidx.core.view.isVisible import com.airbnb.epoxy.EpoxyAttribute import com.airbnb.epoxy.EpoxyModelClass import im.vector.matrix.android.api.crypto.RoomEncryptionTrustLevel @@ -36,6 +37,7 @@ abstract class ProfileMatrixItem : VectorEpoxyModel() @EpoxyAttribute lateinit var avatarRenderer: AvatarRenderer @EpoxyAttribute lateinit var matrixItem: MatrixItem + @EpoxyAttribute var editable: Boolean = true @EpoxyAttribute var userEncryptionTrustLevel: RoomEncryptionTrustLevel? = null @EpoxyAttribute var clickListener: View.OnClickListener? = null @@ -46,9 +48,10 @@ abstract class ProfileMatrixItem : VectorEpoxyModel() .takeIf { it != bestName } // Special case for ThreePid fake matrix item .takeIf { it != "@" } - holder.view.setOnClickListener(clickListener) + holder.view.setOnClickListener(clickListener?.takeIf { editable }) holder.titleView.text = bestName holder.subtitleView.setTextOrHide(matrixId) + holder.editableView.isVisible = editable avatarRenderer.render(matrixItem, holder.avatarImageView) holder.avatarDecorationImageView.setImageResource(userEncryptionTrustLevel.toImageRes()) } @@ -58,5 +61,6 @@ abstract class ProfileMatrixItem : VectorEpoxyModel() val subtitleView by bind(R.id.matrixItemSubtitle) val avatarImageView by bind(R.id.matrixItemAvatar) val avatarDecorationImageView by bind(R.id.matrixItemAvatarDecoration) + val editableView by bind(R.id.matrixItemEditable) } } diff --git a/vector/src/main/java/im/vector/riotx/features/roomprofile/members/RoomMemberListController.kt b/vector/src/main/java/im/vector/riotx/features/roomprofile/members/RoomMemberListController.kt index 6dcf5a0bd3..495d1164a5 100644 --- a/vector/src/main/java/im/vector/riotx/features/roomprofile/members/RoomMemberListController.kt +++ b/vector/src/main/java/im/vector/riotx/features/roomprofile/members/RoomMemberListController.kt @@ -100,6 +100,7 @@ class RoomMemberListController @Inject constructor( id("3pid_$idx") matrixItem(content.toMatrixItem()) avatarRenderer(avatarRenderer) + editable(data.actionsPermissions.canRevokeThreePidInvite) clickListener { _ -> callback?.onThreePidInvites(event) }