From 6b7659021b7a9ddc83d7bbb319f5524b434f2104 Mon Sep 17 00:00:00 2001 From: cameronvoell Date: Tue, 2 Jul 2024 18:40:44 -0700 Subject: [PATCH] new pinned frame url field --- LibXMTP.podspec | 4 +- Package.swift | 4 +- Sources/LibXMTP/libxmtp-version.txt | 4 +- Sources/LibXMTP/xmtpv3.swift | 63 +++++++++++++++++++++++++++-- 4 files changed, 65 insertions(+), 10 deletions(-) diff --git a/LibXMTP.podspec b/LibXMTP.podspec index 22df4d3..d711bbc 100644 --- a/LibXMTP.podspec +++ b/LibXMTP.podspec @@ -1,6 +1,6 @@ Pod::Spec.new do |s| s.name = 'LibXMTP' - s.version = '0.5.4-beta1' + s.version = '0.5.4-beta2' s.summary = 'XMTP shared Rust code that powers cross-platform SDKs' s.homepage = 'https://github.com/xmtp/libxmtp-swift' @@ -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-e4cfade/LibXMTPSwiftFFI.zip", :type => :zip } + s.source = { :http => "https://github.com/xmtp/libxmtp/releases/download/swift-bindings-5c78fba/LibXMTPSwiftFFI.zip", :type => :zip } s.vendored_frameworks = 'LibXMTPSwiftFFI.xcframework' s.source_files = 'Sources/LibXMTP/**/*' end diff --git a/Package.swift b/Package.swift index 4d98e4b..08eb8bb 100644 --- a/Package.swift +++ b/Package.swift @@ -27,8 +27,8 @@ let package = Package( ), .binaryTarget( name: "LibXMTPSwiftFFI", - url: "https://github.com/xmtp/libxmtp/releases/download/swift-bindings-e4cfade/LibXMTPSwiftFFI.zip", - checksum: "4c0e1dce47d8dc846a134b3d7c3997a10de066707c64655e9302a7e48fad9ff9" + url: "https://github.com/xmtp/libxmtp/releases/download/swift-bindings-5c78fba/LibXMTPSwiftFFI.zip", + checksum: "eb967303095d389701f957c5fd9f2e72eafddd5ae71bdd249a6dab26dfc30fb9" ), .testTarget(name: "LibXMTPTests", dependencies: ["LibXMTP"]), ] diff --git a/Sources/LibXMTP/libxmtp-version.txt b/Sources/LibXMTP/libxmtp-version.txt index 0cd9cfe..cd7d5fb 100644 --- a/Sources/LibXMTP/libxmtp-version.txt +++ b/Sources/LibXMTP/libxmtp-version.txt @@ -1,3 +1,3 @@ -Version: e4cfade7 +Version: 5c78fbad Branch: main -Date: 2024-07-01 19:23:57 +0000 +Date: 2024-07-03 01:23:38 +0000 diff --git a/Sources/LibXMTP/xmtpv3.swift b/Sources/LibXMTP/xmtpv3.swift index a796980..561784b 100644 --- a/Sources/LibXMTP/xmtpv3.swift +++ b/Sources/LibXMTP/xmtpv3.swift @@ -727,6 +727,8 @@ public protocol FfiGroupProtocol: AnyObject { func groupPermissions() throws -> FfiGroupPermissions + func groupPinnedFrameUrl() throws -> String + func id() -> Data func isActive() throws -> Bool @@ -761,6 +763,8 @@ public protocol FfiGroupProtocol: AnyObject { func updateGroupName(groupName: String) async throws + func updateGroupPinnedFrameUrl(pinnedFrameUrl: String) async throws + func updatePermissionPolicy(permissionUpdateType: FfiPermissionUpdateType, permissionPolicyOption: FfiPermissionPolicy, metadataField: FfiMetadataField?) async throws } @@ -927,6 +931,12 @@ open class FfiGroup: }) } + open func groupPinnedFrameUrl() throws -> String { + return try FfiConverterString.lift(rustCallWithError(FfiConverterTypeGenericError.lift) { + uniffi_xmtpv3_fn_method_ffigroup_group_pinned_frame_url(self.uniffiClonePointer(), $0) + }) + } + open func id() -> Data { return try! FfiConverterData.lift(try! rustCall { uniffi_xmtpv3_fn_method_ffigroup_id(self.uniffiClonePointer(), $0) @@ -1151,6 +1161,23 @@ open class FfiGroup: ) } + open func updateGroupPinnedFrameUrl(pinnedFrameUrl: String) async throws { + return + try await uniffiRustCallAsync( + rustFutureFunc: { + uniffi_xmtpv3_fn_method_ffigroup_update_group_pinned_frame_url( + self.uniffiClonePointer(), + FfiConverterString.lower(pinnedFrameUrl) + ) + }, + 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 updatePermissionPolicy(permissionUpdateType: FfiPermissionUpdateType, permissionPolicyOption: FfiPermissionPolicy, metadataField: FfiMetadataField?) async throws { return try await uniffiRustCallAsync( @@ -2231,14 +2258,16 @@ public struct FfiCreateGroupOptions { public var groupName: String? public var groupImageUrlSquare: String? public var groupDescription: String? + public var groupPinnedFrameUrl: String? // Default memberwise initializers are never public by default, so we // declare one manually. - public init(permissions: FfiGroupPermissionsOptions?, groupName: String?, groupImageUrlSquare: String?, groupDescription: String?) { + public init(permissions: FfiGroupPermissionsOptions?, groupName: String?, groupImageUrlSquare: String?, groupDescription: String?, groupPinnedFrameUrl: String?) { self.permissions = permissions self.groupName = groupName self.groupImageUrlSquare = groupImageUrlSquare self.groupDescription = groupDescription + self.groupPinnedFrameUrl = groupPinnedFrameUrl } } @@ -2256,6 +2285,9 @@ extension FfiCreateGroupOptions: Equatable, Hashable { if lhs.groupDescription != rhs.groupDescription { return false } + if lhs.groupPinnedFrameUrl != rhs.groupPinnedFrameUrl { + return false + } return true } @@ -2264,6 +2296,7 @@ extension FfiCreateGroupOptions: Equatable, Hashable { hasher.combine(groupName) hasher.combine(groupImageUrlSquare) hasher.combine(groupDescription) + hasher.combine(groupPinnedFrameUrl) } } @@ -2274,7 +2307,8 @@ public struct FfiConverterTypeFfiCreateGroupOptions: FfiConverterRustBuffer { permissions: FfiConverterOptionTypeFfiGroupPermissionsOptions.read(from: &buf), groupName: FfiConverterOptionString.read(from: &buf), groupImageUrlSquare: FfiConverterOptionString.read(from: &buf), - groupDescription: FfiConverterOptionString.read(from: &buf) + groupDescription: FfiConverterOptionString.read(from: &buf), + groupPinnedFrameUrl: FfiConverterOptionString.read(from: &buf) ) } @@ -2283,6 +2317,7 @@ public struct FfiConverterTypeFfiCreateGroupOptions: FfiConverterRustBuffer { FfiConverterOptionString.write(value.groupName, into: &buf) FfiConverterOptionString.write(value.groupImageUrlSquare, into: &buf) FfiConverterOptionString.write(value.groupDescription, into: &buf) + FfiConverterOptionString.write(value.groupPinnedFrameUrl, into: &buf) } } @@ -2762,10 +2797,11 @@ public struct FfiPermissionPolicySet { public var updateGroupNamePolicy: FfiPermissionPolicy public var updateGroupDescriptionPolicy: FfiPermissionPolicy public var updateGroupImageUrlSquarePolicy: FfiPermissionPolicy + public var updateGroupPinnedFrameUrlPolicy: FfiPermissionPolicy // Default memberwise initializers are never public by default, so we // declare one manually. - public init(addMemberPolicy: FfiPermissionPolicy, removeMemberPolicy: FfiPermissionPolicy, addAdminPolicy: FfiPermissionPolicy, removeAdminPolicy: FfiPermissionPolicy, updateGroupNamePolicy: FfiPermissionPolicy, updateGroupDescriptionPolicy: FfiPermissionPolicy, updateGroupImageUrlSquarePolicy: FfiPermissionPolicy) { + public init(addMemberPolicy: FfiPermissionPolicy, removeMemberPolicy: FfiPermissionPolicy, addAdminPolicy: FfiPermissionPolicy, removeAdminPolicy: FfiPermissionPolicy, updateGroupNamePolicy: FfiPermissionPolicy, updateGroupDescriptionPolicy: FfiPermissionPolicy, updateGroupImageUrlSquarePolicy: FfiPermissionPolicy, updateGroupPinnedFrameUrlPolicy: FfiPermissionPolicy) { self.addMemberPolicy = addMemberPolicy self.removeMemberPolicy = removeMemberPolicy self.addAdminPolicy = addAdminPolicy @@ -2773,6 +2809,7 @@ public struct FfiPermissionPolicySet { self.updateGroupNamePolicy = updateGroupNamePolicy self.updateGroupDescriptionPolicy = updateGroupDescriptionPolicy self.updateGroupImageUrlSquarePolicy = updateGroupImageUrlSquarePolicy + self.updateGroupPinnedFrameUrlPolicy = updateGroupPinnedFrameUrlPolicy } } @@ -2799,6 +2836,9 @@ extension FfiPermissionPolicySet: Equatable, Hashable { if lhs.updateGroupImageUrlSquarePolicy != rhs.updateGroupImageUrlSquarePolicy { return false } + if lhs.updateGroupPinnedFrameUrlPolicy != rhs.updateGroupPinnedFrameUrlPolicy { + return false + } return true } @@ -2810,6 +2850,7 @@ extension FfiPermissionPolicySet: Equatable, Hashable { hasher.combine(updateGroupNamePolicy) hasher.combine(updateGroupDescriptionPolicy) hasher.combine(updateGroupImageUrlSquarePolicy) + hasher.combine(updateGroupPinnedFrameUrlPolicy) } } @@ -2823,7 +2864,8 @@ public struct FfiConverterTypeFfiPermissionPolicySet: FfiConverterRustBuffer { removeAdminPolicy: FfiConverterTypeFfiPermissionPolicy.read(from: &buf), updateGroupNamePolicy: FfiConverterTypeFfiPermissionPolicy.read(from: &buf), updateGroupDescriptionPolicy: FfiConverterTypeFfiPermissionPolicy.read(from: &buf), - updateGroupImageUrlSquarePolicy: FfiConverterTypeFfiPermissionPolicy.read(from: &buf) + updateGroupImageUrlSquarePolicy: FfiConverterTypeFfiPermissionPolicy.read(from: &buf), + updateGroupPinnedFrameUrlPolicy: FfiConverterTypeFfiPermissionPolicy.read(from: &buf) ) } @@ -2835,6 +2877,7 @@ public struct FfiConverterTypeFfiPermissionPolicySet: FfiConverterRustBuffer { FfiConverterTypeFfiPermissionPolicy.write(value.updateGroupNamePolicy, into: &buf) FfiConverterTypeFfiPermissionPolicy.write(value.updateGroupDescriptionPolicy, into: &buf) FfiConverterTypeFfiPermissionPolicy.write(value.updateGroupImageUrlSquarePolicy, into: &buf) + FfiConverterTypeFfiPermissionPolicy.write(value.updateGroupPinnedFrameUrlPolicy, into: &buf) } } @@ -3290,6 +3333,7 @@ public enum FfiMetadataField { case groupName case description case imageUrlSquare + case pinnedFrameUrl } public struct FfiConverterTypeFfiMetadataField: FfiConverterRustBuffer { @@ -3304,6 +3348,8 @@ public struct FfiConverterTypeFfiMetadataField: FfiConverterRustBuffer { case 3: return .imageUrlSquare + case 4: return .pinnedFrameUrl + default: throw UniffiInternalError.unexpectedEnumCase } } @@ -3318,6 +3364,9 @@ public struct FfiConverterTypeFfiMetadataField: FfiConverterRustBuffer { case .imageUrlSquare: writeInt(&buf, Int32(3)) + + case .pinnedFrameUrl: + writeInt(&buf, Int32(4)) } } } @@ -4828,6 +4877,9 @@ private var initializationResult: InitializationResult { if uniffi_xmtpv3_checksum_method_ffigroup_group_permissions() != 15980 { return InitializationResult.apiChecksumMismatch } + if uniffi_xmtpv3_checksum_method_ffigroup_group_pinned_frame_url() != 29388 { + return InitializationResult.apiChecksumMismatch + } if uniffi_xmtpv3_checksum_method_ffigroup_id() != 36764 { return InitializationResult.apiChecksumMismatch } @@ -4879,6 +4931,9 @@ private var initializationResult: InitializationResult { if uniffi_xmtpv3_checksum_method_ffigroup_update_group_name() != 550 { return InitializationResult.apiChecksumMismatch } + if uniffi_xmtpv3_checksum_method_ffigroup_update_group_pinned_frame_url() != 37434 { + return InitializationResult.apiChecksumMismatch + } if uniffi_xmtpv3_checksum_method_ffigroup_update_permission_policy() != 51936 { return InitializationResult.apiChecksumMismatch }