Skip to content

Commit

Permalink
Fix intent publishing (#278)
Browse files Browse the repository at this point in the history
* bump latest version

* fix up the tests
  • Loading branch information
nplasterer authored Jul 25, 2024
1 parent 1367923 commit e97fafb
Show file tree
Hide file tree
Showing 7 changed files with 43 additions and 44 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -514,8 +514,7 @@ class GroupTest {
}

assertEquals(group.messages().size, 3)
assertEquals(group.messages(deliveryStatus = MessageDeliveryStatus.UNPUBLISHED).size, 2)
assertEquals(group.messages(deliveryStatus = MessageDeliveryStatus.PUBLISHED).size, 1)
assertEquals(group.messages(deliveryStatus = MessageDeliveryStatus.PUBLISHED).size, 3)
runBlocking { group.sync() }
assertEquals(group.messages().size, 3)
assertEquals(group.messages(deliveryStatus = MessageDeliveryStatus.UNPUBLISHED).size, 0)
Expand Down
4 changes: 2 additions & 2 deletions library/src/main/java/libxmtp-version.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
Version: 4a572e8a
Version: 3df528b5
Branch: main
Date: 2024-07-23 15:16:12 +0000
Date: 2024-07-25 22:27:46 +0000
80 changes: 40 additions & 40 deletions library/src/main/java/xmtpv3.kt
Original file line number Diff line number Diff line change
Expand Up @@ -264,7 +264,7 @@ interface UniffiRustCallStatusErrorHandler<E> {
// Call a rust function that returns a Result<>. Pass in the Error class companion that corresponds to the Err
private inline fun <U, E : Exception> uniffiRustCallWithError(
errorHandler: UniffiRustCallStatusErrorHandler<E>,
callback: (UniffiRustCallStatus) -> U
callback: (UniffiRustCallStatus) -> U,
): U {
var status = UniffiRustCallStatus();
val return_value = callback(status)
Expand All @@ -275,7 +275,7 @@ private inline fun <U, E : Exception> uniffiRustCallWithError(
// Check UniffiRustCallStatus and throw an error if the call wasn't successful
private fun <E : Exception> uniffiCheckCallStatus(
errorHandler: UniffiRustCallStatusErrorHandler<E>,
status: UniffiRustCallStatus
status: UniffiRustCallStatus,
) {
if (status.isSuccess()) {
return
Expand Down Expand Up @@ -325,7 +325,7 @@ internal inline fun <T, reified E : Throwable> uniffiTraitInterfaceCallWithError
callStatus: UniffiRustCallStatus,
makeCall: () -> T,
writeReturn: (T) -> Unit,
lowerError: (E) -> RustBuffer.ByValue
lowerError: (E) -> RustBuffer.ByValue,
) {
try {
writeReturn(makeCall())
Expand Down Expand Up @@ -380,7 +380,7 @@ private fun findLibraryName(componentName: String): String {
}

private inline fun <reified Lib : Library> loadIndirect(
componentName: String
componentName: String,
): Lib {
return Native.load<Lib>(findLibraryName(componentName), Lib::class.java)
}
Expand Down Expand Up @@ -2210,7 +2210,7 @@ internal suspend fun <T, F, E : Exception> uniffiRustCallAsync(
completeFunc: (Long, UniffiRustCallStatus) -> F,
freeFunc: (Long) -> Unit,
liftFunc: (F) -> T,
errorHandler: UniffiRustCallStatusErrorHandler<E>
errorHandler: UniffiRustCallStatusErrorHandler<E>,
): T {
try {
do {
Expand Down Expand Up @@ -2594,7 +2594,7 @@ private class JavaLangRefCleaner : UniffiCleaner {
}

private class JavaLangRefCleanable(
val cleanable: java.lang.ref.Cleaner.Cleanable
val cleanable: java.lang.ref.Cleaner.Cleanable,
) : UniffiCleaner.Cleanable {
override fun clean() = cleanable.clean()
}
Expand All @@ -2603,7 +2603,7 @@ public interface FfiConversationsInterface {

suspend fun `createGroup`(
`accountAddresses`: List<kotlin.String>,
`opts`: FfiCreateGroupOptions
`opts`: FfiCreateGroupOptions,
): FfiGroup

suspend fun `list`(`opts`: FfiListConversationsOptions): List<FfiGroup>
Expand Down Expand Up @@ -2705,7 +2705,7 @@ open class FfiConversations : Disposable, AutoCloseable, FfiConversationsInterfa
@Suppress("ASSIGNED_BUT_NEVER_ACCESSED_VARIABLE")
override suspend fun `createGroup`(
`accountAddresses`: List<kotlin.String>,
`opts`: FfiCreateGroupOptions
`opts`: FfiCreateGroupOptions,
): FfiGroup {
return uniffiRustCallAsync(
callWithPointer { thisPtr ->
Expand Down Expand Up @@ -3103,7 +3103,7 @@ public interface FfiGroupInterface {
suspend fun `updatePermissionPolicy`(
`permissionUpdateType`: FfiPermissionUpdateType,
`permissionPolicyOption`: FfiPermissionPolicy,
`metadataField`: FfiMetadataField?
`metadataField`: FfiMetadataField?,
)

companion object
Expand Down Expand Up @@ -3995,7 +3995,7 @@ open class FfiGroup : Disposable, AutoCloseable, FfiGroupInterface {
override suspend fun `updatePermissionPolicy`(
`permissionUpdateType`: FfiPermissionUpdateType,
`permissionPolicyOption`: FfiPermissionPolicy,
`metadataField`: FfiMetadataField?
`metadataField`: FfiMetadataField?,
) {
return uniffiRustCallAsync(
callWithPointer { thisPtr ->
Expand Down Expand Up @@ -4655,7 +4655,7 @@ public interface FfiSignatureRequestInterface {
suspend fun `addScwSignature`(
`signatureBytes`: kotlin.ByteArray,
`address`: kotlin.String,
`chainRpcUrl`: kotlin.String
`chainRpcUrl`: kotlin.String,
)

suspend fun `isReady`(): kotlin.Boolean
Expand Down Expand Up @@ -4790,7 +4790,7 @@ open class FfiSignatureRequest : Disposable, AutoCloseable, FfiSignatureRequestI
override suspend fun `addScwSignature`(
`signatureBytes`: kotlin.ByteArray,
`address`: kotlin.String,
`chainRpcUrl`: kotlin.String
`chainRpcUrl`: kotlin.String,
) {
return uniffiRustCallAsync(
callWithPointer { thisPtr ->
Expand Down Expand Up @@ -5352,7 +5352,7 @@ public interface FfiV2ApiClientInterface {

suspend fun `subscribe`(
`request`: FfiV2SubscribeRequest,
`callback`: FfiV2SubscriptionCallback
`callback`: FfiV2SubscriptionCallback,
): FfiV2Subscription

companion object
Expand Down Expand Up @@ -5551,7 +5551,7 @@ open class FfiV2ApiClient : Disposable, AutoCloseable, FfiV2ApiClientInterface {
@Suppress("ASSIGNED_BUT_NEVER_ACCESSED_VARIABLE")
override suspend fun `subscribe`(
`request`: FfiV2SubscribeRequest,
`callback`: FfiV2SubscriptionCallback
`callback`: FfiV2SubscriptionCallback,
): FfiV2Subscription {
return uniffiRustCallAsync(
callWithPointer { thisPtr ->
Expand Down Expand Up @@ -6046,7 +6046,7 @@ public interface FfiXmtpClientInterface {
*/
suspend fun `addWallet`(
`existingWalletAddress`: kotlin.String,
`newWalletAddress`: kotlin.String
`newWalletAddress`: kotlin.String,
): FfiSignatureRequest

suspend fun `applySignatureRequest`(`signatureRequest`: FfiSignatureRequest)
Expand Down Expand Up @@ -6172,7 +6172,7 @@ open class FfiXmtpClient : Disposable, AutoCloseable, FfiXmtpClientInterface {
@Suppress("ASSIGNED_BUT_NEVER_ACCESSED_VARIABLE")
override suspend fun `addWallet`(
`existingWalletAddress`: kotlin.String,
`newWalletAddress`: kotlin.String
`newWalletAddress`: kotlin.String,
): FfiSignatureRequest {
return uniffiRustCallAsync(
callWithPointer { thisPtr ->
Expand Down Expand Up @@ -6560,7 +6560,7 @@ data class FfiCreateGroupOptions(
var `groupImageUrlSquare`: kotlin.String?,
var `groupDescription`: kotlin.String?,
var `groupPinnedFrameUrl`: kotlin.String?,
var `customPermissionPolicySet`: FfiPermissionPolicySet?
var `customPermissionPolicySet`: FfiPermissionPolicySet?,
) {

companion object
Expand Down Expand Up @@ -6601,7 +6601,7 @@ public object FfiConverterTypeFfiCreateGroupOptions :

data class FfiCursor(
var `digest`: kotlin.ByteArray,
var `senderTimeNs`: kotlin.ULong
var `senderTimeNs`: kotlin.ULong,
) {

companion object
Expand Down Expand Up @@ -6630,7 +6630,7 @@ public object FfiConverterTypeFfiCursor : FfiConverterRustBuffer<FfiCursor> {
data class FfiEnvelope(
var `contentTopic`: kotlin.String,
var `timestampNs`: kotlin.ULong,
var `message`: kotlin.ByteArray
var `message`: kotlin.ByteArray,
) {

companion object
Expand Down Expand Up @@ -6663,7 +6663,7 @@ data class FfiGroupMember(
var `inboxId`: kotlin.String,
var `accountAddresses`: List<kotlin.String>,
var `installationIds`: List<kotlin.ByteArray>,
var `permissionLevel`: FfiPermissionLevel
var `permissionLevel`: FfiPermissionLevel,
) {

companion object
Expand Down Expand Up @@ -6698,7 +6698,7 @@ public object FfiConverterTypeFfiGroupMember : FfiConverterRustBuffer<FfiGroupMe
data class FfiListConversationsOptions(
var `createdAfterNs`: kotlin.Long?,
var `createdBeforeNs`: kotlin.Long?,
var `limit`: kotlin.Long?
var `limit`: kotlin.Long?,
) {

companion object
Expand Down Expand Up @@ -6732,7 +6732,7 @@ data class FfiListMessagesOptions(
var `sentBeforeNs`: kotlin.Long?,
var `sentAfterNs`: kotlin.Long?,
var `limit`: kotlin.Long?,
var `deliveryStatus`: FfiDeliveryStatus?
var `deliveryStatus`: FfiDeliveryStatus?,
) {

companion object
Expand Down Expand Up @@ -6772,7 +6772,7 @@ data class FfiMessage(
var `senderInboxId`: kotlin.String,
var `content`: kotlin.ByteArray,
var `kind`: FfiGroupMessageKind,
var `deliveryStatus`: FfiDeliveryStatus
var `deliveryStatus`: FfiDeliveryStatus,
) {

companion object
Expand Down Expand Up @@ -6816,7 +6816,7 @@ public object FfiConverterTypeFfiMessage : FfiConverterRustBuffer<FfiMessage> {
data class FfiPagingInfo(
var `limit`: kotlin.UInt,
var `cursor`: FfiCursor?,
var `direction`: FfiSortDirection
var `direction`: FfiSortDirection,
) {

companion object
Expand Down Expand Up @@ -6853,7 +6853,7 @@ data class FfiPermissionPolicySet(
var `updateGroupNamePolicy`: FfiPermissionPolicy,
var `updateGroupDescriptionPolicy`: FfiPermissionPolicy,
var `updateGroupImageUrlSquarePolicy`: FfiPermissionPolicy,
var `updateGroupPinnedFrameUrlPolicy`: FfiPermissionPolicy
var `updateGroupPinnedFrameUrlPolicy`: FfiPermissionPolicy,
) {

companion object
Expand Down Expand Up @@ -6899,7 +6899,7 @@ public object FfiConverterTypeFfiPermissionPolicySet :


data class FfiPublishRequest(
var `envelopes`: List<FfiEnvelope>
var `envelopes`: List<FfiEnvelope>,
) {

companion object
Expand All @@ -6923,7 +6923,7 @@ public object FfiConverterTypeFfiPublishRequest : FfiConverterRustBuffer<FfiPubl


data class FfiV2BatchQueryRequest(
var `requests`: List<FfiV2QueryRequest>
var `requests`: List<FfiV2QueryRequest>,
) {

companion object
Expand All @@ -6948,7 +6948,7 @@ public object FfiConverterTypeFfiV2BatchQueryRequest :


data class FfiV2BatchQueryResponse(
var `responses`: List<FfiV2QueryResponse>
var `responses`: List<FfiV2QueryResponse>,
) {

companion object
Expand Down Expand Up @@ -6976,7 +6976,7 @@ data class FfiV2QueryRequest(
var `contentTopics`: List<kotlin.String>,
var `startTimeNs`: kotlin.ULong,
var `endTimeNs`: kotlin.ULong,
var `pagingInfo`: FfiPagingInfo?
var `pagingInfo`: FfiPagingInfo?,
) {

companion object
Expand Down Expand Up @@ -7010,7 +7010,7 @@ public object FfiConverterTypeFfiV2QueryRequest : FfiConverterRustBuffer<FfiV2Qu

data class FfiV2QueryResponse(
var `envelopes`: List<FfiEnvelope>,
var `pagingInfo`: FfiPagingInfo?
var `pagingInfo`: FfiPagingInfo?,
) {

companion object
Expand All @@ -7037,7 +7037,7 @@ public object FfiConverterTypeFfiV2QueryResponse : FfiConverterRustBuffer<FfiV2Q


data class FfiV2SubscribeRequest(
var `contentTopics`: List<kotlin.String>
var `contentTopics`: List<kotlin.String>,
) {

companion object
Expand Down Expand Up @@ -8268,7 +8268,7 @@ suspend fun `createClient`(
`accountAddress`: kotlin.String,
`nonce`: kotlin.ULong,
`legacySignedPrivateKeyProto`: kotlin.ByteArray?,
`historySyncUrl`: kotlin.String?
`historySyncUrl`: kotlin.String?,
): FfiXmtpClient {
return uniffiRustCallAsync(
UniffiLib.INSTANCE.uniffi_xmtpv3_fn_func_create_client(
Expand Down Expand Up @@ -8338,7 +8338,7 @@ suspend fun `createV2Client`(`host`: kotlin.String, `isSecure`: kotlin.Boolean):
@Throws(GenericException::class)
fun `diffieHellmanK256`(
`privateKeyBytes`: kotlin.ByteArray,
`publicKeyBytes`: kotlin.ByteArray
`publicKeyBytes`: kotlin.ByteArray,
): kotlin.ByteArray {
return FfiConverterByteArray.lift(
uniffiRustCallWithError(GenericException) { _status ->
Expand Down Expand Up @@ -8382,7 +8382,7 @@ suspend fun `getInboxIdForAddress`(
`logger`: FfiLogger,
`host`: kotlin.String,
`isSecure`: kotlin.Boolean,
`accountAddress`: kotlin.String
`accountAddress`: kotlin.String,
): kotlin.String? {
return uniffiRustCallAsync(
UniffiLib.INSTANCE.uniffi_xmtpv3_fn_func_get_inbox_id_for_address(
Expand Down Expand Up @@ -8450,7 +8450,7 @@ fun `publicKeyFromPrivateKeyK256`(`privateKeyBytes`: kotlin.ByteArray): kotlin.B
@Throws(GenericException::class)
fun `recoverAddress`(
`signatureBytes`: kotlin.ByteArray,
`predigestMessage`: kotlin.String
`predigestMessage`: kotlin.String,
): kotlin.String {
return FfiConverterString.lift(
uniffiRustCallWithError(GenericException) { _status ->
Expand All @@ -8467,7 +8467,7 @@ fun `recoverAddress`(
@Throws(GenericException::class)
fun `recoverPublicKeyK256Keccak256`(
`message`: kotlin.ByteArray,
`signature`: kotlin.ByteArray
`signature`: kotlin.ByteArray,
): kotlin.ByteArray {
return FfiConverterByteArray.lift(
uniffiRustCallWithError(GenericException) { _status ->
Expand All @@ -8484,7 +8484,7 @@ fun `recoverPublicKeyK256Keccak256`(
@Throws(GenericException::class)
fun `recoverPublicKeyK256Sha256`(
`message`: kotlin.ByteArray,
`signature`: kotlin.ByteArray
`signature`: kotlin.ByteArray,
): kotlin.ByteArray {
return FfiConverterByteArray.lift(
uniffiRustCallWithError(GenericException) { _status ->
Expand Down Expand Up @@ -8512,7 +8512,7 @@ fun `sha256`(`input`: kotlin.ByteArray): kotlin.ByteArray {
fun `userPreferencesDecrypt`(
`publicKey`: kotlin.ByteArray,
`privateKey`: kotlin.ByteArray,
`message`: kotlin.ByteArray
`message`: kotlin.ByteArray,
): kotlin.ByteArray {
return FfiConverterByteArray.lift(
uniffiRustCallWithError(GenericException) { _status ->
Expand All @@ -8531,7 +8531,7 @@ fun `userPreferencesDecrypt`(
fun `userPreferencesEncrypt`(
`publicKey`: kotlin.ByteArray,
`privateKey`: kotlin.ByteArray,
`message`: kotlin.ByteArray
`message`: kotlin.ByteArray,
): kotlin.ByteArray {
return FfiConverterByteArray.lift(
uniffiRustCallWithError(GenericException) { _status ->
Expand All @@ -8551,7 +8551,7 @@ fun `verifyK256Sha256`(
`signedBy`: kotlin.ByteArray,
`message`: kotlin.ByteArray,
`signature`: kotlin.ByteArray,
`recoveryId`: kotlin.UByte
`recoveryId`: kotlin.UByte,
): kotlin.Boolean {
return FfiConverterBoolean.lift(
uniffiRustCallWithError(GenericException) { _status ->
Expand Down
Binary file modified library/src/main/jniLibs/arm64-v8a/libuniffi_xmtpv3.so
Binary file not shown.
Binary file modified library/src/main/jniLibs/armeabi-v7a/libuniffi_xmtpv3.so
Binary file not shown.
Binary file modified library/src/main/jniLibs/x86/libuniffi_xmtpv3.so
Binary file not shown.
Binary file modified library/src/main/jniLibs/x86_64/libuniffi_xmtpv3.so
Binary file not shown.

0 comments on commit e97fafb

Please sign in to comment.