Skip to content

Commit 5de28d4

Browse files
committed
Bump to version v1.0.47 (matrix-rust-sdk/main 4b970e8)
1 parent 50f8730 commit 5de28d4

File tree

2 files changed

+137
-28
lines changed

2 files changed

+137
-28
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 = "ee1bff04c2753d4e78e3a2ee376908519c021b07dd19d40ccd62be2c55ce242d"
5-
let version = "v1.0.46"
4+
let checksum = "88c55699870f20e07cf0917caeac3927164c9bad9a3fc9f1b4ec95ad6e8d23f4"
5+
let version = "v1.0.47"
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: 135 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -8934,9 +8934,7 @@ public protocol TimelineProtocol : AnyObject {
89348934
* Returns whether the edit did happen. It can only return false for
89358935
* local events that are being processed.
89368936
*/
8937-
func edit(item: EventTimelineItem, newContent: RoomMessageEventContentWithoutRelation) async throws -> Bool
8938-
8939-
func editPoll(question: String, answers: [String], maxSelections: UInt8, pollKind: PollKind, editItem: EventTimelineItem) async throws
8937+
func edit(item: EventTimelineItem, newContent: EditedContent) async throws -> Bool
89408938

89418939
func endPoll(pollStartId: String, text: String) throws
89428940

@@ -9167,13 +9165,13 @@ open func createPoll(question: String, answers: [String], maxSelections: UInt8,
91679165
* Returns whether the edit did happen. It can only return false for
91689166
* local events that are being processed.
91699167
*/
9170-
open func edit(item: EventTimelineItem, newContent: RoomMessageEventContentWithoutRelation)async throws -> Bool {
9168+
open func edit(item: EventTimelineItem, newContent: EditedContent)async throws -> Bool {
91719169
return
91729170
try await uniffiRustCallAsync(
91739171
rustFutureFunc: {
91749172
uniffi_matrix_sdk_ffi_fn_method_timeline_edit(
91759173
self.uniffiClonePointer(),
9176-
FfiConverterTypeEventTimelineItem.lower(item),FfiConverterTypeRoomMessageEventContentWithoutRelation.lower(newContent)
9174+
FfiConverterTypeEventTimelineItem.lower(item),FfiConverterTypeEditedContent.lower(newContent)
91779175
)
91789176
},
91799177
pollFunc: ffi_matrix_sdk_ffi_rust_future_poll_i8,
@@ -9184,23 +9182,6 @@ open func edit(item: EventTimelineItem, newContent: RoomMessageEventContentWitho
91849182
)
91859183
}
91869184

9187-
open func editPoll(question: String, answers: [String], maxSelections: UInt8, pollKind: PollKind, editItem: EventTimelineItem)async throws {
9188-
return
9189-
try await uniffiRustCallAsync(
9190-
rustFutureFunc: {
9191-
uniffi_matrix_sdk_ffi_fn_method_timeline_edit_poll(
9192-
self.uniffiClonePointer(),
9193-
FfiConverterString.lower(question),FfiConverterSequenceString.lower(answers),FfiConverterUInt8.lower(maxSelections),FfiConverterTypePollKind.lower(pollKind),FfiConverterTypeEventTimelineItem.lower(editItem)
9194-
)
9195-
},
9196-
pollFunc: ffi_matrix_sdk_ffi_rust_future_poll_void,
9197-
completeFunc: ffi_matrix_sdk_ffi_rust_future_complete_void,
9198-
freeFunc: ffi_matrix_sdk_ffi_rust_future_free_void,
9199-
liftFunc: { $0 },
9200-
errorHandler: FfiConverterTypeClientError.lift
9201-
)
9202-
}
9203-
92049185
open func endPoll(pollStartId: String, text: String)throws {try rustCallWithError(FfiConverterTypeClientError.lift) {
92059186
uniffi_matrix_sdk_ffi_fn_method_timeline_end_poll(self.uniffiClonePointer(),
92069187
FfiConverterString.lower(pollStartId),
@@ -12705,6 +12686,79 @@ public func FfiConverterTypePollAnswer_lower(_ value: PollAnswer) -> RustBuffer
1270512686
}
1270612687

1270712688

12689+
public struct PollData {
12690+
public var question: String
12691+
public var answers: [String]
12692+
public var maxSelections: UInt8
12693+
public var pollKind: PollKind
12694+
12695+
// Default memberwise initializers are never public by default, so we
12696+
// declare one manually.
12697+
public init(question: String, answers: [String], maxSelections: UInt8, pollKind: PollKind) {
12698+
self.question = question
12699+
self.answers = answers
12700+
self.maxSelections = maxSelections
12701+
self.pollKind = pollKind
12702+
}
12703+
}
12704+
12705+
12706+
12707+
extension PollData: Equatable, Hashable {
12708+
public static func ==(lhs: PollData, rhs: PollData) -> Bool {
12709+
if lhs.question != rhs.question {
12710+
return false
12711+
}
12712+
if lhs.answers != rhs.answers {
12713+
return false
12714+
}
12715+
if lhs.maxSelections != rhs.maxSelections {
12716+
return false
12717+
}
12718+
if lhs.pollKind != rhs.pollKind {
12719+
return false
12720+
}
12721+
return true
12722+
}
12723+
12724+
public func hash(into hasher: inout Hasher) {
12725+
hasher.combine(question)
12726+
hasher.combine(answers)
12727+
hasher.combine(maxSelections)
12728+
hasher.combine(pollKind)
12729+
}
12730+
}
12731+
12732+
12733+
public struct FfiConverterTypePollData: FfiConverterRustBuffer {
12734+
public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> PollData {
12735+
return
12736+
try PollData(
12737+
question: FfiConverterString.read(from: &buf),
12738+
answers: FfiConverterSequenceString.read(from: &buf),
12739+
maxSelections: FfiConverterUInt8.read(from: &buf),
12740+
pollKind: FfiConverterTypePollKind.read(from: &buf)
12741+
)
12742+
}
12743+
12744+
public static func write(_ value: PollData, into buf: inout [UInt8]) {
12745+
FfiConverterString.write(value.question, into: &buf)
12746+
FfiConverterSequenceString.write(value.answers, into: &buf)
12747+
FfiConverterUInt8.write(value.maxSelections, into: &buf)
12748+
FfiConverterTypePollKind.write(value.pollKind, into: &buf)
12749+
}
12750+
}
12751+
12752+
12753+
public func FfiConverterTypePollData_lift(_ buf: RustBuffer) throws -> PollData {
12754+
return try FfiConverterTypePollData.lift(buf)
12755+
}
12756+
12757+
public func FfiConverterTypePollData_lower(_ value: PollData) -> RustBuffer {
12758+
return FfiConverterTypePollData.lower(value)
12759+
}
12760+
12761+
1270812762
public struct PowerLevels {
1270912763
public var usersDefault: Int32?
1271012764
public var eventsDefault: Int32?
@@ -16790,6 +16844,64 @@ extension CrossSigningResetAuthType: Equatable, Hashable {}
1679016844

1679116845

1679216846

16847+
// Note that we don't yet support `indirect` for enums.
16848+
// See https://github.com/mozilla/uniffi-rs/issues/396 for further discussion.
16849+
16850+
public enum EditedContent {
16851+
16852+
case roomMessage(content: RoomMessageEventContentWithoutRelation
16853+
)
16854+
case pollStart(pollData: PollData
16855+
)
16856+
}
16857+
16858+
16859+
public struct FfiConverterTypeEditedContent: FfiConverterRustBuffer {
16860+
typealias SwiftType = EditedContent
16861+
16862+
public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> EditedContent {
16863+
let variant: Int32 = try readInt(&buf)
16864+
switch variant {
16865+
16866+
case 1: return .roomMessage(content: try FfiConverterTypeRoomMessageEventContentWithoutRelation.read(from: &buf)
16867+
)
16868+
16869+
case 2: return .pollStart(pollData: try FfiConverterTypePollData.read(from: &buf)
16870+
)
16871+
16872+
default: throw UniffiInternalError.unexpectedEnumCase
16873+
}
16874+
}
16875+
16876+
public static func write(_ value: EditedContent, into buf: inout [UInt8]) {
16877+
switch value {
16878+
16879+
16880+
case let .roomMessage(content):
16881+
writeInt(&buf, Int32(1))
16882+
FfiConverterTypeRoomMessageEventContentWithoutRelation.write(content, into: &buf)
16883+
16884+
16885+
case let .pollStart(pollData):
16886+
writeInt(&buf, Int32(2))
16887+
FfiConverterTypePollData.write(pollData, into: &buf)
16888+
16889+
}
16890+
}
16891+
}
16892+
16893+
16894+
public func FfiConverterTypeEditedContent_lift(_ buf: RustBuffer) throws -> EditedContent {
16895+
return try FfiConverterTypeEditedContent.lift(buf)
16896+
}
16897+
16898+
public func FfiConverterTypeEditedContent_lower(_ value: EditedContent) -> RustBuffer {
16899+
return FfiConverterTypeEditedContent.lower(value)
16900+
}
16901+
16902+
16903+
16904+
1679316905
// Note that we don't yet support `indirect` for enums.
1679416906
// See https://github.com/mozilla/uniffi-rs/issues/396 for further discussion.
1679516907

@@ -27868,10 +27980,7 @@ private var initializationResult: InitializationResult = {
2786827980
if (uniffi_matrix_sdk_ffi_checksum_method_timeline_create_poll() != 37925) {
2786927981
return InitializationResult.apiChecksumMismatch
2787027982
}
27871-
if (uniffi_matrix_sdk_ffi_checksum_method_timeline_edit() != 9304) {
27872-
return InitializationResult.apiChecksumMismatch
27873-
}
27874-
if (uniffi_matrix_sdk_ffi_checksum_method_timeline_edit_poll() != 40066) {
27983+
if (uniffi_matrix_sdk_ffi_checksum_method_timeline_edit() != 14692) {
2787527984
return InitializationResult.apiChecksumMismatch
2787627985
}
2787727986
if (uniffi_matrix_sdk_ffi_checksum_method_timeline_end_poll() != 31506) {

0 commit comments

Comments
 (0)