Skip to content

Commit bc76b60

Browse files
authored
remove deprecated group chat implementation (#109)
1 parent 86cf46d commit bc76b60

File tree

9 files changed

+2
-178
lines changed

9 files changed

+2
-178
lines changed

library/src/androidTest/java/org/xmtp/android/library/GroupChatTest.kt

-58
This file was deleted.

library/src/main/java/org/xmtp/android/library/Client.kt

-8
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,6 @@ import org.xmtp.android.library.messages.walletAddress
3434
import org.xmtp.proto.message.api.v1.MessageApiOuterClass
3535
import org.xmtp.proto.message.api.v1.MessageApiOuterClass.BatchQueryResponse
3636
import org.xmtp.proto.message.api.v1.MessageApiOuterClass.QueryRequest
37-
import uniffi.xmtp_dh.org.xmtp.android.library.GroupChat
3837
import java.nio.charset.StandardCharsets
3938
import java.text.SimpleDateFormat
4039
import java.time.Instant
@@ -59,8 +58,6 @@ class Client() {
5958
lateinit var apiClient: ApiClient
6059
lateinit var contacts: Contacts
6160
lateinit var conversations: Conversations
62-
var isGroupChatEnabled: Boolean = false
63-
private set
6461

6562
companion object {
6663
private const val TAG = "Client"
@@ -355,9 +352,4 @@ class Client() {
355352

356353
val keys: PrivateKeyBundleV2
357354
get() = privateKeyBundleV1.toV2()
358-
359-
fun enableGroupChat() {
360-
this.isGroupChatEnabled = true
361-
GroupChat.registerCodecs()
362-
}
363355
}

library/src/main/java/org/xmtp/android/library/Conversation.kt

-8
Original file line numberDiff line numberDiff line change
@@ -19,14 +19,6 @@ sealed class Conversation {
1919
V2
2020
}
2121

22-
val isGroup: Boolean
23-
get() {
24-
return when (this) {
25-
is V1 -> false
26-
is V2 -> conversationV2.isGroup
27-
}
28-
}
29-
3022
val version: Version
3123
get() {
3224
return when (this) {

library/src/main/java/org/xmtp/android/library/ConversationV2.kt

-3
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@ data class ConversationV2(
2828
val context: Invitation.InvitationV1.Context,
2929
val peerAddress: String,
3030
val client: Client,
31-
val isGroup: Boolean = false,
3231
private val header: SealedInvitationHeaderV1,
3332
) {
3433

@@ -37,7 +36,6 @@ data class ConversationV2(
3736
client: Client,
3837
invitation: Invitation.InvitationV1,
3938
header: SealedInvitationHeaderV1,
40-
isGroup: Boolean = false,
4139
): ConversationV2 {
4240
val myKeys = client.keys.getPublicKeyBundle()
4341
val peer =
@@ -51,7 +49,6 @@ data class ConversationV2(
5149
peerAddress = peerAddress,
5250
client = client,
5351
header = header,
54-
isGroup = isGroup
5552
)
5653
}
5754
}

library/src/main/java/org/xmtp/android/library/Conversations.kt

+1-25
Original file line numberDiff line numberDiff line change
@@ -169,13 +169,6 @@ data class Conversations(
169169
Log.d(TAG, e.message.toString())
170170
}
171171
}
172-
for (sealedInvitation in listGroupInvitations()) {
173-
try {
174-
newConversations.add(Conversation.V2(conversation(sealedInvitation, true)))
175-
} catch (e: Exception) {
176-
Log.d(TAG, e.message.toString())
177-
}
178-
}
179172

180173
conversationsByTopic += newConversations.filter { it.peerAddress != client.address }
181174
.map { Pair(it.topic, it) }
@@ -203,7 +196,6 @@ data class Conversations(
203196
context = data.invitation.context,
204197
peerAddress = data.peerAddress,
205198
client = client,
206-
isGroup = false,
207199
header = Invitation.SealedInvitationHeaderV1.getDefaultInstance()
208200
)
209201
)
@@ -259,28 +251,12 @@ data class Conversations(
259251
}
260252
}
261253

262-
private fun listGroupInvitations(): List<SealedInvitation> {
263-
if (!client.isGroupChatEnabled) {
264-
return listOf()
265-
}
266-
val envelopes = runBlocking {
267-
client.apiClient.envelopes(
268-
topic = Topic.groupInvite(client.address).description,
269-
pagination = null
270-
)
271-
}
272-
return envelopes.map { envelope ->
273-
SealedInvitation.parseFrom(envelope.message)
274-
}
275-
}
276-
277-
fun conversation(sealedInvitation: SealedInvitation, isGroup: Boolean = false): ConversationV2 {
254+
fun conversation(sealedInvitation: SealedInvitation): ConversationV2 {
278255
val unsealed = sealedInvitation.v1.getInvitation(viewer = client.keys)
279256
return ConversationV2.create(
280257
client = client,
281258
invitation = unsealed,
282259
header = sealedInvitation.v1.header,
283-
isGroup = isGroup
284260
)
285261
}
286262

library/src/main/java/org/xmtp/android/library/GroupChat.kt

-14
This file was deleted.

library/src/main/java/org/xmtp/android/library/codecs/GroupChatMemberAddedCodec.kt

-31
This file was deleted.

library/src/main/java/org/xmtp/android/library/codecs/GroupChatTitleChangedCodec.kt

-31
This file was deleted.

library/src/main/java/org/xmtp/android/library/codecs/README.md

+1
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ When you build an app with XMTP, all messages are encoded with a [content type](
99
- `RemoteAttachmentCodec`: Enables sending remote attachments.
1010
- `ReactionCodec`: Enables sending of reactions.
1111
- `ReplyCodec`: Enables sending of replies.
12+
- `ReadReceiptCodec`: Enables read receipts.
1213

1314

1415
## Support remote media attachments

0 commit comments

Comments
 (0)