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

Bump bindings for sync fix #88

Merged
merged 2 commits into from
Dec 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
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
4 changes: 2 additions & 2 deletions LibXMTP.podspec
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Pod::Spec.new do |s|
s.name = 'LibXMTP'
s.version = '3.0.9'
s.version = '3.0.10'
s.summary = 'XMTP shared Rust code that powers cross-platform SDKs'

s.homepage = 'https://github.com/xmtp/libxmtp-swift'
Expand All @@ -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-3acc160/LibXMTPSwiftFFI.zip", :type => :zip }
s.source = { :http => "https://github.com/xmtp/libxmtp/releases/download/swift-bindings-3103e7b/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-3acc160/LibXMTPSwiftFFI.zip",
checksum: "bc6c2d2e9774157f0d45dd6944ffeb566fa5ea8dc9cf2cc5334f54c0bc7dd432"
url: "https://github.com/xmtp/libxmtp/releases/download/swift-bindings-3103e7b/LibXMTPSwiftFFI.zip",
checksum: "14642542b669be898ded997aaa7ea7e7a9aaf6801dfbbc1d702c2d88858b5048"
),
.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: 4620d939
Version: 3103e7b9
Branch: main
Date: 2024-12-04 00:01:39 +0000
Date: 2024-12-05 00:24:03 +0000
131 changes: 11 additions & 120 deletions Sources/LibXMTP/xmtpv3.swift
Original file line number Diff line number Diff line change
Expand Up @@ -3302,7 +3302,7 @@ public protocol FfiXmtpClientProtocol: AnyObject {
/**
* Starts the sync worker if the history sync url is present.
*/
func maybeStartSyncWorker() async throws
func maybeStartSyncWorker()

func message(messageId: Data) throws -> FfiMessage

Expand Down Expand Up @@ -3584,20 +3584,9 @@ open class FfiXmtpClient:
/**
* Starts the sync worker if the history sync url is present.
*/
open func maybeStartSyncWorker() async throws {
return
try await uniffiRustCallAsync(
rustFutureFunc: {
uniffi_xmtpv3_fn_method_ffixmtpclient_maybe_start_sync_worker(
self.uniffiClonePointer()
)
},
pollFunc: ffi_xmtpv3_rust_future_poll_void,
completeFunc: ffi_xmtpv3_rust_future_complete_void,
freeFunc: ffi_xmtpv3_rust_future_free_void,
liftFunc: { $0 },
errorHandler: FfiConverterTypeGenericError.lift
)
open func maybeStartSyncWorker() { try! rustCall {
uniffi_xmtpv3_fn_method_ffixmtpclient_maybe_start_sync_worker(self.uniffiClonePointer(), $0)
}
}

open func message(messageId: Data) throws -> FfiMessage {
Expand Down Expand Up @@ -6201,100 +6190,6 @@ extension FfiConverterCallbackInterfaceFfiInboxOwner: FfiConverter {
}
}

public protocol FfiLogger: AnyObject {
func log(level: UInt32, levelLabel: String, message: String)
}

// Put the implementation in a struct so we don't pollute the top-level namespace
private enum UniffiCallbackInterfaceFfiLogger {
// Create the VTable using a series of closures.
// Swift automatically converts these into C callback functions.
static var vtable: UniffiVTableCallbackInterfaceFfiLogger = .init(
log: { (
uniffiHandle: UInt64,
level: UInt32,
levelLabel: RustBuffer,
message: RustBuffer,
_: UnsafeMutableRawPointer,
uniffiCallStatus: UnsafeMutablePointer<RustCallStatus>
) in
let makeCall = {
() throws in
guard let uniffiObj = try? FfiConverterCallbackInterfaceFfiLogger.handleMap.get(handle: uniffiHandle) else {
throw UniffiInternalError.unexpectedStaleHandle
}
return try uniffiObj.log(
level: FfiConverterUInt32.lift(level),
levelLabel: FfiConverterString.lift(levelLabel),
message: FfiConverterString.lift(message)
)
}

let writeReturn = { () }
uniffiTraitInterfaceCall(
callStatus: uniffiCallStatus,
makeCall: makeCall,
writeReturn: writeReturn
)
},
uniffiFree: { (uniffiHandle: UInt64) in
let result = try? FfiConverterCallbackInterfaceFfiLogger.handleMap.remove(handle: uniffiHandle)
if result == nil {
print("Uniffi callback interface FfiLogger: handle missing in uniffiFree")
}
}
)
}

private func uniffiCallbackInitFfiLogger() {
uniffi_xmtpv3_fn_init_callback_vtable_ffilogger(&UniffiCallbackInterfaceFfiLogger.vtable)
}

// FfiConverter protocol for callback interfaces
#if swift(>=5.8)
@_documentation(visibility: private)
#endif
private enum FfiConverterCallbackInterfaceFfiLogger {
fileprivate static var handleMap = UniffiHandleMap<FfiLogger>()
}

#if swift(>=5.8)
@_documentation(visibility: private)
#endif
extension FfiConverterCallbackInterfaceFfiLogger: FfiConverter {
typealias SwiftType = FfiLogger
typealias FfiType = UInt64

#if swift(>=5.8)
@_documentation(visibility: private)
#endif
public static func lift(_ handle: UInt64) throws -> SwiftType {
try handleMap.get(handle: handle)
}

#if swift(>=5.8)
@_documentation(visibility: private)
#endif
public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> SwiftType {
let handle: UInt64 = try readInt(&buf)
return try lift(handle)
}

#if swift(>=5.8)
@_documentation(visibility: private)
#endif
public static func lower(_ v: SwiftType) -> UInt64 {
return handleMap.insert(obj: v)
}

#if swift(>=5.8)
@_documentation(visibility: private)
#endif
public static func write(_ v: SwiftType, into buf: inout [UInt8]) {
writeInt(&buf, lower(v))
}
}

#if swift(>=5.8)
@_documentation(visibility: private)
#endif
Expand Down Expand Up @@ -6976,11 +6871,11 @@ private func uniffiFutureContinuationCallback(handle: UInt64, pollResult: Int8)
* xmtp.create_client(account_address, nonce, inbox_id, Option<legacy_signed_private_key_proto>)
* ```
*/
public func createClient(logger: FfiLogger, host: String, isSecure: Bool, db: String?, encryptionKey: Data?, inboxId: String, accountAddress: String, nonce: UInt64, legacySignedPrivateKeyProto: Data?, historySyncUrl: String?) async throws -> FfiXmtpClient {
public func createClient(host: String, isSecure: Bool, db: String?, encryptionKey: Data?, inboxId: String, accountAddress: String, nonce: UInt64, legacySignedPrivateKeyProto: Data?, historySyncUrl: String?) async throws -> FfiXmtpClient {
return
try await uniffiRustCallAsync(
rustFutureFunc: {
uniffi_xmtpv3_fn_func_create_client(FfiConverterCallbackInterfaceFfiLogger.lower(logger), FfiConverterString.lower(host), FfiConverterBool.lower(isSecure), FfiConverterOptionString.lower(db), FfiConverterOptionData.lower(encryptionKey), FfiConverterString.lower(inboxId), FfiConverterString.lower(accountAddress), FfiConverterUInt64.lower(nonce), FfiConverterOptionData.lower(legacySignedPrivateKeyProto), FfiConverterOptionString.lower(historySyncUrl))
uniffi_xmtpv3_fn_func_create_client(FfiConverterString.lower(host), FfiConverterBool.lower(isSecure), FfiConverterOptionString.lower(db), FfiConverterOptionData.lower(encryptionKey), FfiConverterString.lower(inboxId), FfiConverterString.lower(accountAddress), FfiConverterUInt64.lower(nonce), FfiConverterOptionData.lower(legacySignedPrivateKeyProto), FfiConverterOptionString.lower(historySyncUrl))
},
pollFunc: ffi_xmtpv3_rust_future_poll_pointer,
completeFunc: ffi_xmtpv3_rust_future_complete_pointer,
Expand Down Expand Up @@ -7030,11 +6925,11 @@ public func generatePrivatePreferencesTopicIdentifier(privateKey: Data) throws -
})
}

public func getInboxIdForAddress(logger: FfiLogger, host: String, isSecure: Bool, accountAddress: String) async throws -> String? {
public func getInboxIdForAddress(host: String, isSecure: Bool, accountAddress: String) async throws -> String? {
return
try await uniffiRustCallAsync(
rustFutureFunc: {
uniffi_xmtpv3_fn_func_get_inbox_id_for_address(FfiConverterCallbackInterfaceFfiLogger.lower(logger), FfiConverterString.lower(host), FfiConverterBool.lower(isSecure), FfiConverterString.lower(accountAddress))
uniffi_xmtpv3_fn_func_get_inbox_id_for_address(FfiConverterString.lower(host), FfiConverterBool.lower(isSecure), FfiConverterString.lower(accountAddress))
},
pollFunc: ffi_xmtpv3_rust_future_poll_rust_buffer,
completeFunc: ffi_xmtpv3_rust_future_complete_rust_buffer,
Expand Down Expand Up @@ -7149,7 +7044,7 @@ private var initializationResult: InitializationResult = {
if bindings_contract_version != scaffolding_contract_version {
return InitializationResult.contractVersionMismatch
}
if uniffi_xmtpv3_checksum_func_create_client() != 6255 {
if uniffi_xmtpv3_checksum_func_create_client() != 50509 {
return InitializationResult.apiChecksumMismatch
}
if uniffi_xmtpv3_checksum_func_create_v2_client() != 48060 {
Expand All @@ -7164,7 +7059,7 @@ private var initializationResult: InitializationResult = {
if uniffi_xmtpv3_checksum_func_generate_private_preferences_topic_identifier() != 59124 {
return InitializationResult.apiChecksumMismatch
}
if uniffi_xmtpv3_checksum_func_get_inbox_id_for_address() != 36898 {
if uniffi_xmtpv3_checksum_func_get_inbox_id_for_address() != 35414 {
return InitializationResult.apiChecksumMismatch
}
if uniffi_xmtpv3_checksum_func_get_version_info() != 29277 {
Expand Down Expand Up @@ -7491,7 +7386,7 @@ private var initializationResult: InitializationResult = {
if uniffi_xmtpv3_checksum_method_ffixmtpclient_installation_id() != 37173 {
return InitializationResult.apiChecksumMismatch
}
if uniffi_xmtpv3_checksum_method_ffixmtpclient_maybe_start_sync_worker() != 27018 {
if uniffi_xmtpv3_checksum_method_ffixmtpclient_maybe_start_sync_worker() != 56811 {
return InitializationResult.apiChecksumMismatch
}
if uniffi_xmtpv3_checksum_method_ffixmtpclient_message() != 26932 {
Expand Down Expand Up @@ -7533,16 +7428,12 @@ private var initializationResult: InitializationResult = {
if uniffi_xmtpv3_checksum_method_ffiinboxowner_sign() != 30268 {
return InitializationResult.apiChecksumMismatch
}
if uniffi_xmtpv3_checksum_method_ffilogger_log() != 56011 {
return InitializationResult.apiChecksumMismatch
}

uniffiCallbackInitFfiConsentCallback()
uniffiCallbackInitFfiConversationCallback()
uniffiCallbackInitFfiMessageCallback()
uniffiCallbackInitFfiV2SubscriptionCallback()
uniffiCallbackInitFfiInboxOwner()
uniffiCallbackInitFfiLogger()
return InitializationResult.ok
}()

Expand Down