Skip to content

Commit 867d1dc

Browse files
committed
stream all messages in libxmtp
1 parent e56f527 commit 867d1dc

File tree

1 file changed

+28
-0
lines changed

1 file changed

+28
-0
lines changed

library/src/main/java/xmtpv3.kt

+28
Original file line numberDiff line numberDiff line change
@@ -401,6 +401,8 @@ internal interface _UniFFILib : Library {
401401
): Pointer
402402
fun uniffi_xmtpv3_fn_method_fficonversations_stream(`ptr`: Pointer,`callback`: Long,
403403
): Pointer
404+
fun uniffi_xmtpv3_fn_method_fficonversations_stream_all_messages(`ptr`: Pointer,`messageCallback`: Long,
405+
): Pointer
404406
fun uniffi_xmtpv3_fn_method_fficonversations_sync(`ptr`: Pointer,
405407
): Pointer
406408
fun uniffi_xmtpv3_fn_free_ffigroup(`ptr`: Pointer,_uniffi_out_err: RustCallStatus,
@@ -657,6 +659,8 @@ internal interface _UniFFILib : Library {
657659
): Short
658660
fun uniffi_xmtpv3_checksum_method_fficonversations_stream(
659661
): Short
662+
fun uniffi_xmtpv3_checksum_method_fficonversations_stream_all_messages(
663+
): Short
660664
fun uniffi_xmtpv3_checksum_method_fficonversations_sync(
661665
): Short
662666
fun uniffi_xmtpv3_checksum_method_ffigroup_add_members(
@@ -795,6 +799,9 @@ private fun uniffiCheckApiChecksums(lib: _UniFFILib) {
795799
if (lib.uniffi_xmtpv3_checksum_method_fficonversations_stream() != 60583.toShort()) {
796800
throw RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
797801
}
802+
if (lib.uniffi_xmtpv3_checksum_method_fficonversations_stream_all_messages() != 65211.toShort()) {
803+
throw RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
804+
}
798805
if (lib.uniffi_xmtpv3_checksum_method_fficonversations_sync() != 62598.toShort()) {
799806
throw RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
800807
}
@@ -1289,6 +1296,7 @@ public interface FfiConversationsInterface {
12891296
suspend fun `createGroup`(`accountAddresses`: List<String>, `permissions`: GroupPermissions?): FfiGroup@Throws(GenericException::class)
12901297
suspend fun `list`(`opts`: FfiListConversationsOptions): List<FfiGroup>@Throws(GenericException::class)
12911298
suspend fun `stream`(`callback`: FfiConversationCallback): FfiStreamCloser@Throws(GenericException::class)
1299+
suspend fun `streamAllMessages`(`messageCallback`: FfiMessageCallback): FfiStreamCloser@Throws(GenericException::class)
12921300
suspend fun `sync`()
12931301
companion object
12941302
}
@@ -1372,6 +1380,26 @@ class FfiConversations(
13721380
)
13731381
}
13741382

1383+
@Throws(GenericException::class)
1384+
@Suppress("ASSIGNED_BUT_NEVER_ACCESSED_VARIABLE")
1385+
override suspend fun `streamAllMessages`(`messageCallback`: FfiMessageCallback) : FfiStreamCloser {
1386+
return uniffiRustCallAsync(
1387+
callWithPointer { thisPtr ->
1388+
_UniFFILib.INSTANCE.uniffi_xmtpv3_fn_method_fficonversations_stream_all_messages(
1389+
thisPtr,
1390+
FfiConverterTypeFfiMessageCallback.lower(`messageCallback`),
1391+
)
1392+
},
1393+
{ future, continuation -> _UniFFILib.INSTANCE.ffi_xmtpv3_rust_future_poll_pointer(future, continuation) },
1394+
{ future, continuation -> _UniFFILib.INSTANCE.ffi_xmtpv3_rust_future_complete_pointer(future, continuation) },
1395+
{ future -> _UniFFILib.INSTANCE.ffi_xmtpv3_rust_future_free_pointer(future) },
1396+
// lift function
1397+
{ FfiConverterTypeFfiStreamCloser.lift(it) },
1398+
// Error FFI converter
1399+
GenericException.ErrorHandler,
1400+
)
1401+
}
1402+
13751403
@Throws(GenericException::class)
13761404
@Suppress("ASSIGNED_BUT_NEVER_ACCESSED_VARIABLE")
13771405
override suspend fun `sync`() {

0 commit comments

Comments
 (0)