diff --git a/example/src/main/java/org/xmtp/android/example/message/MessageViewHolder.kt b/example/src/main/java/org/xmtp/android/example/message/MessageViewHolder.kt index d88bfbecb..4e6190c9a 100644 --- a/example/src/main/java/org/xmtp/android/example/message/MessageViewHolder.kt +++ b/example/src/main/java/org/xmtp/android/example/message/MessageViewHolder.kt @@ -11,8 +11,9 @@ import org.xmtp.android.example.R import org.xmtp.android.example.conversation.ConversationDetailViewModel import org.xmtp.android.example.databinding.ListItemMessageBinding import org.xmtp.android.example.extension.margins -import org.xmtp.proto.mls.message.contents.TranscriptMessages import uniffi.xmtpv3.org.xmtp.android.library.codecs.GroupMembershipChanges +import java.text.SimpleDateFormat +import java.util.Locale class MessageViewHolder( private val binding: ListItemMessageBinding, @@ -45,6 +46,9 @@ class MessageViewHolder( binding.messageContainer.layoutParams = params if (item.message.content() is String) { binding.messageBody.text = item.message.body + val sdf = SimpleDateFormat("yyyy-MM-dd HH:mm:ss", Locale.getDefault()) + binding.messageDate.text = sdf.format(item.message.sent) + } else if (item.message.content() is GroupMembershipChanges) { val changes = item.message.content() as? GroupMembershipChanges binding.messageBody.text = diff --git a/example/src/main/res/layout/list_item_message.xml b/example/src/main/res/layout/list_item_message.xml index d53ae94cd..690a1a126 100644 --- a/example/src/main/res/layout/list_item_message.xml +++ b/example/src/main/res/layout/list_item_message.xml @@ -15,13 +15,25 @@ app:cardCornerRadius="8dp" app:layout_constraintTop_toTopOf="parent" tools:ignore="MissingConstraints"> - - + android:layout_height="wrap_content"> + + + + + diff --git a/library/src/androidTest/java/org/xmtp/android/library/GroupTest.kt b/library/src/androidTest/java/org/xmtp/android/library/GroupTest.kt index 7c5167363..3f13423cd 100644 --- a/library/src/androidTest/java/org/xmtp/android/library/GroupTest.kt +++ b/library/src/androidTest/java/org/xmtp/android/library/GroupTest.kt @@ -112,6 +112,26 @@ class GroupTest { ) } + @Test + fun testCanRemoveGroupMembersWhenNotCreator() { + boClient.conversations.newGroup( + listOf( + alix.walletAddress, + caro.walletAddress + ) + ) + runBlocking { alixClient.conversations.syncGroups() } + val group = alixClient.conversations.listGroups().first() + group.removeMembers(listOf(caro.walletAddress)) + assertEquals( + group.memberAddresses().sorted(), + listOf( + alix.walletAddress.lowercase(), + bo.walletAddress.lowercase() + ).sorted() + ) + } + @Test fun testIsActiveReturnsCorrectly() { val group = boClient.conversations.newGroup(