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 libxmtp #21

Merged
merged 2 commits into from
Apr 9, 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.4.3-beta4'
s.version = '0.4.3-beta5'
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, '13.0', :macos, '11.0'
s.swift_version = '5.3'

s.source = { :http => "https://github.com/xmtp/libxmtp/releases/download/swift-bindings-2f16634/LibXMTPSwiftFFI.zip", :type => :zip }
s.source = { :http => "https://github.com/xmtp/libxmtp/releases/download/swift-bindings-4326e61/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-2f16634/LibXMTPSwiftFFI.zip",
checksum: "dfcaff3e3ce070ccb34864ce053399fed28dfb222144205bea11412e74293aa5"
url: "https://github.com/xmtp/libxmtp/releases/download/swift-bindings-4326e61/LibXMTPSwiftFFI.zip",
checksum: "2da0273908daca4b7950b0d150043f538d09fd6dc56cfb108b8d931663c25738"
),
.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: 540e682
Version: 4326e61
Branch: main
Date: 2024-03-31 18:21:03 +0000
Date: 2024-04-08 21:19:59 +0000
54 changes: 52 additions & 2 deletions Sources/LibXMTP/xmtpv3.swift
Original file line number Diff line number Diff line change
Expand Up @@ -1602,15 +1602,17 @@ public struct FfiMessage {
public var convoId: Data
public var addrFrom: String
public var content: Data
public var kind: FfiGroupMessageKind

// Default memberwise initializers are never public by default, so we
// declare one manually.
public init(id: Data, sentAtNs: Int64, convoId: Data, addrFrom: String, content: Data) {
public init(id: Data, sentAtNs: Int64, convoId: Data, addrFrom: String, content: Data, kind: FfiGroupMessageKind) {
self.id = id
self.sentAtNs = sentAtNs
self.convoId = convoId
self.addrFrom = addrFrom
self.content = content
self.kind = kind
}
}

Expand All @@ -1631,6 +1633,9 @@ extension FfiMessage: Equatable, Hashable {
if lhs.content != rhs.content {
return false
}
if lhs.kind != rhs.kind {
return false
}
return true
}

Expand All @@ -1640,6 +1645,7 @@ extension FfiMessage: Equatable, Hashable {
hasher.combine(convoId)
hasher.combine(addrFrom)
hasher.combine(content)
hasher.combine(kind)
}
}

Expand All @@ -1650,7 +1656,8 @@ public struct FfiConverterTypeFfiMessage: FfiConverterRustBuffer {
sentAtNs: FfiConverterInt64.read(from: &buf),
convoId: FfiConverterData.read(from: &buf),
addrFrom: FfiConverterString.read(from: &buf),
content: FfiConverterData.read(from: &buf)
content: FfiConverterData.read(from: &buf),
kind: FfiConverterTypeFfiGroupMessageKind.read(from: &buf)
)
}

Expand All @@ -1660,6 +1667,7 @@ public struct FfiConverterTypeFfiMessage: FfiConverterRustBuffer {
FfiConverterData.write(value.convoId, into: &buf)
FfiConverterString.write(value.addrFrom, into: &buf)
FfiConverterData.write(value.content, into: &buf)
FfiConverterTypeFfiGroupMessageKind.write(value.kind, into: &buf)
}
}

Expand Down Expand Up @@ -2020,6 +2028,48 @@ public func FfiConverterTypeFfiV2SubscribeRequest_lower(_ value: FfiV2SubscribeR
return FfiConverterTypeFfiV2SubscribeRequest.lower(value)
}

// Note that we don't yet support `indirect` for enums.
// See https://github.com/mozilla/uniffi-rs/issues/396 for further discussion.
public enum FfiGroupMessageKind {
case application
case membershipChange
}

public struct FfiConverterTypeFfiGroupMessageKind: FfiConverterRustBuffer {
typealias SwiftType = FfiGroupMessageKind

public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> FfiGroupMessageKind {
let variant: Int32 = try readInt(&buf)
switch variant {
case 1: return .application

case 2: return .membershipChange

default: throw UniffiInternalError.unexpectedEnumCase
}
}

public static func write(_ value: FfiGroupMessageKind, into buf: inout [UInt8]) {
switch value {
case .application:
writeInt(&buf, Int32(1))

case .membershipChange:
writeInt(&buf, Int32(2))
}
}
}

public func FfiConverterTypeFfiGroupMessageKind_lift(_ buf: RustBuffer) throws -> FfiGroupMessageKind {
return try FfiConverterTypeFfiGroupMessageKind.lift(buf)
}

public func FfiConverterTypeFfiGroupMessageKind_lower(_ value: FfiGroupMessageKind) -> RustBuffer {
return FfiConverterTypeFfiGroupMessageKind.lower(value)
}

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 FfiSortDirection {
Expand Down