Skip to content

Commit 895ba54

Browse files
committed
Bump to version 25.04.16 (matrix-rust-sdk/main d36b2a6869d7e5960bf652daecba5ea2de8f1cbf)
1 parent 1f43ea9 commit 895ba54

File tree

2 files changed

+228
-15
lines changed

2 files changed

+228
-15
lines changed

Package.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
// swift-tools-version:5.9
22
// The swift-tools-version declares the minimum version of Swift required to build this package.
33
import PackageDescription
4-
let checksum = "052611e32528575fd50c22f3ed6e6cd6af9a8ea2d152a35b8dc45771ca395668"
5-
let version = "25.04.14"
4+
let checksum = "42e27cbd28cbcf13fb764eecb1bfb9a4763e5d97c007e9aa0296bebb8eec80d3"
5+
let version = "25.04.16"
66
let url = "https://github.com/element-hq/matrix-rust-components-swift/releases/download/\(version)/MatrixSDKFFI.xcframework.zip"
77
let package = Package(
88
name: "MatrixRustSDK",

Sources/MatrixRustSDK/matrix_sdk_ffi.swift

Lines changed: 226 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -10707,6 +10707,108 @@ public func FfiConverterTypeTaskHandle_lower(_ value: TaskHandle) -> UnsafeMutab
1070710707

1070810708

1070910709

10710+
public protocol ThreadSummaryProtocol : AnyObject {
10711+
10712+
func latestEvent() -> ThreadSummaryLatestEventDetails
10713+
10714+
}
10715+
10716+
open class ThreadSummary:
10717+
ThreadSummaryProtocol {
10718+
fileprivate let pointer: UnsafeMutableRawPointer!
10719+
10720+
/// Used to instantiate a [FFIObject] without an actual pointer, for fakes in tests, mostly.
10721+
public struct NoPointer {
10722+
public init() {}
10723+
}
10724+
10725+
// TODO: We'd like this to be `private` but for Swifty reasons,
10726+
// we can't implement `FfiConverter` without making this `required` and we can't
10727+
// make it `required` without making it `public`.
10728+
required public init(unsafeFromRawPointer pointer: UnsafeMutableRawPointer) {
10729+
self.pointer = pointer
10730+
}
10731+
10732+
/// This constructor can be used to instantiate a fake object.
10733+
/// - Parameter noPointer: Placeholder value so we can have a constructor separate from the default empty one that may be implemented for classes extending [FFIObject].
10734+
///
10735+
/// - Warning:
10736+
/// Any object instantiated with this constructor cannot be passed to an actual Rust-backed object. Since there isn't a backing [Pointer] the FFI lower functions will crash.
10737+
public init(noPointer: NoPointer) {
10738+
self.pointer = nil
10739+
}
10740+
10741+
public func uniffiClonePointer() -> UnsafeMutableRawPointer {
10742+
return try! rustCall { uniffi_matrix_sdk_ffi_fn_clone_threadsummary(self.pointer, $0) }
10743+
}
10744+
// No primary constructor declared for this class.
10745+
10746+
deinit {
10747+
guard let pointer = pointer else {
10748+
return
10749+
}
10750+
10751+
try! rustCall { uniffi_matrix_sdk_ffi_fn_free_threadsummary(pointer, $0) }
10752+
}
10753+
10754+
10755+
10756+
10757+
open func latestEvent() -> ThreadSummaryLatestEventDetails {
10758+
return try! FfiConverterTypeThreadSummaryLatestEventDetails.lift(try! rustCall() {
10759+
uniffi_matrix_sdk_ffi_fn_method_threadsummary_latest_event(self.uniffiClonePointer(),$0
10760+
)
10761+
})
10762+
}
10763+
10764+
10765+
}
10766+
10767+
public struct FfiConverterTypeThreadSummary: FfiConverter {
10768+
10769+
typealias FfiType = UnsafeMutableRawPointer
10770+
typealias SwiftType = ThreadSummary
10771+
10772+
public static func lift(_ pointer: UnsafeMutableRawPointer) throws -> ThreadSummary {
10773+
return ThreadSummary(unsafeFromRawPointer: pointer)
10774+
}
10775+
10776+
public static func lower(_ value: ThreadSummary) -> UnsafeMutableRawPointer {
10777+
return value.uniffiClonePointer()
10778+
}
10779+
10780+
public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> ThreadSummary {
10781+
let v: UInt64 = try readInt(&buf)
10782+
// The Rust code won't compile if a pointer won't fit in a UInt64.
10783+
// We have to go via `UInt` because that's the thing that's the size of a pointer.
10784+
let ptr = UnsafeMutableRawPointer(bitPattern: UInt(truncatingIfNeeded: v))
10785+
if (ptr == nil) {
10786+
throw UniffiInternalError.unexpectedNullPointer
10787+
}
10788+
return try lift(ptr!)
10789+
}
10790+
10791+
public static func write(_ value: ThreadSummary, into buf: inout [UInt8]) {
10792+
// This fiddling is because `Int` is the thing that's the same size as a pointer.
10793+
// The Rust code won't compile if a pointer won't fit in a `UInt64`.
10794+
writeInt(&buf, UInt64(bitPattern: Int64(Int(bitPattern: lower(value)))))
10795+
}
10796+
}
10797+
10798+
10799+
10800+
10801+
public func FfiConverterTypeThreadSummary_lift(_ pointer: UnsafeMutableRawPointer) throws -> ThreadSummary {
10802+
return try FfiConverterTypeThreadSummary.lift(pointer)
10803+
}
10804+
10805+
public func FfiConverterTypeThreadSummary_lower(_ value: ThreadSummary) -> UnsafeMutableRawPointer {
10806+
return FfiConverterTypeThreadSummary.lower(value)
10807+
}
10808+
10809+
10810+
10811+
1071010812
public protocol TimelineProtocol : AnyObject {
1071110813

1071210814
func addListener(listener: TimelineListener) async -> TaskHandle
@@ -14522,27 +14624,35 @@ public struct MsgLikeContent {
1452214624
public var kind: MsgLikeKind
1452314625
public var reactions: [Reaction]
1452414626
/**
14525-
* Event ID of the thread root, if this is a threaded message.
14627+
* The event this message is replying to, if any.
14628+
*/
14629+
public var inReplyTo: InReplyToDetails?
14630+
/**
14631+
* Event ID of the thread root, if this is a message in a thread.
1452614632
*/
1452714633
public var threadRoot: String?
1452814634
/**
14529-
* The event this message is replying to, if any.
14635+
* Details about the thread this message is the root of.
1453014636
*/
14531-
public var inReplyTo: InReplyToDetails?
14637+
public var threadSummary: ThreadSummary?
1453214638

1453314639
// Default memberwise initializers are never public by default, so we
1453414640
// declare one manually.
1453514641
public init(kind: MsgLikeKind, reactions: [Reaction],
1453614642
/**
14537-
* Event ID of the thread root, if this is a threaded message.
14643+
* The event this message is replying to, if any.
14644+
*/inReplyTo: InReplyToDetails?,
14645+
/**
14646+
* Event ID of the thread root, if this is a message in a thread.
1453814647
*/threadRoot: String?,
1453914648
/**
14540-
* The event this message is replying to, if any.
14541-
*/inReplyTo: InReplyToDetails?) {
14649+
* Details about the thread this message is the root of.
14650+
*/threadSummary: ThreadSummary?) {
1454214651
self.kind = kind
1454314652
self.reactions = reactions
14544-
self.threadRoot = threadRoot
1454514653
self.inReplyTo = inReplyTo
14654+
self.threadRoot = threadRoot
14655+
self.threadSummary = threadSummary
1454614656
}
1454714657
}
1454814658

@@ -14554,16 +14664,18 @@ public struct FfiConverterTypeMsgLikeContent: FfiConverterRustBuffer {
1455414664
try MsgLikeContent(
1455514665
kind: FfiConverterTypeMsgLikeKind.read(from: &buf),
1455614666
reactions: FfiConverterSequenceTypeReaction.read(from: &buf),
14667+
inReplyTo: FfiConverterOptionTypeInReplyToDetails.read(from: &buf),
1455714668
threadRoot: FfiConverterOptionString.read(from: &buf),
14558-
inReplyTo: FfiConverterOptionTypeInReplyToDetails.read(from: &buf)
14669+
threadSummary: FfiConverterOptionTypeThreadSummary.read(from: &buf)
1455914670
)
1456014671
}
1456114672

1456214673
public static func write(_ value: MsgLikeContent, into buf: inout [UInt8]) {
1456314674
FfiConverterTypeMsgLikeKind.write(value.kind, into: &buf)
1456414675
FfiConverterSequenceTypeReaction.write(value.reactions, into: &buf)
14565-
FfiConverterOptionString.write(value.threadRoot, into: &buf)
1456614676
FfiConverterOptionTypeInReplyToDetails.write(value.inReplyTo, into: &buf)
14677+
FfiConverterOptionString.write(value.threadRoot, into: &buf)
14678+
FfiConverterOptionTypeThreadSummary.write(value.threadSummary, into: &buf)
1456714679
}
1456814680
}
1456914681

@@ -27171,7 +27283,8 @@ public enum StateEventContent {
2717127283
case roomServerAcl
2717227284
case roomThirdPartyInvite
2717327285
case roomTombstone
27174-
case roomTopic
27286+
case roomTopic(topic: String
27287+
)
2717527288
case spaceChild
2717627289
case spaceParent
2717727290
}
@@ -27221,7 +27334,8 @@ public struct FfiConverterTypeStateEventContent: FfiConverterRustBuffer {
2722127334

2722227335
case 18: return .roomTombstone
2722327336

27224-
case 19: return .roomTopic
27337+
case 19: return .roomTopic(topic: try FfiConverterString.read(from: &buf)
27338+
)
2722527339

2722627340
case 20: return .spaceChild
2722727341

@@ -27309,9 +27423,10 @@ public struct FfiConverterTypeStateEventContent: FfiConverterRustBuffer {
2730927423
writeInt(&buf, Int32(18))
2731027424

2731127425

27312-
case .roomTopic:
27426+
case let .roomTopic(topic):
2731327427
writeInt(&buf, Int32(19))
27314-
27428+
FfiConverterString.write(topic, into: &buf)
27429+
2731527430

2731627431
case .spaceChild:
2731727432
writeInt(&buf, Int32(20))
@@ -27678,6 +27793,80 @@ extension SyncServiceState: Equatable, Hashable {}
2767827793

2767927794

2768027795

27796+
// Note that we don't yet support `indirect` for enums.
27797+
// See https://github.com/mozilla/uniffi-rs/issues/396 for further discussion.
27798+
27799+
public enum ThreadSummaryLatestEventDetails {
27800+
27801+
case unavailable
27802+
case pending
27803+
case ready(sender: String, senderProfile: ProfileDetails, content: TimelineItemContent
27804+
)
27805+
case error(message: String
27806+
)
27807+
}
27808+
27809+
27810+
public struct FfiConverterTypeThreadSummaryLatestEventDetails: FfiConverterRustBuffer {
27811+
typealias SwiftType = ThreadSummaryLatestEventDetails
27812+
27813+
public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> ThreadSummaryLatestEventDetails {
27814+
let variant: Int32 = try readInt(&buf)
27815+
switch variant {
27816+
27817+
case 1: return .unavailable
27818+
27819+
case 2: return .pending
27820+
27821+
case 3: return .ready(sender: try FfiConverterString.read(from: &buf), senderProfile: try FfiConverterTypeProfileDetails.read(from: &buf), content: try FfiConverterTypeTimelineItemContent.read(from: &buf)
27822+
)
27823+
27824+
case 4: return .error(message: try FfiConverterString.read(from: &buf)
27825+
)
27826+
27827+
default: throw UniffiInternalError.unexpectedEnumCase
27828+
}
27829+
}
27830+
27831+
public static func write(_ value: ThreadSummaryLatestEventDetails, into buf: inout [UInt8]) {
27832+
switch value {
27833+
27834+
27835+
case .unavailable:
27836+
writeInt(&buf, Int32(1))
27837+
27838+
27839+
case .pending:
27840+
writeInt(&buf, Int32(2))
27841+
27842+
27843+
case let .ready(sender,senderProfile,content):
27844+
writeInt(&buf, Int32(3))
27845+
FfiConverterString.write(sender, into: &buf)
27846+
FfiConverterTypeProfileDetails.write(senderProfile, into: &buf)
27847+
FfiConverterTypeTimelineItemContent.write(content, into: &buf)
27848+
27849+
27850+
case let .error(message):
27851+
writeInt(&buf, Int32(4))
27852+
FfiConverterString.write(message, into: &buf)
27853+
27854+
}
27855+
}
27856+
}
27857+
27858+
27859+
public func FfiConverterTypeThreadSummaryLatestEventDetails_lift(_ buf: RustBuffer) throws -> ThreadSummaryLatestEventDetails {
27860+
return try FfiConverterTypeThreadSummaryLatestEventDetails.lift(buf)
27861+
}
27862+
27863+
public func FfiConverterTypeThreadSummaryLatestEventDetails_lower(_ value: ThreadSummaryLatestEventDetails) -> RustBuffer {
27864+
return FfiConverterTypeThreadSummaryLatestEventDetails.lower(value)
27865+
}
27866+
27867+
27868+
27869+
2768127870
// Note that we don't yet support `indirect` for enums.
2768227871
// See https://github.com/mozilla/uniffi-rs/issues/396 for further discussion.
2768327872

@@ -31358,6 +31547,27 @@ fileprivate struct FfiConverterOptionTypeTaskHandle: FfiConverterRustBuffer {
3135831547
}
3135931548
}
3136031549

31550+
fileprivate struct FfiConverterOptionTypeThreadSummary: FfiConverterRustBuffer {
31551+
typealias SwiftType = ThreadSummary?
31552+
31553+
public static func write(_ value: SwiftType, into buf: inout [UInt8]) {
31554+
guard let value = value else {
31555+
writeInt(&buf, Int8(0))
31556+
return
31557+
}
31558+
writeInt(&buf, Int8(1))
31559+
FfiConverterTypeThreadSummary.write(value, into: &buf)
31560+
}
31561+
31562+
public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> SwiftType {
31563+
switch try readInt(&buf) as Int8 {
31564+
case 0: return nil
31565+
case 1: return try FfiConverterTypeThreadSummary.read(from: &buf)
31566+
default: throw UniffiInternalError.unexpectedOptionalTag
31567+
}
31568+
}
31569+
}
31570+
3136131571
fileprivate struct FfiConverterOptionTypeTimelineEventTypeFilter: FfiConverterRustBuffer {
3136231572
typealias SwiftType = TimelineEventTypeFilter?
3136331573

@@ -34734,6 +34944,9 @@ private var initializationResult: InitializationResult = {
3473434944
if (uniffi_matrix_sdk_ffi_checksum_method_taskhandle_is_finished() != 29008) {
3473534945
return InitializationResult.apiChecksumMismatch
3473634946
}
34947+
if (uniffi_matrix_sdk_ffi_checksum_method_threadsummary_latest_event() != 52190) {
34948+
return InitializationResult.apiChecksumMismatch
34949+
}
3473734950
if (uniffi_matrix_sdk_ffi_checksum_method_timeline_add_listener() != 18746) {
3473834951
return InitializationResult.apiChecksumMismatch
3473934952
}

0 commit comments

Comments
 (0)