Skip to content

Commit

Permalink
bump versions again
Browse files Browse the repository at this point in the history
  • Loading branch information
nplasterer committed Dec 20, 2024
1 parent 7df7cf3 commit 0e0222e
Show file tree
Hide file tree
Showing 4 changed files with 150 additions and 5 deletions.
2 changes: 1 addition & 1 deletion LibXMTP.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ Pod::Spec.new do |s|
s.platform = :ios, '14.0', :macos, '11.0'
s.swift_version = '5.3'

s.source = { :http => "https://github.com/xmtp/libxmtp/releases/download/swift-bindings-33c06af/LibXMTPSwiftFFI.zip", :type => :zip }
s.source = { :http => "https://github.com/xmtp/libxmtp/releases/download/swift-bindings-7d863bd/LibXMTPSwiftFFI.zip", :type => :zip }
s.vendored_frameworks = 'LibXMTPSwiftFFI.xcframework'
s.source_files = 'Sources/LibXMTP/**/*'
end
4 changes: 2 additions & 2 deletions Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@ let package = Package(
),
.binaryTarget(
name: "LibXMTPSwiftFFI",
url: "https://github.com/xmtp/libxmtp/releases/download/swift-bindings-33c06af/LibXMTPSwiftFFI.zip",
checksum: "d7e0667ebea3d5e68bf8d6a6d014219263697436ee1714e89fe9a7362f38925b"
url: "https://github.com/xmtp/libxmtp/releases/download/swift-bindings-7d863bd/LibXMTPSwiftFFI.zip",
checksum: "0b496c3b016338b88d7b5b62828030b6107c0ee195bd869d0309507237a53bff"
),
.testTarget(name: "LibXMTPTests", dependencies: ["LibXMTP"]),
]
Expand Down
4 changes: 2 additions & 2 deletions Sources/LibXMTP/libxmtp-version.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
Version: 33c06af6
Version: 7d863bde
Branch: main
Date: 2024-12-20 17:34:43 +0000
Date: 2024-12-20 22:46:38 +0000
145 changes: 145 additions & 0 deletions Sources/LibXMTP/xmtpv3.swift
Original file line number Diff line number Diff line change
Expand Up @@ -1581,6 +1581,105 @@ public func FfiConverterTypeFfiConversationCallback_lower(_ value: FfiConversati
return FfiConverterTypeFfiConversationCallback.lower(value)
}

public protocol FfiConversationListItemProtocol: AnyObject {}

open class FfiConversationListItem:
FfiConversationListItemProtocol
{
fileprivate let pointer: UnsafeMutableRawPointer!

/// Used to instantiate a [FFIObject] without an actual pointer, for fakes in tests, mostly.
#if swift(>=5.8)
@_documentation(visibility: private)
#endif
public struct NoPointer {
public init() {}
}

// TODO: We'd like this to be `private` but for Swifty reasons,
// we can't implement `FfiConverter` without making this `required` and we can't
// make it `required` without making it `public`.
public required init(unsafeFromRawPointer pointer: UnsafeMutableRawPointer) {
self.pointer = pointer
}

// This constructor can be used to instantiate a fake object.
// - Parameter noPointer: Placeholder value so we can have a constructor separate from the default empty one that may be implemented for classes extending [FFIObject].
//
// - Warning:
// Any object instantiated with this constructor cannot be passed to an actual Rust-backed object. Since there isn't a backing [Pointer] the FFI lower functions will crash.
#if swift(>=5.8)
@_documentation(visibility: private)
#endif
public init(noPointer _: NoPointer) {
pointer = nil
}

#if swift(>=5.8)
@_documentation(visibility: private)
#endif
public func uniffiClonePointer() -> UnsafeMutableRawPointer {
return try! rustCall { uniffi_xmtpv3_fn_clone_fficonversationlistitem(self.pointer, $0) }
}

// No primary constructor declared for this class.

deinit {
guard let pointer = pointer else {
return
}

try! rustCall { uniffi_xmtpv3_fn_free_fficonversationlistitem(pointer, $0) }
}
}

