@@ -9,7 +9,6 @@ import kotlinx.coroutines.flow.MutableStateFlow
9
9
import kotlinx.coroutines.flow.flow
10
10
import kotlinx.coroutines.launch
11
11
import kotlinx.coroutines.runBlocking
12
- import org.xmtp.android.library.Conversation.*
13
12
import org.xmtp.android.library.GRPCApiClient.Companion.makeQueryRequest
14
13
import org.xmtp.android.library.GRPCApiClient.Companion.makeSubscribeRequest
15
14
import org.xmtp.android.library.messages.DecryptedMessage
@@ -61,7 +60,7 @@ data class Conversations(
61
60
fun fromInvite (envelope : Envelope ): Conversation {
62
61
val sealedInvitation = Invitation .SealedInvitation .parseFrom(envelope.message)
63
62
val unsealed = sealedInvitation.v1.getInvitation(viewer = client.keys)
64
- return V2 (
63
+ return Conversation . V2 (
65
64
ConversationV2 .create(
66
65
client = client,
67
66
invitation = unsealed,
@@ -81,7 +80,7 @@ data class Conversations(
81
80
val senderAddress = messageV1.header.sender.walletAddress
82
81
val recipientAddress = messageV1.header.recipient.walletAddress
83
82
val peerAddress = if (client.address == senderAddress) recipientAddress else senderAddress
84
- return V1 (
83
+ return Conversation . V1 (
85
84
ConversationV1 (
86
85
client = client,
87
86
peerAddress = peerAddress,
@@ -154,7 +153,7 @@ data class Conversations(
154
153
val invitationPeers = listIntroductionPeers()
155
154
val peerSeenAt = invitationPeers[peerAddress]
156
155
if (peerSeenAt != null ) {
157
- val conversation = V1 (
156
+ val conversation = Conversation . V1 (
158
157
ConversationV1 (
159
158
client = client,
160
159
peerAddress = peerAddress,
@@ -168,7 +167,7 @@ data class Conversations(
168
167
169
168
// If the contact is v1, start a v1 conversation
170
169
if (Contact .ContactBundle .VersionCase .V1 == contact.versionCase && context?.conversationId.isNullOrEmpty()) {
171
- val conversation = V1 (
170
+ val conversation = Conversation . V1 (
172
171
ConversationV1 (
173
172
client = client,
174
173
peerAddress = peerAddress,
@@ -185,7 +184,7 @@ data class Conversations(
185
184
}
186
185
val invite = sealedInvitation.v1.getInvitation(viewer = client.keys)
187
186
if (invite.context.conversationId == context?.conversationId && invite.context.conversationId != " " ) {
188
- val conversation = V2 (
187
+ val conversation = Conversation . V2 (
189
188
ConversationV2 (
190
189
topic = invite.topic,
191
190
keyMaterial = invite.aes256GcmHkdfSha256.keyMaterial.toByteArray(),
@@ -211,7 +210,7 @@ data class Conversations(
211
210
header = sealedInvitation.v1.header,
212
211
)
213
212
client.contacts.allow(addresses = listOf (peerAddress))
214
- val conversation = V2 (conversationV2)
213
+ val conversation = Conversation . V2 (conversationV2)
215
214
conversationsByTopic[conversation.topic] = conversation
216
215
return conversation
217
216
}
@@ -227,7 +226,7 @@ data class Conversations(
227
226
val seenPeers = listIntroductionPeers(pagination = pagination)
228
227
for ((peerAddress, sentAt) in seenPeers) {
229
228
newConversations.add(
230
- V1 (
229
+ Conversation . V1 (
231
230
ConversationV1 (
232
231
client = client,
233
232
peerAddress = peerAddress,
@@ -239,7 +238,7 @@ data class Conversations(
239
238
val invitations = listInvitations(pagination = pagination)
240
239
for (sealedInvitation in invitations) {
241
240
try {
242
- newConversations.add(V2 (conversation(sealedInvitation)))
241
+ newConversations.add(Conversation . V2 (conversation(sealedInvitation)))
243
242
} catch (e: Exception ) {
244
243
Log .d(TAG , e.message.toString())
245
244
}
@@ -254,7 +253,7 @@ data class Conversations(
254
253
syncGroups()
255
254
listGroups()
256
255
}
257
- conversationsByTopic + = groups.map { Pair (it.id.toString(), Group (it)) }
256
+ conversationsByTopic + = groups.map { Pair (it.id.toString(), Conversation . Group (it)) }
258
257
}
259
258
return conversationsByTopic.values.sortedByDescending { it.createdAt }
260
259
}
@@ -263,15 +262,15 @@ data class Conversations(
263
262
val conversation: Conversation
264
263
if (! data.hasInvitation()) {
265
264
val sentAt = Date (data.createdNs / 1_000_000 )
266
- conversation = V1 (
265
+ conversation = Conversation . V1 (
267
266
ConversationV1 (
268
267
client,
269
268
data.peerAddress,
270
269
sentAt,
271
270
),
272
271
)
273
272
} else {
274
- conversation = V2 (
273
+ conversation = Conversation . V2 (
275
274
ConversationV2 (
276
275
topic = data.invitation.topic,
277
276
keyMaterial = data.invitation.aes256GcmHkdfSha256.keyMaterial.toByteArray(),
@@ -482,7 +481,7 @@ data class Conversations(
482
481
coroutineScope {
483
482
launch {
484
483
groupEmitter.groups.collect { group ->
485
- emit(Group (Group (client, group)))
484
+ emit(Conversation . Group (Group (client, group)))
486
485
}
487
486
}
488
487
}
0 commit comments