Skip to content

Commit

Permalink
remove deprecated group chat implementation (#109)
Browse files Browse the repository at this point in the history
  • Loading branch information
nplasterer authored Aug 22, 2023
1 parent 86cf46d commit bc76b60
Show file tree
Hide file tree
Showing 9 changed files with 2 additions and 178 deletions.

This file was deleted.

8 changes: 0 additions & 8 deletions library/src/main/java/org/xmtp/android/library/Client.kt
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ import org.xmtp.android.library.messages.walletAddress
import org.xmtp.proto.message.api.v1.MessageApiOuterClass
import org.xmtp.proto.message.api.v1.MessageApiOuterClass.BatchQueryResponse
import org.xmtp.proto.message.api.v1.MessageApiOuterClass.QueryRequest
import uniffi.xmtp_dh.org.xmtp.android.library.GroupChat
import java.nio.charset.StandardCharsets
import java.text.SimpleDateFormat
import java.time.Instant
Expand All @@ -59,8 +58,6 @@ class Client() {
lateinit var apiClient: ApiClient
lateinit var contacts: Contacts
lateinit var conversations: Conversations
var isGroupChatEnabled: Boolean = false
private set

companion object {
private const val TAG = "Client"
Expand Down Expand Up @@ -355,9 +352,4 @@ class Client() {

val keys: PrivateKeyBundleV2
get() = privateKeyBundleV1.toV2()

fun enableGroupChat() {
this.isGroupChatEnabled = true
GroupChat.registerCodecs()
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,6 @@ sealed class Conversation {
V2
}

val isGroup: Boolean
get() {
return when (this) {
is V1 -> false
is V2 -> conversationV2.isGroup
}
}

val version: Version
get() {
return when (this) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ data class ConversationV2(
val context: Invitation.InvitationV1.Context,
val peerAddress: String,
val client: Client,
val isGroup: Boolean = false,
private val header: SealedInvitationHeaderV1,
) {

Expand All @@ -37,7 +36,6 @@ data class ConversationV2(
client: Client,
invitation: Invitation.InvitationV1,
header: SealedInvitationHeaderV1,
isGroup: Boolean = false,
): ConversationV2 {
val myKeys = client.keys.getPublicKeyBundle()
val peer =
Expand All @@ -51,7 +49,6 @@ data class ConversationV2(
peerAddress = peerAddress,
client = client,
header = header,
isGroup = isGroup
)
}
}
Expand Down
26 changes: 1 addition & 25 deletions library/src/main/java/org/xmtp/android/library/Conversations.kt
Original file line number Diff line number Diff line change
Expand Up @@ -169,13 +169,6 @@ data class Conversations(
Log.d(TAG, e.message.toString())
}
}
for (sealedInvitation in listGroupInvitations()) {
try {
newConversations.add(Conversation.V2(conversation(sealedInvitation, true)))
} catch (e: Exception) {
Log.d(TAG, e.message.toString())
}
}

conversationsByTopic += newConversations.filter { it.peerAddress != client.address }
.map { Pair(it.topic, it) }
Expand Down Expand Up @@ -203,7 +196,6 @@ data class Conversations(
context = data.invitation.context,
peerAddress = data.peerAddress,
client = client,
isGroup = false,
header = Invitation.SealedInvitationHeaderV1.getDefaultInstance()
)
)
Expand Down Expand Up @@ -259,28 +251,12 @@ data class Conversations(
}
}

private fun listGroupInvitations(): List<SealedInvitation> {
if (!client.isGroupChatEnabled) {
return listOf()
}
val envelopes = runBlocking {
client.apiClient.envelopes(
topic = Topic.groupInvite(client.address).description,
pagination = null
)
}
return envelopes.map { envelope ->
SealedInvitation.parseFrom(envelope.message)
}
}

fun conversation(sealedInvitation: SealedInvitation, isGroup: Boolean = false): ConversationV2 {
fun conversation(sealedInvitation: SealedInvitation): ConversationV2 {
val unsealed = sealedInvitation.v1.getInvitation(viewer = client.keys)
return ConversationV2.create(
client = client,
invitation = unsealed,
header = sealedInvitation.v1.header,
isGroup = isGroup
)
}

Expand Down
14 changes: 0 additions & 14 deletions library/src/main/java/org/xmtp/android/library/GroupChat.kt

This file was deleted.

This file was deleted.

This file was deleted.

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


## Support remote media attachments
Expand Down

0 comments on commit bc76b60

Please sign in to comment.