Skip to content

Commit ab334e9

Browse files
committed
Bump the SDK to v25.01.10-2, fix breaking API changes around sending media and mentions
1 parent 57b85d2 commit ab334e9

File tree

7 files changed

+275
-181
lines changed

7 files changed

+275
-181
lines changed

ElementX.xcodeproj/project.pbxproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8415,7 +8415,7 @@
84158415
repositoryURL = "https://github.com/element-hq/matrix-rust-components-swift";
84168416
requirement = {
84178417
kind = exactVersion;
8418-
version = 24.12.20;
8418+
version = "25.01.10-2";
84198419
};
84208420
};
84218421
701C7BEF8F70F7A83E852DCC /* XCRemoteSwiftPackageReference "GZIP" */ = {

ElementX.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

ElementX/Sources/Mocks/Generated/SDKGeneratedMocks.swift

Lines changed: 214 additions & 125 deletions
Large diffs are not rendered by default.

ElementX/Sources/Mocks/PhotoLibraryManagerMock.swift

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ extension PhotoLibraryManagerMock {
1212
var authorizationDenied = false
1313
}
1414

15-
// swiftlint:disable:next cyclomatic_complexity
1615
convenience init(_ configuration: Configuration) {
1716
self.init()
1817

ElementX/Sources/Services/Timeline/TimelineController/RoomTimelineController.swift

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -255,11 +255,12 @@ class RoomTimelineController: RoomTimelineControllerProtocol {
255255
message: String,
256256
html: String?,
257257
intentionalMentions: IntentionalMentions) async {
258-
// We're waiting on an API for including mentions: https://github.com/matrix-org/matrix-rust-sdk/issues/4302
259258
MXLog.info("Editing timeline item caption: \(eventOrTransactionID) in \(roomID)")
260259

261260
// When formattedCaption is nil, caption will be parsed as markdown and generate the HTML for us.
262-
let newContent = createCaptionEdit(caption: message, formattedCaption: html.map { .init(format: .html, body: $0) })
261+
let newContent = createCaptionEdit(caption: message,
262+
formattedCaption: html.map { .init(format: .html, body: $0) },
263+
mentions: intentionalMentions.toRustMentions())
263264
switch await activeTimeline.edit(eventOrTransactionID, newContent: newContent) {
264265
case .success:
265266
MXLog.info("Finished editing caption")
@@ -270,7 +271,7 @@ class RoomTimelineController: RoomTimelineControllerProtocol {
270271

271272
func removeCaption(_ eventOrTransactionID: EventOrTransactionId) async {
272273
// Set a `nil` caption to remove it from the event.
273-
let newContent = createCaptionEdit(caption: nil, formattedCaption: nil)
274+
let newContent = createCaptionEdit(caption: nil, formattedCaption: nil, mentions: nil)
274275
switch await activeTimeline.edit(eventOrTransactionID, newContent: newContent) {
275276
case .success:
276277
MXLog.info("Finished removing caption.")

ElementX/Sources/Services/Timeline/TimelineProxy.swift

Lines changed: 53 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -229,16 +229,17 @@ final class TimelineProxy: TimelineProxyProtocol {
229229
requestHandle: @MainActor (SendAttachmentJoinHandleProtocol) -> Void) async -> Result<Void, TimelineProxyError> {
230230
MXLog.info("Sending audio")
231231

232-
let handle = timeline.sendAudio(url: url.path(percentEncoded: false),
233-
audioInfo: audioInfo,
234-
caption: caption,
235-
formattedCaption: nil, // Rust will build this from the caption's markdown.
236-
progressWatcher: nil,
237-
useSendQueue: true)
238-
239-
await requestHandle(handle)
240-
241232
do {
233+
let handle = try timeline.sendAudio(params: .init(filename: url.path(percentEncoded: false),
234+
caption: caption,
235+
formattedCaption: nil, // Rust will build this from the caption's markdown.
236+
mentions: nil,
237+
useSendQueue: true),
238+
audioInfo: audioInfo,
239+
progressWatcher: nil)
240+
241+
await requestHandle(handle)
242+
242243
try await handle.join()
243244
MXLog.info("Finished sending audio")
244245
} catch {
@@ -255,16 +256,17 @@ final class TimelineProxy: TimelineProxyProtocol {
255256
requestHandle: @MainActor (SendAttachmentJoinHandleProtocol) -> Void) async -> Result<Void, TimelineProxyError> {
256257
MXLog.info("Sending file")
257258

258-
let handle = timeline.sendFile(url: url.path(percentEncoded: false),
259-
fileInfo: fileInfo,
260-
caption: caption,
261-
formattedCaption: nil, // Rust will build this from the caption's markdown.
262-
progressWatcher: nil,
263-
useSendQueue: true)
264-
265-
await requestHandle(handle)
266-
267259
do {
260+
let handle = try timeline.sendFile(params: .init(filename: url.path(percentEncoded: false),
261+
caption: caption,
262+
formattedCaption: nil, // Rust will build this from the caption's markdown.
263+
mentions: nil,
264+
useSendQueue: true),
265+
fileInfo: fileInfo,
266+
progressWatcher: nil)
267+
268+
await requestHandle(handle)
269+
268270
try await handle.join()
269271
MXLog.info("Finished sending file")
270272
} catch {
@@ -282,17 +284,18 @@ final class TimelineProxy: TimelineProxyProtocol {
282284
requestHandle: @MainActor (SendAttachmentJoinHandleProtocol) -> Void) async -> Result<Void, TimelineProxyError> {
283285
MXLog.info("Sending image")
284286

285-
let handle = timeline.sendImage(url: url.path(percentEncoded: false),
286-
thumbnailUrl: thumbnailURL.path(percentEncoded: false),
287-
imageInfo: imageInfo,
288-
caption: caption,
289-
formattedCaption: nil, // Rust will build this from the caption's markdown.
290-
progressWatcher: nil,
291-
useSendQueue: true)
292-
293-
await requestHandle(handle)
294-
295287
do {
288+
let handle = try timeline.sendImage(params: .init(filename: url.path(percentEncoded: false),
289+
caption: caption,
290+
formattedCaption: nil, // Rust will build this from the caption's markdown.
291+
mentions: nil,
292+
useSendQueue: true),
293+
thumbnailPath: thumbnailURL.path(percentEncoded: false),
294+
imageInfo: imageInfo,
295+
progressWatcher: nil)
296+
297+
await requestHandle(handle)
298+
296299
try await handle.join()
297300
MXLog.info("Finished sending image")
298301
} catch {
@@ -328,17 +331,18 @@ final class TimelineProxy: TimelineProxyProtocol {
328331
requestHandle: @MainActor (SendAttachmentJoinHandleProtocol) -> Void) async -> Result<Void, TimelineProxyError> {
329332
MXLog.info("Sending video")
330333

331-
let handle = timeline.sendVideo(url: url.path(percentEncoded: false),
332-
thumbnailUrl: thumbnailURL.path(percentEncoded: false),
333-
videoInfo: videoInfo,
334-
caption: caption,
335-
formattedCaption: nil, // Rust will build this from the caption's markdown.
336-
progressWatcher: nil,
337-
useSendQueue: true)
338-
339-
await requestHandle(handle)
340-
341334
do {
335+
let handle = try timeline.sendVideo(params: .init(filename: url.path(percentEncoded: false),
336+
caption: caption,
337+
formattedCaption: nil,
338+
mentions: nil,
339+
useSendQueue: true),
340+
thumbnailPath: thumbnailURL.path(percentEncoded: false),
341+
videoInfo: videoInfo,
342+
progressWatcher: nil)
343+
344+
await requestHandle(handle)
345+
342346
try await handle.join()
343347
MXLog.info("Finished sending video")
344348
} catch {
@@ -355,17 +359,18 @@ final class TimelineProxy: TimelineProxyProtocol {
355359
requestHandle: @MainActor (SendAttachmentJoinHandleProtocol) -> Void) async -> Result<Void, TimelineProxyError> {
356360
MXLog.info("Sending voice message")
357361

358-
let handle = timeline.sendVoiceMessage(url: url.path(percentEncoded: false),
359-
audioInfo: audioInfo,
360-
waveform: waveform,
361-
caption: nil,
362-
formattedCaption: nil,
363-
progressWatcher: nil,
364-
useSendQueue: true)
365-
366-
await requestHandle(handle)
367-
368362
do {
363+
let handle = try timeline.sendVoiceMessage(params: .init(filename: url.path(percentEncoded: false),
364+
caption: nil,
365+
formattedCaption: nil,
366+
mentions: nil,
367+
useSendQueue: true),
368+
audioInfo: audioInfo,
369+
waveform: waveform,
370+
progressWatcher: nil)
371+
372+
await requestHandle(handle)
373+
369374
try await handle.join()
370375
MXLog.info("Finished sending voice message")
371376
} catch {

project.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ packages:
6161
# Element/Matrix dependencies
6262
MatrixRustSDK:
6363
url: https://github.com/element-hq/matrix-rust-components-swift
64-
exactVersion: 24.12.20
64+
exactVersion: 25.01.10-2
6565
# path: ../matrix-rust-sdk
6666
Compound:
6767
url: https://github.com/element-hq/compound-ios

0 commit comments

Comments
 (0)