#if swift(>=5.8)
@_documentation(visibility: private)
#endif
public struct FfiConverterTypeFfiConversationListItem: FfiConverter {
typealias FfiType = UnsafeMutableRawPointer
typealias SwiftType = FfiConversationListItem

public static func lift(_ pointer: UnsafeMutableRawPointer) throws -> FfiConversationListItem {
return FfiConversationListItem(unsafeFromRawPointer: pointer)
}

public static func lower(_ value: FfiConversationListItem) -> UnsafeMutableRawPointer {
return value.uniffiClonePointer()
}

public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> FfiConversationListItem {
let v: UInt64 = try readInt(&buf)
// The Rust code won't compile if a pointer won't fit in a UInt64.
// We have to go via `UInt` because that's the thing that's the size of a pointer.
let ptr = UnsafeMutableRawPointer(bitPattern: UInt(truncatingIfNeeded: v))
if ptr == nil {
throw UniffiInternalError.unexpectedNullPointer
}
return try lift(ptr!)
}

public static func write(_ value: FfiConversationListItem, into buf: inout [UInt8]) {
// This fiddling is because `Int` is the thing that's the same size as a pointer.
// The Rust code won't compile if a pointer won't fit in a `UInt64`.
writeInt(&buf, UInt64(bitPattern: Int64(Int(bitPattern: lower(value)))))
}
}

#if swift(>=5.8)
@_documentation(visibility: private)
#endif
public func FfiConverterTypeFfiConversationListItem_lift(_ pointer: UnsafeMutableRawPointer) throws -> FfiConversationListItem {
return try FfiConverterTypeFfiConversationListItem.lift(pointer)
}

#if swift(>=5.8)
@_documentation(visibility: private)
#endif
public func FfiConverterTypeFfiConversationListItem_lower(_ value: FfiConversationListItem) -> UnsafeMutableRawPointer {
return FfiConverterTypeFfiConversationListItem.lower(value)
}

public protocol FfiConversationMetadataProtocol: AnyObject {
func conversationType() -> FfiConversationType

Expand Down Expand Up @@ -1707,6 +1806,8 @@ public protocol FfiConversationsProtocol: AnyObject {

func list(opts: FfiListConversationsOptions) async throws -> [FfiConversation]

func listConversations() async throws -> [FfiConversationListItem]

func listDms(opts: FfiListConversationsOptions) async throws -> [FfiConversation]

func listGroups(opts: FfiListConversationsOptions) async throws -> [FfiConversation]
Expand Down Expand Up @@ -1856,6 +1957,22 @@ open class FfiConversations:
)
}

open func listConversations() async throws -> [FfiConversationListItem] {
return
try await uniffiRustCallAsync(
rustFutureFunc: {
uniffi_xmtpv3_fn_method_fficonversations_list_conversations(
self.uniffiClonePointer()
)
},
pollFunc: ffi_xmtpv3_rust_future_poll_rust_buffer,
completeFunc: ffi_xmtpv3_rust_future_complete_rust_buffer,
freeFunc: ffi_xmtpv3_rust_future_free_rust_buffer,
liftFunc: FfiConverterSequenceTypeFfiConversationListItem.lift,
errorHandler: FfiConverterTypeGenericError.lift
)
}

open func listDms(opts: FfiListConversationsOptions) async throws -> [FfiConversation] {
return
try await uniffiRustCallAsync(
Expand Down Expand Up @@ -7082,6 +7199,31 @@ private struct FfiConverterSequenceTypeFfiConversation: FfiConverterRustBuffer {
}
}

#if swift(>=5.8)
@_documentation(visibility: private)
#endif
private struct FfiConverterSequenceTypeFfiConversationListItem: FfiConverterRustBuffer {
typealias SwiftType = [FfiConversationListItem]

public static func write(_ value: [FfiConversationListItem], into buf: inout [UInt8]) {
let len = Int32(value.count)
writeInt(&buf, len)
for item in value {
FfiConverterTypeFfiConversationListItem.write(item, into: &buf)
}
}

public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> [FfiConversationListItem] {
let len: Int32 = try readInt(&buf)
var seq = [FfiConversationListItem]()
seq.reserveCapacity(Int(len))
for _ in 0 ..< len {
try seq.append(FfiConverterTypeFfiConversationListItem.read(from: &buf))
}
return seq
}
}

#if swift(>=5.8)
@_documentation(visibility: private)
#endif
Expand Down Expand Up @@ -7840,6 +7982,9 @@ private var initializationResult: InitializationResult = {
if uniffi_xmtpv3_checksum_method_fficonversations_list() != 42790 {
return InitializationResult.apiChecksumMismatch
}
if uniffi_xmtpv3_checksum_method_fficonversations_list_conversations() != 29098 {
return InitializationResult.apiChecksumMismatch
}
if uniffi_xmtpv3_checksum_method_fficonversations_list_dms() != 41576 {
return InitializationResult.apiChecksumMismatch
}
Expand Down

0 comments on commit 0e0222e

Please sign in to comment.