@@ -18,7 +18,7 @@ import expo.modules.xmtpreactnativesdk.wrappers.ContentJson
18
18
import expo.modules.xmtpreactnativesdk.wrappers.ConversationWrapper
19
19
import expo.modules.xmtpreactnativesdk.wrappers.ConversationParamsWrapper
20
20
import expo.modules.xmtpreactnativesdk.wrappers.CreateGroupParamsWrapper
21
- import expo.modules.xmtpreactnativesdk.wrappers.DecodedMessageWrapper
21
+ import expo.modules.xmtpreactnativesdk.wrappers.MessageWrapper
22
22
import expo.modules.xmtpreactnativesdk.wrappers.DecryptedLocalAttachment
23
23
import expo.modules.xmtpreactnativesdk.wrappers.DmWrapper
24
24
import expo.modules.xmtpreactnativesdk.wrappers.EncryptedLocalAttachment
@@ -54,13 +54,13 @@ import org.xmtp.android.library.codecs.EncryptedEncodedContent
54
54
import org.xmtp.android.library.codecs.RemoteAttachment
55
55
import org.xmtp.android.library.codecs.decoded
56
56
import org.xmtp.android.library.hexToByteArray
57
+ import org.xmtp.android.library.libxmtp.GroupPermissionPreconfiguration
57
58
import org.xmtp.android.library.libxmtp.Message
59
+ import org.xmtp.android.library.libxmtp.PermissionOption
58
60
import org.xmtp.android.library.messages.PrivateKeyBuilder
59
61
import org.xmtp.android.library.messages.Signature
60
62
import org.xmtp.android.library.push.Service
61
63
import org.xmtp.android.library.push.XMTPPush
62
- import uniffi.xmtpv3.org.xmtp.android.library.libxmtp.GroupPermissionPreconfiguration
63
- import uniffi.xmtpv3.org.xmtp.android.library.libxmtp.PermissionOption
64
64
import java.io.BufferedReader
65
65
import java.io.File
66
66
import java.io.InputStreamReader
@@ -520,15 +520,13 @@ class XMTPModule : Module() {
520
520
).toJson()
521
521
}
522
522
523
- AsyncFunction (" listGroups" ) Coroutine { installationId: String , groupParams: String? , sortOrder : String? , limit: Int? , consentState: String? ->
523
+ AsyncFunction (" listGroups" ) Coroutine { installationId: String , groupParams: String? , limit: Int? , consentState: String? ->
524
524
withContext(Dispatchers .IO ) {
525
525
logV(" listGroups" )
526
526
val client = clients[installationId] ? : throw XMTPException (" No client" )
527
527
val params = ConversationParamsWrapper .conversationParamsFromJson(groupParams ? : " " )
528
- val order = getConversationSortOrder(sortOrder ? : " " )
529
528
val consent = consentState?.let { getConsentState(it) }
530
529
val groups = client.conversations.listGroups(
531
- order = order,
532
530
limit = limit,
533
531
consentState = consent
534
532
)
@@ -538,15 +536,13 @@ class XMTPModule : Module() {
538
536
}
539
537
}
540
538
541
- AsyncFunction (" listDms" ) Coroutine { installationId: String , groupParams: String? , sortOrder : String? , limit: Int? , consentState: String? ->
539
+ AsyncFunction (" listDms" ) Coroutine { installationId: String , groupParams: String? , limit: Int? , consentState: String? ->
542
540
withContext(Dispatchers .IO ) {
543
541
logV(" listDms" )
544
542
val client = clients[installationId] ? : throw XMTPException (" No client" )
545
543
val params = ConversationParamsWrapper .conversationParamsFromJson(groupParams ? : " " )
546
- val order = getConversationSortOrder(sortOrder ? : " " )
547
544
val consent = consentState?.let { getConsentState(it) }
548
545
val dms = client.conversations.listDms(
549
- order = order,
550
546
limit = limit,
551
547
consentState = consent
552
548
)
@@ -556,16 +552,15 @@ class XMTPModule : Module() {
556
552
}
557
553
}
558
554
559
- AsyncFunction (" listConversations" ) Coroutine { installationId: String , conversationParams: String? , sortOrder : String? , limit: Int? , consentState: String? ->
555
+ AsyncFunction (" listConversations" ) Coroutine { installationId: String , conversationParams: String? , limit: Int? , consentState: String? ->
560
556
withContext(Dispatchers .IO ) {
561
557
logV(" listConversations" )
562
558
val client = clients[installationId] ? : throw XMTPException (" No client" )
563
559
val params =
564
560
ConversationParamsWrapper .conversationParamsFromJson(conversationParams ? : " " )
565
- val order = getConversationSortOrder(sortOrder ? : " " )
566
561
val consent = consentState?.let { getConsentState(it) }
567
562
val conversations =
568
- client.conversations.list(order = order, limit = limit, consentState = consent)
563
+ client.conversations.list(limit = limit, consentState = consent)
569
564
conversations.map { conversation ->
570
565
ConversationWrapper .encode(client, conversation, params)
571
566
}
@@ -592,7 +587,7 @@ class XMTPModule : Module() {
592
587
direction = Message .SortDirection .valueOf(
593
588
direction ? : " DESCENDING"
594
589
)
595
- )?.map { DecodedMessageWrapper .encode(it) }
590
+ )?.map { MessageWrapper .encode(it) }
596
591
}
597
592
}
598
593
@@ -602,7 +597,7 @@ class XMTPModule : Module() {
602
597
val client = clients[installationId] ? : throw XMTPException (" No client" )
603
598
val message = client.findMessage(messageId)
604
599
message?.let {
605
- DecodedMessageWrapper .encode(it.decode() )
600
+ MessageWrapper .encode(it)
606
601
}
607
602
}
608
603
}
@@ -1182,7 +1177,9 @@ class XMTPModule : Module() {
1182
1177
val conversation = client.findConversation(id)
1183
1178
? : throw XMTPException (" no conversation found for $id " )
1184
1179
val message = conversation.processMessage(Base64 .decode(encryptedMessage, NO_WRAP ))
1185
- DecodedMessageWrapper .encode(message.decode())
1180
+ message?.let {
1181
+ MessageWrapper .encode(it)
1182
+ }
1186
1183
}
1187
1184
}
1188
1185
@@ -1412,13 +1409,6 @@ class XMTPModule : Module() {
1412
1409
}
1413
1410
}
1414
1411
1415
- private fun getConversationSortOrder (order : String ): ConversationOrder {
1416
- return when (order) {
1417
- " lastMessage" -> ConversationOrder .LAST_MESSAGE
1418
- else -> ConversationOrder .CREATED_AT
1419
- }
1420
- }
1421
-
1422
1412
private fun consentStateToString (state : ConsentState ): String {
1423
1413
return when (state) {
1424
1414
ConsentState .ALLOWED -> " allowed"
@@ -1487,7 +1477,7 @@ class XMTPModule : Module() {
1487
1477
" message" ,
1488
1478
mapOf (
1489
1479
" installationId" to installationId,
1490
- " message" to DecodedMessageWrapper .encodeMap(message),
1480
+ " message" to MessageWrapper .encodeMap(message),
1491
1481
)
1492
1482
)
1493
1483
}
@@ -1511,7 +1501,7 @@ class XMTPModule : Module() {
1511
1501
" conversationMessage" ,
1512
1502
mapOf (
1513
1503
" installationId" to installationId,
1514
- " message" to DecodedMessageWrapper .encodeMap(message),
1504
+ " message" to MessageWrapper .encodeMap(message),
1515
1505
" conversationId" to id,
1516
1506
)
1517
1507
)
0 commit comments