diff --git a/LibXMTP.podspec b/LibXMTP.podspec index fe944b1..2435839 100644 --- a/LibXMTP.podspec +++ b/LibXMTP.podspec @@ -10,7 +10,7 @@ Pod::Spec.new do |s| s.platform = :ios, '13.0', :macos, '11.0' s.swift_version = '5.3' - s.source = { :http => "https://github.com/xmtp/libxmtp/releases/download/swift-bindings-c86272d/LibXMTPSwiftFFI.zip", :type => :zip } + s.source = { :http => "https://github.com/xmtp/libxmtp/releases/download/swift-bindings-bd8360b/LibXMTPSwiftFFI.zip", :type => :zip } s.vendored_frameworks = 'LibXMTPSwiftFFI.xcframework' s.source_files = 'Sources/LibXMTP/**/*' end diff --git a/Package.swift b/Package.swift index abe8757..c76352d 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-c86272d/LibXMTPSwiftFFI.zip", - checksum: "c9a5fdc8ffc936f1f3901cb3cb3aedea06782a68d962ef498696fd7e4f888c48" + url: "https://github.com/xmtp/libxmtp/releases/download/swift-bindings-bd8360b/LibXMTPSwiftFFI.zip", + checksum: "90928c0849706499a8ec034c0bd19858b50edafa08c1ab22945656d6b002cd5e" ), .testTarget(name: "LibXMTPTests", dependencies: ["LibXMTP"]), ] diff --git a/Sources/LibXMTP/libxmtp-version.txt b/Sources/LibXMTP/libxmtp-version.txt index 691b263..30a52b7 100644 --- a/Sources/LibXMTP/libxmtp-version.txt +++ b/Sources/LibXMTP/libxmtp-version.txt @@ -1,3 +1,3 @@ -Version: c86272d -Branch: HEAD -Date: 2024-05-28 21:11:59 +0000 +Version: bd8360b +Branch: main +Date: 2024-05-29 16:47:55 +0000 diff --git a/Sources/LibXMTP/xmtpv3.swift b/Sources/LibXMTP/xmtpv3.swift index 9d7402d..56c8b5d 100644 --- a/Sources/LibXMTP/xmtpv3.swift +++ b/Sources/LibXMTP/xmtpv3.swift @@ -2160,13 +2160,15 @@ public struct FfiGroupMember { public var inboxId: String public var accountAddresses: [String] public var installationIds: [Data] + public var permissionLevel: FfiPermissionLevel // Default memberwise initializers are never public by default, so we // declare one manually. - public init(inboxId: String, accountAddresses: [String], installationIds: [Data]) { + public init(inboxId: String, accountAddresses: [String], installationIds: [Data], permissionLevel: FfiPermissionLevel) { self.inboxId = inboxId self.accountAddresses = accountAddresses self.installationIds = installationIds + self.permissionLevel = permissionLevel } } @@ -2181,6 +2183,9 @@ extension FfiGroupMember: Equatable, Hashable { if lhs.installationIds != rhs.installationIds { return false } + if lhs.permissionLevel != rhs.permissionLevel { + return false + } return true } @@ -2188,6 +2193,7 @@ extension FfiGroupMember: Equatable, Hashable { hasher.combine(inboxId) hasher.combine(accountAddresses) hasher.combine(installationIds) + hasher.combine(permissionLevel) } } @@ -2197,7 +2203,8 @@ public struct FfiConverterTypeFfiGroupMember: FfiConverterRustBuffer { try FfiGroupMember( inboxId: FfiConverterString.read(from: &buf), accountAddresses: FfiConverterSequenceString.read(from: &buf), - installationIds: FfiConverterSequenceData.read(from: &buf) + installationIds: FfiConverterSequenceData.read(from: &buf), + permissionLevel: FfiConverterTypeFfiPermissionLevel.read(from: &buf) ) } @@ -2205,6 +2212,7 @@ public struct FfiConverterTypeFfiGroupMember: FfiConverterRustBuffer { FfiConverterString.write(value.inboxId, into: &buf) FfiConverterSequenceString.write(value.accountAddresses, into: &buf) FfiConverterSequenceData.write(value.installationIds, into: &buf) + FfiConverterTypeFfiPermissionLevel.write(value.permissionLevel, into: &buf) } } @@ -2887,6 +2895,55 @@ extension FfiGroupMessageKind: Equatable, Hashable {} // Note that we don't yet support `indirect` for enums. // See https://github.com/mozilla/uniffi-rs/issues/396 for further discussion. +public enum FfiPermissionLevel { + case member + case admin + case superAdmin +} + +public struct FfiConverterTypeFfiPermissionLevel: FfiConverterRustBuffer { + typealias SwiftType = FfiPermissionLevel + + public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> FfiPermissionLevel { + let variant: Int32 = try readInt(&buf) + switch variant { + case 1: return .member + + case 2: return .admin + + case 3: return .superAdmin + + default: throw UniffiInternalError.unexpectedEnumCase + } + } + + public static func write(_ value: FfiPermissionLevel, into buf: inout [UInt8]) { + switch value { + case .member: + writeInt(&buf, Int32(1)) + + case .admin: + writeInt(&buf, Int32(2)) + + case .superAdmin: + writeInt(&buf, Int32(3)) + } + } +} + +public func FfiConverterTypeFfiPermissionLevel_lift(_ buf: RustBuffer) throws -> FfiPermissionLevel { + return try FfiConverterTypeFfiPermissionLevel.lift(buf) +} + +public func FfiConverterTypeFfiPermissionLevel_lower(_ value: FfiPermissionLevel) -> RustBuffer { + return FfiConverterTypeFfiPermissionLevel.lower(value) +} + +extension FfiPermissionLevel: Equatable, Hashable {} + +// Note that we don't yet support `indirect` for enums. +// See https://github.com/mozilla/uniffi-rs/issues/396 for further discussion. + public enum FfiSortDirection { case unspecified case ascending