Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Group message delivery status #232

Merged
merged 6 commits into from
Apr 18, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
dump the schema changes
  • Loading branch information
nplasterer committed Apr 18, 2024
commit 4fe8e060f1c21bb6a91c387e3beccdb426588f72
84 changes: 72 additions & 12 deletions library/src/main/java/xmtpv3.kt
Original file line number Diff line number Diff line change
@@ -854,7 +854,7 @@ private fun uniffiCheckApiChecksums(lib: _UniFFILib) {
if (lib.uniffi_xmtpv3_checksum_method_ffigroup_remove_members() != 1645.toShort()) {
throw RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
}
if (lib.uniffi_xmtpv3_checksum_method_ffigroup_send() != 55957.toShort()) {
if (lib.uniffi_xmtpv3_checksum_method_ffigroup_send() != 2523.toShort()) {
throw RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
}
if (lib.uniffi_xmtpv3_checksum_method_ffigroup_stream() != 7482.toShort()) {
@@ -1505,7 +1505,7 @@ public interface FfiGroupInterface {
fun `listMembers`(): List<FfiGroupMember>@Throws(GenericException::class)
suspend fun `processStreamedGroupMessage`(`envelopeBytes`: ByteArray): FfiMessage@Throws(GenericException::class)
suspend fun `removeMembers`(`accountAddresses`: List<String>)@Throws(GenericException::class)
suspend fun `send`(`contentBytes`: ByteArray)@Throws(GenericException::class)
suspend fun `send`(`contentBytes`: ByteArray): ByteArray@Throws(GenericException::class)
suspend fun `stream`(`messageCallback`: FfiMessageCallback): FfiStreamCloser@Throws(GenericException::class)
suspend fun `sync`()
companion object
@@ -1676,20 +1676,19 @@ class FfiGroup(

@Throws(GenericException::class)
@Suppress("ASSIGNED_BUT_NEVER_ACCESSED_VARIABLE")
override suspend fun `send`(`contentBytes`: ByteArray) {
override suspend fun `send`(`contentBytes`: ByteArray) : ByteArray {
return uniffiRustCallAsync(
callWithPointer { thisPtr ->
_UniFFILib.INSTANCE.uniffi_xmtpv3_fn_method_ffigroup_send(
thisPtr,
FfiConverterByteArray.lower(`contentBytes`),
)
},
{ future, continuation -> _UniFFILib.INSTANCE.ffi_xmtpv3_rust_future_poll_void(future, continuation) },
{ future, continuation -> _UniFFILib.INSTANCE.ffi_xmtpv3_rust_future_complete_void(future, continuation) },
{ future -> _UniFFILib.INSTANCE.ffi_xmtpv3_rust_future_free_void(future) },
{ future, continuation -> _UniFFILib.INSTANCE.ffi_xmtpv3_rust_future_poll_rust_buffer(future, continuation) },
{ future, continuation -> _UniFFILib.INSTANCE.ffi_xmtpv3_rust_future_complete_rust_buffer(future, continuation) },
{ future -> _UniFFILib.INSTANCE.ffi_xmtpv3_rust_future_free_rust_buffer(future) },
// lift function
{ Unit },

{ FfiConverterByteArray.lift(it) },
// Error FFI converter
GenericException.ErrorHandler,
)
@@ -2484,7 +2483,8 @@ public object FfiConverterTypeFfiListConversationsOptions: FfiConverterRustBuffe
data class FfiListMessagesOptions (
var `sentBeforeNs`: Long?,
var `sentAfterNs`: Long?,
var `limit`: Long?
var `limit`: Long?,
var `deliveryStatus`: FfiDeliveryStatus?
) {

companion object
@@ -2496,19 +2496,22 @@ public object FfiConverterTypeFfiListMessagesOptions: FfiConverterRustBuffer<Ffi
FfiConverterOptionalLong.read(buf),
FfiConverterOptionalLong.read(buf),
FfiConverterOptionalLong.read(buf),
FfiConverterOptionalTypeFfiDeliveryStatus.read(buf),
)
}

override fun allocationSize(value: FfiListMessagesOptions) = (
FfiConverterOptionalLong.allocationSize(value.`sentBeforeNs`) +
FfiConverterOptionalLong.allocationSize(value.`sentAfterNs`) +
FfiConverterOptionalLong.allocationSize(value.`limit`)
FfiConverterOptionalLong.allocationSize(value.`limit`) +
FfiConverterOptionalTypeFfiDeliveryStatus.allocationSize(value.`deliveryStatus`)
)

override fun write(value: FfiListMessagesOptions, buf: ByteBuffer) {
FfiConverterOptionalLong.write(value.`sentBeforeNs`, buf)
FfiConverterOptionalLong.write(value.`sentAfterNs`, buf)
FfiConverterOptionalLong.write(value.`limit`, buf)
FfiConverterOptionalTypeFfiDeliveryStatus.write(value.`deliveryStatus`, buf)
}
}

@@ -2521,7 +2524,8 @@ data class FfiMessage (
var `convoId`: ByteArray,
var `addrFrom`: String,
var `content`: ByteArray,
var `kind`: FfiGroupMessageKind
var `kind`: FfiGroupMessageKind,
var `deliveryStatus`: FfiDeliveryStatus
) {

companion object
@@ -2536,6 +2540,7 @@ public object FfiConverterTypeFfiMessage: FfiConverterRustBuffer<FfiMessage> {
FfiConverterString.read(buf),
FfiConverterByteArray.read(buf),
FfiConverterTypeFfiGroupMessageKind.read(buf),
FfiConverterTypeFfiDeliveryStatus.read(buf),
)
}

@@ -2545,7 +2550,8 @@ public object FfiConverterTypeFfiMessage: FfiConverterRustBuffer<FfiMessage> {
FfiConverterByteArray.allocationSize(value.`convoId`) +
FfiConverterString.allocationSize(value.`addrFrom`) +
FfiConverterByteArray.allocationSize(value.`content`) +
FfiConverterTypeFfiGroupMessageKind.allocationSize(value.`kind`)
FfiConverterTypeFfiGroupMessageKind.allocationSize(value.`kind`) +
FfiConverterTypeFfiDeliveryStatus.allocationSize(value.`deliveryStatus`)
)

override fun write(value: FfiMessage, buf: ByteBuffer) {
@@ -2555,6 +2561,7 @@ public object FfiConverterTypeFfiMessage: FfiConverterRustBuffer<FfiMessage> {
FfiConverterString.write(value.`addrFrom`, buf)
FfiConverterByteArray.write(value.`content`, buf)
FfiConverterTypeFfiGroupMessageKind.write(value.`kind`, buf)
FfiConverterTypeFfiDeliveryStatus.write(value.`deliveryStatus`, buf)
}
}

@@ -2767,6 +2774,30 @@ public object FfiConverterTypeFfiV2SubscribeRequest: FfiConverterRustBuffer<FfiV



enum class FfiDeliveryStatus {
UNPUBLISHED,PUBLISHED,FAILED;
companion object
}

public object FfiConverterTypeFfiDeliveryStatus: FfiConverterRustBuffer<FfiDeliveryStatus> {
override fun read(buf: ByteBuffer) = try {
FfiDeliveryStatus.values()[buf.getInt() - 1]
} catch (e: IndexOutOfBoundsException) {
throw RuntimeException("invalid enum value, something is very wrong!!", e)
}

override fun allocationSize(value: FfiDeliveryStatus) = 4

override fun write(value: FfiDeliveryStatus, buf: ByteBuffer) {
buf.putInt(value.ordinal + 1)
}
}






enum class FfiGroupMessageKind {
APPLICATION,MEMBERSHIP_CHANGE;
companion object
@@ -3591,6 +3622,35 @@ public object FfiConverterOptionalTypeFfiPagingInfo: FfiConverterRustBuffer<FfiP



public object FfiConverterOptionalTypeFfiDeliveryStatus: FfiConverterRustBuffer<FfiDeliveryStatus?> {
override fun read(buf: ByteBuffer): FfiDeliveryStatus? {
if (buf.get().toInt() == 0) {
return null
}
return FfiConverterTypeFfiDeliveryStatus.read(buf)
}

override fun allocationSize(value: FfiDeliveryStatus?): Int {
if (value == null) {
return 1
} else {
return 1 + FfiConverterTypeFfiDeliveryStatus.allocationSize(value)
}
}

override fun write(value: FfiDeliveryStatus?, buf: ByteBuffer) {
if (value == null) {
buf.put(0)
} else {
buf.put(1)
FfiConverterTypeFfiDeliveryStatus.write(value, buf)
}
}
}




public object FfiConverterOptionalTypeGroupPermissions: FfiConverterRustBuffer<GroupPermissions?> {
override fun read(buf: ByteBuffer): GroupPermissions? {
if (buf.get().toInt() == 0) {
Loading