Skip to content

Commit

Permalink
undo all the bad merge items
Browse files Browse the repository at this point in the history
  • Loading branch information
nplasterer committed Feb 1, 2024
1 parent 9b5d62d commit fc86eed
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import androidx.lifecycle.repeatOnLifecycle
import com.google.android.material.bottomsheet.BottomSheetDialogFragment
import kotlinx.coroutines.launch
import org.xmtp.android.example.R
import org.xmtp.android.example.databinding.BottomSheetNewConversationBinding
import org.xmtp.android.example.databinding.BottomSheetNewGroupBinding
import java.util.regex.Pattern

Expand Down
25 changes: 12 additions & 13 deletions library/src/main/java/org/xmtp/android/library/Conversations.kt
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import kotlinx.coroutines.flow.MutableStateFlow
import kotlinx.coroutines.flow.flow
import kotlinx.coroutines.launch
import kotlinx.coroutines.runBlocking
import org.xmtp.android.library.Conversation.*
import org.xmtp.android.library.GRPCApiClient.Companion.makeQueryRequest
import org.xmtp.android.library.GRPCApiClient.Companion.makeSubscribeRequest
import org.xmtp.android.library.messages.DecryptedMessage
Expand Down Expand Up @@ -61,7 +60,7 @@ data class Conversations(
fun fromInvite(envelope: Envelope): Conversation {
val sealedInvitation = Invitation.SealedInvitation.parseFrom(envelope.message)
val unsealed = sealedInvitation.v1.getInvitation(viewer = client.keys)
return V2(
return Conversation.V2(
ConversationV2.create(
client = client,
invitation = unsealed,
Expand All @@ -81,7 +80,7 @@ data class Conversations(
val senderAddress = messageV1.header.sender.walletAddress
val recipientAddress = messageV1.header.recipient.walletAddress
val peerAddress = if (client.address == senderAddress) recipientAddress else senderAddress
return V1(
return Conversation.V1(
ConversationV1(
client = client,
peerAddress = peerAddress,
Expand Down Expand Up @@ -154,7 +153,7 @@ data class Conversations(
val invitationPeers = listIntroductionPeers()
val peerSeenAt = invitationPeers[peerAddress]
if (peerSeenAt != null) {
val conversation = V1(
val conversation = Conversation.V1(
ConversationV1(
client = client,
peerAddress = peerAddress,
Expand All @@ -168,7 +167,7 @@ data class Conversations(

// If the contact is v1, start a v1 conversation
if (Contact.ContactBundle.VersionCase.V1 == contact.versionCase && context?.conversationId.isNullOrEmpty()) {
val conversation = V1(
val conversation = Conversation.V1(
ConversationV1(
client = client,
peerAddress = peerAddress,
Expand All @@ -185,7 +184,7 @@ data class Conversations(
}
val invite = sealedInvitation.v1.getInvitation(viewer = client.keys)
if (invite.context.conversationId == context?.conversationId && invite.context.conversationId != "") {
val conversation = V2(
val conversation = Conversation.V2(
ConversationV2(
topic = invite.topic,
keyMaterial = invite.aes256GcmHkdfSha256.keyMaterial.toByteArray(),
Expand All @@ -211,7 +210,7 @@ data class Conversations(
header = sealedInvitation.v1.header,
)
client.contacts.allow(addresses = listOf(peerAddress))
val conversation = V2(conversationV2)
val conversation = Conversation.V2(conversationV2)
conversationsByTopic[conversation.topic] = conversation
return conversation
}
Expand All @@ -227,7 +226,7 @@ data class Conversations(
val seenPeers = listIntroductionPeers(pagination = pagination)
for ((peerAddress, sentAt) in seenPeers) {
newConversations.add(
V1(
Conversation.V1(
ConversationV1(
client = client,
peerAddress = peerAddress,
Expand All @@ -239,7 +238,7 @@ data class Conversations(
val invitations = listInvitations(pagination = pagination)
for (sealedInvitation in invitations) {
try {
newConversations.add(V2(conversation(sealedInvitation)))
newConversations.add(Conversation.V2(conversation(sealedInvitation)))
} catch (e: Exception) {
Log.d(TAG, e.message.toString())
}
Expand All @@ -254,7 +253,7 @@ data class Conversations(
syncGroups()
listGroups()
}
conversationsByTopic += groups.map { Pair(it.id.toString(), Group(it)) }
conversationsByTopic += groups.map { Pair(it.id.toString(), Conversation.Group(it)) }
}
return conversationsByTopic.values.sortedByDescending { it.createdAt }
}
Expand All @@ -263,15 +262,15 @@ data class Conversations(
val conversation: Conversation
if (!data.hasInvitation()) {
val sentAt = Date(data.createdNs / 1_000_000)
conversation = V1(
conversation = Conversation.V1(
ConversationV1(
client,
data.peerAddress,
sentAt,
),
)
} else {
conversation = V2(
conversation = Conversation.V2(
ConversationV2(
topic = data.invitation.topic,
keyMaterial = data.invitation.aes256GcmHkdfSha256.keyMaterial.toByteArray(),
Expand Down Expand Up @@ -482,7 +481,7 @@ data class Conversations(
coroutineScope {
launch {
groupEmitter.groups.collect { group ->
emit(Group(Group(client, group)))
emit(Conversation.Group(Group(client, group)))
}
}
}
Expand Down
Binary file modified library/src/main/jniLibs/arm64-v8a/libuniffi_xmtpv3.so
Binary file not shown.

0 comments on commit fc86eed

Please sign in to comment.