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

Adding pinned frame metadata field #43

Merged
merged 1 commit into from
Jul 3, 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 = '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'
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-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
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-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"]),
]
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: e4cfade7
Version: 5c78fbad
Branch: main
Date: 2024-07-01 19:23:57 +0000
Date: 2024-07-03 01:23:38 +0000
63 changes: 59 additions & 4 deletions Sources/LibXMTP/xmtpv3.swift
Original file line number Diff line number Diff line change
Expand Up @@ -727,6 +727,8 @@ public protocol FfiGroupProtocol: AnyObject {

func groupPermissions() throws -> FfiGroupPermissions

func groupPinnedFrameUrl() throws -> String

func id() -> Data

func isActive() throws -> Bool
Expand Down Expand Up @@ -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
}

Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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(
Expand Down Expand Up @@ -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
}
}

Expand All @@ -2256,6 +2285,9 @@ extension FfiCreateGroupOptions: Equatable, Hashable {
if lhs.groupDescription != rhs.groupDescription {
return false
}
if lhs.groupPinnedFrameUrl != rhs.groupPinnedFrameUrl {
return false
}
return true
}

Expand All @@ -2264,6 +2296,7 @@ extension FfiCreateGroupOptions: Equatable, Hashable {
hasher.combine(groupName)
hasher.combine(groupImageUrlSquare)
hasher.combine(groupDescription)
hasher.combine(groupPinnedFrameUrl)
}
}

Expand All @@ -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)
)
}

Expand All @@ -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)
}
}

Expand Down Expand Up @@ -2762,17 +2797,19 @@ 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
self.removeAdminPolicy = removeAdminPolicy
self.updateGroupNamePolicy = updateGroupNamePolicy
self.updateGroupDescriptionPolicy = updateGroupDescriptionPolicy
self.updateGroupImageUrlSquarePolicy = updateGroupImageUrlSquarePolicy
self.updateGroupPinnedFrameUrlPolicy = updateGroupPinnedFrameUrlPolicy
}
}

Expand All @@ -2799,6 +2836,9 @@ extension FfiPermissionPolicySet: Equatable, Hashable {
if lhs.updateGroupImageUrlSquarePolicy != rhs.updateGroupImageUrlSquarePolicy {
return false
}
if lhs.updateGroupPinnedFrameUrlPolicy != rhs.updateGroupPinnedFrameUrlPolicy {
return false
}
return true
}

Expand All @@ -2810,6 +2850,7 @@ extension FfiPermissionPolicySet: Equatable, Hashable {
hasher.combine(updateGroupNamePolicy)
hasher.combine(updateGroupDescriptionPolicy)
hasher.combine(updateGroupImageUrlSquarePolicy)
hasher.combine(updateGroupPinnedFrameUrlPolicy)
}
}

Expand All @@ -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)
)
}

Expand All @@ -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)
}
}

Expand Down Expand Up @@ -3290,6 +3333,7 @@ public enum FfiMetadataField {
case groupName
case description
case imageUrlSquare
case pinnedFrameUrl
}

public struct FfiConverterTypeFfiMetadataField: FfiConverterRustBuffer {
Expand All @@ -3304,6 +3348,8 @@ public struct FfiConverterTypeFfiMetadataField: FfiConverterRustBuffer {

case 3: return .imageUrlSquare

case 4: return .pinnedFrameUrl

default: throw UniffiInternalError.unexpectedEnumCase
}
}
Expand All @@ -3318,6 +3364,9 @@ public struct FfiConverterTypeFfiMetadataField: FfiConverterRustBuffer {

case .imageUrlSquare:
writeInt(&buf, Int32(3))

case .pinnedFrameUrl:
writeInt(&buf, Int32(4))
}
}
}
Expand Down Expand Up @@ -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
}
Expand Down Expand Up @@ -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
}
Expand Down