From 3e4c021768c9caa8002a2512cb9c7ffb0181ea3c Mon Sep 17 00:00:00 2001 From: Stefan Ceriu Date: Fri, 10 Jan 2025 18:19:53 +0200 Subject: [PATCH] Bump the SDK to v25.01.10-2, fix breaking API changes around sending media and mentions --- ElementX.xcodeproj/project.pbxproj | 2 +- .../xcshareddata/swiftpm/Package.resolved | 4 +- .../Mocks/Generated/SDKGeneratedMocks.swift | 339 +++++++++++------- .../Mocks/PhotoLibraryManagerMock.swift | 1 - .../RoomTimelineController.swift | 7 +- .../Services/Timeline/TimelineProxy.swift | 101 +++--- project.yml | 2 +- 7 files changed, 275 insertions(+), 181 deletions(-) diff --git a/ElementX.xcodeproj/project.pbxproj b/ElementX.xcodeproj/project.pbxproj index b766568144..09b60d194b 100644 --- a/ElementX.xcodeproj/project.pbxproj +++ b/ElementX.xcodeproj/project.pbxproj @@ -8415,7 +8415,7 @@ repositoryURL = "https://github.com/element-hq/matrix-rust-components-swift"; requirement = { kind = exactVersion; - version = 24.12.20; + version = "25.01.10-2"; }; }; 701C7BEF8F70F7A83E852DCC /* XCRemoteSwiftPackageReference "GZIP" */ = { diff --git a/ElementX.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved b/ElementX.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved index eaa358fdcb..992f28e6e6 100644 --- a/ElementX.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved +++ b/ElementX.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved @@ -149,8 +149,8 @@ "kind" : "remoteSourceControl", "location" : "https://github.com/element-hq/matrix-rust-components-swift", "state" : { - "revision" : "3047d2b193a437b53998fa0133c46f198ee57126", - "version" : "24.12.20" + "revision" : "cc9cd80aa6954a7945d82c29182f81c5219f635e", + "version" : "25.1.10-2" } }, { diff --git a/ElementX/Sources/Mocks/Generated/SDKGeneratedMocks.swift b/ElementX/Sources/Mocks/Generated/SDKGeneratedMocks.swift index f4e206858a..0b5cfa5656 100644 --- a/ElementX/Sources/Mocks/Generated/SDKGeneratedMocks.swift +++ b/ElementX/Sources/Mocks/Generated/SDKGeneratedMocks.swift @@ -13653,6 +13653,75 @@ open class RoomSDKMock: MatrixRustSDK.Room { } } + //MARK: - roomEventsDebugString + + open var roomEventsDebugStringThrowableError: Error? + var roomEventsDebugStringUnderlyingCallsCount = 0 + open var roomEventsDebugStringCallsCount: Int { + get { + if Thread.isMainThread { + return roomEventsDebugStringUnderlyingCallsCount + } else { + var returnValue: Int? = nil + DispatchQueue.main.sync { + returnValue = roomEventsDebugStringUnderlyingCallsCount + } + + return returnValue! + } + } + set { + if Thread.isMainThread { + roomEventsDebugStringUnderlyingCallsCount = newValue + } else { + DispatchQueue.main.sync { + roomEventsDebugStringUnderlyingCallsCount = newValue + } + } + } + } + open var roomEventsDebugStringCalled: Bool { + return roomEventsDebugStringCallsCount > 0 + } + + var roomEventsDebugStringUnderlyingReturnValue: [String]! + open var roomEventsDebugStringReturnValue: [String]! { + get { + if Thread.isMainThread { + return roomEventsDebugStringUnderlyingReturnValue + } else { + var returnValue: [String]? = nil + DispatchQueue.main.sync { + returnValue = roomEventsDebugStringUnderlyingReturnValue + } + + return returnValue! + } + } + set { + if Thread.isMainThread { + roomEventsDebugStringUnderlyingReturnValue = newValue + } else { + DispatchQueue.main.sync { + roomEventsDebugStringUnderlyingReturnValue = newValue + } + } + } + } + open var roomEventsDebugStringClosure: (() async throws -> [String])? + + open override func roomEventsDebugString() async throws -> [String] { + if let error = roomEventsDebugStringThrowableError { + throw error + } + roomEventsDebugStringCallsCount += 1 + if let roomEventsDebugStringClosure = roomEventsDebugStringClosure { + return try await roomEventsDebugStringClosure() + } else { + return roomEventsDebugStringReturnValue + } + } + //MARK: - roomInfo open var roomInfoThrowableError: Error? @@ -19916,15 +19985,16 @@ open class TimelineSDKMock: MatrixRustSDK.Timeline { //MARK: - sendAudio - var sendAudioUrlAudioInfoCaptionFormattedCaptionProgressWatcherUseSendQueueUnderlyingCallsCount = 0 - open var sendAudioUrlAudioInfoCaptionFormattedCaptionProgressWatcherUseSendQueueCallsCount: Int { + open var sendAudioParamsAudioInfoProgressWatcherThrowableError: Error? + var sendAudioParamsAudioInfoProgressWatcherUnderlyingCallsCount = 0 + open var sendAudioParamsAudioInfoProgressWatcherCallsCount: Int { get { if Thread.isMainThread { - return sendAudioUrlAudioInfoCaptionFormattedCaptionProgressWatcherUseSendQueueUnderlyingCallsCount + return sendAudioParamsAudioInfoProgressWatcherUnderlyingCallsCount } else { var returnValue: Int? = nil DispatchQueue.main.sync { - returnValue = sendAudioUrlAudioInfoCaptionFormattedCaptionProgressWatcherUseSendQueueUnderlyingCallsCount + returnValue = sendAudioParamsAudioInfoProgressWatcherUnderlyingCallsCount } return returnValue! @@ -19932,29 +20002,29 @@ open class TimelineSDKMock: MatrixRustSDK.Timeline { } set { if Thread.isMainThread { - sendAudioUrlAudioInfoCaptionFormattedCaptionProgressWatcherUseSendQueueUnderlyingCallsCount = newValue + sendAudioParamsAudioInfoProgressWatcherUnderlyingCallsCount = newValue } else { DispatchQueue.main.sync { - sendAudioUrlAudioInfoCaptionFormattedCaptionProgressWatcherUseSendQueueUnderlyingCallsCount = newValue + sendAudioParamsAudioInfoProgressWatcherUnderlyingCallsCount = newValue } } } } - open var sendAudioUrlAudioInfoCaptionFormattedCaptionProgressWatcherUseSendQueueCalled: Bool { - return sendAudioUrlAudioInfoCaptionFormattedCaptionProgressWatcherUseSendQueueCallsCount > 0 + open var sendAudioParamsAudioInfoProgressWatcherCalled: Bool { + return sendAudioParamsAudioInfoProgressWatcherCallsCount > 0 } - open var sendAudioUrlAudioInfoCaptionFormattedCaptionProgressWatcherUseSendQueueReceivedArguments: (url: String, audioInfo: AudioInfo, caption: String?, formattedCaption: FormattedBody?, progressWatcher: ProgressWatcher?, useSendQueue: Bool)? - open var sendAudioUrlAudioInfoCaptionFormattedCaptionProgressWatcherUseSendQueueReceivedInvocations: [(url: String, audioInfo: AudioInfo, caption: String?, formattedCaption: FormattedBody?, progressWatcher: ProgressWatcher?, useSendQueue: Bool)] = [] + open var sendAudioParamsAudioInfoProgressWatcherReceivedArguments: (params: UploadParameters, audioInfo: AudioInfo, progressWatcher: ProgressWatcher?)? + open var sendAudioParamsAudioInfoProgressWatcherReceivedInvocations: [(params: UploadParameters, audioInfo: AudioInfo, progressWatcher: ProgressWatcher?)] = [] - var sendAudioUrlAudioInfoCaptionFormattedCaptionProgressWatcherUseSendQueueUnderlyingReturnValue: SendAttachmentJoinHandle! - open var sendAudioUrlAudioInfoCaptionFormattedCaptionProgressWatcherUseSendQueueReturnValue: SendAttachmentJoinHandle! { + var sendAudioParamsAudioInfoProgressWatcherUnderlyingReturnValue: SendAttachmentJoinHandle! + open var sendAudioParamsAudioInfoProgressWatcherReturnValue: SendAttachmentJoinHandle! { get { if Thread.isMainThread { - return sendAudioUrlAudioInfoCaptionFormattedCaptionProgressWatcherUseSendQueueUnderlyingReturnValue + return sendAudioParamsAudioInfoProgressWatcherUnderlyingReturnValue } else { var returnValue: SendAttachmentJoinHandle? = nil DispatchQueue.main.sync { - returnValue = sendAudioUrlAudioInfoCaptionFormattedCaptionProgressWatcherUseSendQueueUnderlyingReturnValue + returnValue = sendAudioParamsAudioInfoProgressWatcherUnderlyingReturnValue } return returnValue! @@ -19962,40 +20032,44 @@ open class TimelineSDKMock: MatrixRustSDK.Timeline { } set { if Thread.isMainThread { - sendAudioUrlAudioInfoCaptionFormattedCaptionProgressWatcherUseSendQueueUnderlyingReturnValue = newValue + sendAudioParamsAudioInfoProgressWatcherUnderlyingReturnValue = newValue } else { DispatchQueue.main.sync { - sendAudioUrlAudioInfoCaptionFormattedCaptionProgressWatcherUseSendQueueUnderlyingReturnValue = newValue + sendAudioParamsAudioInfoProgressWatcherUnderlyingReturnValue = newValue } } } } - open var sendAudioUrlAudioInfoCaptionFormattedCaptionProgressWatcherUseSendQueueClosure: ((String, AudioInfo, String?, FormattedBody?, ProgressWatcher?, Bool) -> SendAttachmentJoinHandle)? + open var sendAudioParamsAudioInfoProgressWatcherClosure: ((UploadParameters, AudioInfo, ProgressWatcher?) throws -> SendAttachmentJoinHandle)? - open override func sendAudio(url: String, audioInfo: AudioInfo, caption: String?, formattedCaption: FormattedBody?, progressWatcher: ProgressWatcher?, useSendQueue: Bool) -> SendAttachmentJoinHandle { - sendAudioUrlAudioInfoCaptionFormattedCaptionProgressWatcherUseSendQueueCallsCount += 1 - sendAudioUrlAudioInfoCaptionFormattedCaptionProgressWatcherUseSendQueueReceivedArguments = (url: url, audioInfo: audioInfo, caption: caption, formattedCaption: formattedCaption, progressWatcher: progressWatcher, useSendQueue: useSendQueue) + open override func sendAudio(params: UploadParameters, audioInfo: AudioInfo, progressWatcher: ProgressWatcher?) throws -> SendAttachmentJoinHandle { + if let error = sendAudioParamsAudioInfoProgressWatcherThrowableError { + throw error + } + sendAudioParamsAudioInfoProgressWatcherCallsCount += 1 + sendAudioParamsAudioInfoProgressWatcherReceivedArguments = (params: params, audioInfo: audioInfo, progressWatcher: progressWatcher) DispatchQueue.main.async { - self.sendAudioUrlAudioInfoCaptionFormattedCaptionProgressWatcherUseSendQueueReceivedInvocations.append((url: url, audioInfo: audioInfo, caption: caption, formattedCaption: formattedCaption, progressWatcher: progressWatcher, useSendQueue: useSendQueue)) + self.sendAudioParamsAudioInfoProgressWatcherReceivedInvocations.append((params: params, audioInfo: audioInfo, progressWatcher: progressWatcher)) } - if let sendAudioUrlAudioInfoCaptionFormattedCaptionProgressWatcherUseSendQueueClosure = sendAudioUrlAudioInfoCaptionFormattedCaptionProgressWatcherUseSendQueueClosure { - return sendAudioUrlAudioInfoCaptionFormattedCaptionProgressWatcherUseSendQueueClosure(url, audioInfo, caption, formattedCaption, progressWatcher, useSendQueue) + if let sendAudioParamsAudioInfoProgressWatcherClosure = sendAudioParamsAudioInfoProgressWatcherClosure { + return try sendAudioParamsAudioInfoProgressWatcherClosure(params, audioInfo, progressWatcher) } else { - return sendAudioUrlAudioInfoCaptionFormattedCaptionProgressWatcherUseSendQueueReturnValue + return sendAudioParamsAudioInfoProgressWatcherReturnValue } } //MARK: - sendFile - var sendFileUrlFileInfoCaptionFormattedCaptionProgressWatcherUseSendQueueUnderlyingCallsCount = 0 - open var sendFileUrlFileInfoCaptionFormattedCaptionProgressWatcherUseSendQueueCallsCount: Int { + open var sendFileParamsFileInfoProgressWatcherThrowableError: Error? + var sendFileParamsFileInfoProgressWatcherUnderlyingCallsCount = 0 + open var sendFileParamsFileInfoProgressWatcherCallsCount: Int { get { if Thread.isMainThread { - return sendFileUrlFileInfoCaptionFormattedCaptionProgressWatcherUseSendQueueUnderlyingCallsCount + return sendFileParamsFileInfoProgressWatcherUnderlyingCallsCount } else { var returnValue: Int? = nil DispatchQueue.main.sync { - returnValue = sendFileUrlFileInfoCaptionFormattedCaptionProgressWatcherUseSendQueueUnderlyingCallsCount + returnValue = sendFileParamsFileInfoProgressWatcherUnderlyingCallsCount } return returnValue! @@ -20003,29 +20077,29 @@ open class TimelineSDKMock: MatrixRustSDK.Timeline { } set { if Thread.isMainThread { - sendFileUrlFileInfoCaptionFormattedCaptionProgressWatcherUseSendQueueUnderlyingCallsCount = newValue + sendFileParamsFileInfoProgressWatcherUnderlyingCallsCount = newValue } else { DispatchQueue.main.sync { - sendFileUrlFileInfoCaptionFormattedCaptionProgressWatcherUseSendQueueUnderlyingCallsCount = newValue + sendFileParamsFileInfoProgressWatcherUnderlyingCallsCount = newValue } } } } - open var sendFileUrlFileInfoCaptionFormattedCaptionProgressWatcherUseSendQueueCalled: Bool { - return sendFileUrlFileInfoCaptionFormattedCaptionProgressWatcherUseSendQueueCallsCount > 0 + open var sendFileParamsFileInfoProgressWatcherCalled: Bool { + return sendFileParamsFileInfoProgressWatcherCallsCount > 0 } - open var sendFileUrlFileInfoCaptionFormattedCaptionProgressWatcherUseSendQueueReceivedArguments: (url: String, fileInfo: FileInfo, caption: String?, formattedCaption: FormattedBody?, progressWatcher: ProgressWatcher?, useSendQueue: Bool)? - open var sendFileUrlFileInfoCaptionFormattedCaptionProgressWatcherUseSendQueueReceivedInvocations: [(url: String, fileInfo: FileInfo, caption: String?, formattedCaption: FormattedBody?, progressWatcher: ProgressWatcher?, useSendQueue: Bool)] = [] + open var sendFileParamsFileInfoProgressWatcherReceivedArguments: (params: UploadParameters, fileInfo: FileInfo, progressWatcher: ProgressWatcher?)? + open var sendFileParamsFileInfoProgressWatcherReceivedInvocations: [(params: UploadParameters, fileInfo: FileInfo, progressWatcher: ProgressWatcher?)] = [] - var sendFileUrlFileInfoCaptionFormattedCaptionProgressWatcherUseSendQueueUnderlyingReturnValue: SendAttachmentJoinHandle! - open var sendFileUrlFileInfoCaptionFormattedCaptionProgressWatcherUseSendQueueReturnValue: SendAttachmentJoinHandle! { + var sendFileParamsFileInfoProgressWatcherUnderlyingReturnValue: SendAttachmentJoinHandle! + open var sendFileParamsFileInfoProgressWatcherReturnValue: SendAttachmentJoinHandle! { get { if Thread.isMainThread { - return sendFileUrlFileInfoCaptionFormattedCaptionProgressWatcherUseSendQueueUnderlyingReturnValue + return sendFileParamsFileInfoProgressWatcherUnderlyingReturnValue } else { var returnValue: SendAttachmentJoinHandle? = nil DispatchQueue.main.sync { - returnValue = sendFileUrlFileInfoCaptionFormattedCaptionProgressWatcherUseSendQueueUnderlyingReturnValue + returnValue = sendFileParamsFileInfoProgressWatcherUnderlyingReturnValue } return returnValue! @@ -20033,40 +20107,44 @@ open class TimelineSDKMock: MatrixRustSDK.Timeline { } set { if Thread.isMainThread { - sendFileUrlFileInfoCaptionFormattedCaptionProgressWatcherUseSendQueueUnderlyingReturnValue = newValue + sendFileParamsFileInfoProgressWatcherUnderlyingReturnValue = newValue } else { DispatchQueue.main.sync { - sendFileUrlFileInfoCaptionFormattedCaptionProgressWatcherUseSendQueueUnderlyingReturnValue = newValue + sendFileParamsFileInfoProgressWatcherUnderlyingReturnValue = newValue } } } } - open var sendFileUrlFileInfoCaptionFormattedCaptionProgressWatcherUseSendQueueClosure: ((String, FileInfo, String?, FormattedBody?, ProgressWatcher?, Bool) -> SendAttachmentJoinHandle)? + open var sendFileParamsFileInfoProgressWatcherClosure: ((UploadParameters, FileInfo, ProgressWatcher?) throws -> SendAttachmentJoinHandle)? - open override func sendFile(url: String, fileInfo: FileInfo, caption: String?, formattedCaption: FormattedBody?, progressWatcher: ProgressWatcher?, useSendQueue: Bool) -> SendAttachmentJoinHandle { - sendFileUrlFileInfoCaptionFormattedCaptionProgressWatcherUseSendQueueCallsCount += 1 - sendFileUrlFileInfoCaptionFormattedCaptionProgressWatcherUseSendQueueReceivedArguments = (url: url, fileInfo: fileInfo, caption: caption, formattedCaption: formattedCaption, progressWatcher: progressWatcher, useSendQueue: useSendQueue) + open override func sendFile(params: UploadParameters, fileInfo: FileInfo, progressWatcher: ProgressWatcher?) throws -> SendAttachmentJoinHandle { + if let error = sendFileParamsFileInfoProgressWatcherThrowableError { + throw error + } + sendFileParamsFileInfoProgressWatcherCallsCount += 1 + sendFileParamsFileInfoProgressWatcherReceivedArguments = (params: params, fileInfo: fileInfo, progressWatcher: progressWatcher) DispatchQueue.main.async { - self.sendFileUrlFileInfoCaptionFormattedCaptionProgressWatcherUseSendQueueReceivedInvocations.append((url: url, fileInfo: fileInfo, caption: caption, formattedCaption: formattedCaption, progressWatcher: progressWatcher, useSendQueue: useSendQueue)) + self.sendFileParamsFileInfoProgressWatcherReceivedInvocations.append((params: params, fileInfo: fileInfo, progressWatcher: progressWatcher)) } - if let sendFileUrlFileInfoCaptionFormattedCaptionProgressWatcherUseSendQueueClosure = sendFileUrlFileInfoCaptionFormattedCaptionProgressWatcherUseSendQueueClosure { - return sendFileUrlFileInfoCaptionFormattedCaptionProgressWatcherUseSendQueueClosure(url, fileInfo, caption, formattedCaption, progressWatcher, useSendQueue) + if let sendFileParamsFileInfoProgressWatcherClosure = sendFileParamsFileInfoProgressWatcherClosure { + return try sendFileParamsFileInfoProgressWatcherClosure(params, fileInfo, progressWatcher) } else { - return sendFileUrlFileInfoCaptionFormattedCaptionProgressWatcherUseSendQueueReturnValue + return sendFileParamsFileInfoProgressWatcherReturnValue } } //MARK: - sendImage - var sendImageUrlThumbnailUrlImageInfoCaptionFormattedCaptionProgressWatcherUseSendQueueUnderlyingCallsCount = 0 - open var sendImageUrlThumbnailUrlImageInfoCaptionFormattedCaptionProgressWatcherUseSendQueueCallsCount: Int { + open var sendImageParamsThumbnailPathImageInfoProgressWatcherThrowableError: Error? + var sendImageParamsThumbnailPathImageInfoProgressWatcherUnderlyingCallsCount = 0 + open var sendImageParamsThumbnailPathImageInfoProgressWatcherCallsCount: Int { get { if Thread.isMainThread { - return sendImageUrlThumbnailUrlImageInfoCaptionFormattedCaptionProgressWatcherUseSendQueueUnderlyingCallsCount + return sendImageParamsThumbnailPathImageInfoProgressWatcherUnderlyingCallsCount } else { var returnValue: Int? = nil DispatchQueue.main.sync { - returnValue = sendImageUrlThumbnailUrlImageInfoCaptionFormattedCaptionProgressWatcherUseSendQueueUnderlyingCallsCount + returnValue = sendImageParamsThumbnailPathImageInfoProgressWatcherUnderlyingCallsCount } return returnValue! @@ -20074,29 +20152,29 @@ open class TimelineSDKMock: MatrixRustSDK.Timeline { } set { if Thread.isMainThread { - sendImageUrlThumbnailUrlImageInfoCaptionFormattedCaptionProgressWatcherUseSendQueueUnderlyingCallsCount = newValue + sendImageParamsThumbnailPathImageInfoProgressWatcherUnderlyingCallsCount = newValue } else { DispatchQueue.main.sync { - sendImageUrlThumbnailUrlImageInfoCaptionFormattedCaptionProgressWatcherUseSendQueueUnderlyingCallsCount = newValue + sendImageParamsThumbnailPathImageInfoProgressWatcherUnderlyingCallsCount = newValue } } } } - open var sendImageUrlThumbnailUrlImageInfoCaptionFormattedCaptionProgressWatcherUseSendQueueCalled: Bool { - return sendImageUrlThumbnailUrlImageInfoCaptionFormattedCaptionProgressWatcherUseSendQueueCallsCount > 0 + open var sendImageParamsThumbnailPathImageInfoProgressWatcherCalled: Bool { + return sendImageParamsThumbnailPathImageInfoProgressWatcherCallsCount > 0 } - open var sendImageUrlThumbnailUrlImageInfoCaptionFormattedCaptionProgressWatcherUseSendQueueReceivedArguments: (url: String, thumbnailUrl: String?, imageInfo: ImageInfo, caption: String?, formattedCaption: FormattedBody?, progressWatcher: ProgressWatcher?, useSendQueue: Bool)? - open var sendImageUrlThumbnailUrlImageInfoCaptionFormattedCaptionProgressWatcherUseSendQueueReceivedInvocations: [(url: String, thumbnailUrl: String?, imageInfo: ImageInfo, caption: String?, formattedCaption: FormattedBody?, progressWatcher: ProgressWatcher?, useSendQueue: Bool)] = [] + open var sendImageParamsThumbnailPathImageInfoProgressWatcherReceivedArguments: (params: UploadParameters, thumbnailPath: String?, imageInfo: ImageInfo, progressWatcher: ProgressWatcher?)? + open var sendImageParamsThumbnailPathImageInfoProgressWatcherReceivedInvocations: [(params: UploadParameters, thumbnailPath: String?, imageInfo: ImageInfo, progressWatcher: ProgressWatcher?)] = [] - var sendImageUrlThumbnailUrlImageInfoCaptionFormattedCaptionProgressWatcherUseSendQueueUnderlyingReturnValue: SendAttachmentJoinHandle! - open var sendImageUrlThumbnailUrlImageInfoCaptionFormattedCaptionProgressWatcherUseSendQueueReturnValue: SendAttachmentJoinHandle! { + var sendImageParamsThumbnailPathImageInfoProgressWatcherUnderlyingReturnValue: SendAttachmentJoinHandle! + open var sendImageParamsThumbnailPathImageInfoProgressWatcherReturnValue: SendAttachmentJoinHandle! { get { if Thread.isMainThread { - return sendImageUrlThumbnailUrlImageInfoCaptionFormattedCaptionProgressWatcherUseSendQueueUnderlyingReturnValue + return sendImageParamsThumbnailPathImageInfoProgressWatcherUnderlyingReturnValue } else { var returnValue: SendAttachmentJoinHandle? = nil DispatchQueue.main.sync { - returnValue = sendImageUrlThumbnailUrlImageInfoCaptionFormattedCaptionProgressWatcherUseSendQueueUnderlyingReturnValue + returnValue = sendImageParamsThumbnailPathImageInfoProgressWatcherUnderlyingReturnValue } return returnValue! @@ -20104,26 +20182,29 @@ open class TimelineSDKMock: MatrixRustSDK.Timeline { } set { if Thread.isMainThread { - sendImageUrlThumbnailUrlImageInfoCaptionFormattedCaptionProgressWatcherUseSendQueueUnderlyingReturnValue = newValue + sendImageParamsThumbnailPathImageInfoProgressWatcherUnderlyingReturnValue = newValue } else { DispatchQueue.main.sync { - sendImageUrlThumbnailUrlImageInfoCaptionFormattedCaptionProgressWatcherUseSendQueueUnderlyingReturnValue = newValue + sendImageParamsThumbnailPathImageInfoProgressWatcherUnderlyingReturnValue = newValue } } } } - open var sendImageUrlThumbnailUrlImageInfoCaptionFormattedCaptionProgressWatcherUseSendQueueClosure: ((String, String?, ImageInfo, String?, FormattedBody?, ProgressWatcher?, Bool) -> SendAttachmentJoinHandle)? + open var sendImageParamsThumbnailPathImageInfoProgressWatcherClosure: ((UploadParameters, String?, ImageInfo, ProgressWatcher?) throws -> SendAttachmentJoinHandle)? - open override func sendImage(url: String, thumbnailUrl: String?, imageInfo: ImageInfo, caption: String?, formattedCaption: FormattedBody?, progressWatcher: ProgressWatcher?, useSendQueue: Bool) -> SendAttachmentJoinHandle { - sendImageUrlThumbnailUrlImageInfoCaptionFormattedCaptionProgressWatcherUseSendQueueCallsCount += 1 - sendImageUrlThumbnailUrlImageInfoCaptionFormattedCaptionProgressWatcherUseSendQueueReceivedArguments = (url: url, thumbnailUrl: thumbnailUrl, imageInfo: imageInfo, caption: caption, formattedCaption: formattedCaption, progressWatcher: progressWatcher, useSendQueue: useSendQueue) + open override func sendImage(params: UploadParameters, thumbnailPath: String?, imageInfo: ImageInfo, progressWatcher: ProgressWatcher?) throws -> SendAttachmentJoinHandle { + if let error = sendImageParamsThumbnailPathImageInfoProgressWatcherThrowableError { + throw error + } + sendImageParamsThumbnailPathImageInfoProgressWatcherCallsCount += 1 + sendImageParamsThumbnailPathImageInfoProgressWatcherReceivedArguments = (params: params, thumbnailPath: thumbnailPath, imageInfo: imageInfo, progressWatcher: progressWatcher) DispatchQueue.main.async { - self.sendImageUrlThumbnailUrlImageInfoCaptionFormattedCaptionProgressWatcherUseSendQueueReceivedInvocations.append((url: url, thumbnailUrl: thumbnailUrl, imageInfo: imageInfo, caption: caption, formattedCaption: formattedCaption, progressWatcher: progressWatcher, useSendQueue: useSendQueue)) + self.sendImageParamsThumbnailPathImageInfoProgressWatcherReceivedInvocations.append((params: params, thumbnailPath: thumbnailPath, imageInfo: imageInfo, progressWatcher: progressWatcher)) } - if let sendImageUrlThumbnailUrlImageInfoCaptionFormattedCaptionProgressWatcherUseSendQueueClosure = sendImageUrlThumbnailUrlImageInfoCaptionFormattedCaptionProgressWatcherUseSendQueueClosure { - return sendImageUrlThumbnailUrlImageInfoCaptionFormattedCaptionProgressWatcherUseSendQueueClosure(url, thumbnailUrl, imageInfo, caption, formattedCaption, progressWatcher, useSendQueue) + if let sendImageParamsThumbnailPathImageInfoProgressWatcherClosure = sendImageParamsThumbnailPathImageInfoProgressWatcherClosure { + return try sendImageParamsThumbnailPathImageInfoProgressWatcherClosure(params, thumbnailPath, imageInfo, progressWatcher) } else { - return sendImageUrlThumbnailUrlImageInfoCaptionFormattedCaptionProgressWatcherUseSendQueueReturnValue + return sendImageParamsThumbnailPathImageInfoProgressWatcherReturnValue } } @@ -20309,15 +20390,16 @@ open class TimelineSDKMock: MatrixRustSDK.Timeline { //MARK: - sendVideo - var sendVideoUrlThumbnailUrlVideoInfoCaptionFormattedCaptionProgressWatcherUseSendQueueUnderlyingCallsCount = 0 - open var sendVideoUrlThumbnailUrlVideoInfoCaptionFormattedCaptionProgressWatcherUseSendQueueCallsCount: Int { + open var sendVideoParamsThumbnailPathVideoInfoProgressWatcherThrowableError: Error? + var sendVideoParamsThumbnailPathVideoInfoProgressWatcherUnderlyingCallsCount = 0 + open var sendVideoParamsThumbnailPathVideoInfoProgressWatcherCallsCount: Int { get { if Thread.isMainThread { - return sendVideoUrlThumbnailUrlVideoInfoCaptionFormattedCaptionProgressWatcherUseSendQueueUnderlyingCallsCount + return sendVideoParamsThumbnailPathVideoInfoProgressWatcherUnderlyingCallsCount } else { var returnValue: Int? = nil DispatchQueue.main.sync { - returnValue = sendVideoUrlThumbnailUrlVideoInfoCaptionFormattedCaptionProgressWatcherUseSendQueueUnderlyingCallsCount + returnValue = sendVideoParamsThumbnailPathVideoInfoProgressWatcherUnderlyingCallsCount } return returnValue! @@ -20325,29 +20407,29 @@ open class TimelineSDKMock: MatrixRustSDK.Timeline { } set { if Thread.isMainThread { - sendVideoUrlThumbnailUrlVideoInfoCaptionFormattedCaptionProgressWatcherUseSendQueueUnderlyingCallsCount = newValue + sendVideoParamsThumbnailPathVideoInfoProgressWatcherUnderlyingCallsCount = newValue } else { DispatchQueue.main.sync { - sendVideoUrlThumbnailUrlVideoInfoCaptionFormattedCaptionProgressWatcherUseSendQueueUnderlyingCallsCount = newValue + sendVideoParamsThumbnailPathVideoInfoProgressWatcherUnderlyingCallsCount = newValue } } } } - open var sendVideoUrlThumbnailUrlVideoInfoCaptionFormattedCaptionProgressWatcherUseSendQueueCalled: Bool { - return sendVideoUrlThumbnailUrlVideoInfoCaptionFormattedCaptionProgressWatcherUseSendQueueCallsCount > 0 + open var sendVideoParamsThumbnailPathVideoInfoProgressWatcherCalled: Bool { + return sendVideoParamsThumbnailPathVideoInfoProgressWatcherCallsCount > 0 } - open var sendVideoUrlThumbnailUrlVideoInfoCaptionFormattedCaptionProgressWatcherUseSendQueueReceivedArguments: (url: String, thumbnailUrl: String?, videoInfo: VideoInfo, caption: String?, formattedCaption: FormattedBody?, progressWatcher: ProgressWatcher?, useSendQueue: Bool)? - open var sendVideoUrlThumbnailUrlVideoInfoCaptionFormattedCaptionProgressWatcherUseSendQueueReceivedInvocations: [(url: String, thumbnailUrl: String?, videoInfo: VideoInfo, caption: String?, formattedCaption: FormattedBody?, progressWatcher: ProgressWatcher?, useSendQueue: Bool)] = [] + open var sendVideoParamsThumbnailPathVideoInfoProgressWatcherReceivedArguments: (params: UploadParameters, thumbnailPath: String?, videoInfo: VideoInfo, progressWatcher: ProgressWatcher?)? + open var sendVideoParamsThumbnailPathVideoInfoProgressWatcherReceivedInvocations: [(params: UploadParameters, thumbnailPath: String?, videoInfo: VideoInfo, progressWatcher: ProgressWatcher?)] = [] - var sendVideoUrlThumbnailUrlVideoInfoCaptionFormattedCaptionProgressWatcherUseSendQueueUnderlyingReturnValue: SendAttachmentJoinHandle! - open var sendVideoUrlThumbnailUrlVideoInfoCaptionFormattedCaptionProgressWatcherUseSendQueueReturnValue: SendAttachmentJoinHandle! { + var sendVideoParamsThumbnailPathVideoInfoProgressWatcherUnderlyingReturnValue: SendAttachmentJoinHandle! + open var sendVideoParamsThumbnailPathVideoInfoProgressWatcherReturnValue: SendAttachmentJoinHandle! { get { if Thread.isMainThread { - return sendVideoUrlThumbnailUrlVideoInfoCaptionFormattedCaptionProgressWatcherUseSendQueueUnderlyingReturnValue + return sendVideoParamsThumbnailPathVideoInfoProgressWatcherUnderlyingReturnValue } else { var returnValue: SendAttachmentJoinHandle? = nil DispatchQueue.main.sync { - returnValue = sendVideoUrlThumbnailUrlVideoInfoCaptionFormattedCaptionProgressWatcherUseSendQueueUnderlyingReturnValue + returnValue = sendVideoParamsThumbnailPathVideoInfoProgressWatcherUnderlyingReturnValue } return returnValue! @@ -20355,40 +20437,44 @@ open class TimelineSDKMock: MatrixRustSDK.Timeline { } set { if Thread.isMainThread { - sendVideoUrlThumbnailUrlVideoInfoCaptionFormattedCaptionProgressWatcherUseSendQueueUnderlyingReturnValue = newValue + sendVideoParamsThumbnailPathVideoInfoProgressWatcherUnderlyingReturnValue = newValue } else { DispatchQueue.main.sync { - sendVideoUrlThumbnailUrlVideoInfoCaptionFormattedCaptionProgressWatcherUseSendQueueUnderlyingReturnValue = newValue + sendVideoParamsThumbnailPathVideoInfoProgressWatcherUnderlyingReturnValue = newValue } } } } - open var sendVideoUrlThumbnailUrlVideoInfoCaptionFormattedCaptionProgressWatcherUseSendQueueClosure: ((String, String?, VideoInfo, String?, FormattedBody?, ProgressWatcher?, Bool) -> SendAttachmentJoinHandle)? + open var sendVideoParamsThumbnailPathVideoInfoProgressWatcherClosure: ((UploadParameters, String?, VideoInfo, ProgressWatcher?) throws -> SendAttachmentJoinHandle)? - open override func sendVideo(url: String, thumbnailUrl: String?, videoInfo: VideoInfo, caption: String?, formattedCaption: FormattedBody?, progressWatcher: ProgressWatcher?, useSendQueue: Bool) -> SendAttachmentJoinHandle { - sendVideoUrlThumbnailUrlVideoInfoCaptionFormattedCaptionProgressWatcherUseSendQueueCallsCount += 1 - sendVideoUrlThumbnailUrlVideoInfoCaptionFormattedCaptionProgressWatcherUseSendQueueReceivedArguments = (url: url, thumbnailUrl: thumbnailUrl, videoInfo: videoInfo, caption: caption, formattedCaption: formattedCaption, progressWatcher: progressWatcher, useSendQueue: useSendQueue) + open override func sendVideo(params: UploadParameters, thumbnailPath: String?, videoInfo: VideoInfo, progressWatcher: ProgressWatcher?) throws -> SendAttachmentJoinHandle { + if let error = sendVideoParamsThumbnailPathVideoInfoProgressWatcherThrowableError { + throw error + } + sendVideoParamsThumbnailPathVideoInfoProgressWatcherCallsCount += 1 + sendVideoParamsThumbnailPathVideoInfoProgressWatcherReceivedArguments = (params: params, thumbnailPath: thumbnailPath, videoInfo: videoInfo, progressWatcher: progressWatcher) DispatchQueue.main.async { - self.sendVideoUrlThumbnailUrlVideoInfoCaptionFormattedCaptionProgressWatcherUseSendQueueReceivedInvocations.append((url: url, thumbnailUrl: thumbnailUrl, videoInfo: videoInfo, caption: caption, formattedCaption: formattedCaption, progressWatcher: progressWatcher, useSendQueue: useSendQueue)) + self.sendVideoParamsThumbnailPathVideoInfoProgressWatcherReceivedInvocations.append((params: params, thumbnailPath: thumbnailPath, videoInfo: videoInfo, progressWatcher: progressWatcher)) } - if let sendVideoUrlThumbnailUrlVideoInfoCaptionFormattedCaptionProgressWatcherUseSendQueueClosure = sendVideoUrlThumbnailUrlVideoInfoCaptionFormattedCaptionProgressWatcherUseSendQueueClosure { - return sendVideoUrlThumbnailUrlVideoInfoCaptionFormattedCaptionProgressWatcherUseSendQueueClosure(url, thumbnailUrl, videoInfo, caption, formattedCaption, progressWatcher, useSendQueue) + if let sendVideoParamsThumbnailPathVideoInfoProgressWatcherClosure = sendVideoParamsThumbnailPathVideoInfoProgressWatcherClosure { + return try sendVideoParamsThumbnailPathVideoInfoProgressWatcherClosure(params, thumbnailPath, videoInfo, progressWatcher) } else { - return sendVideoUrlThumbnailUrlVideoInfoCaptionFormattedCaptionProgressWatcherUseSendQueueReturnValue + return sendVideoParamsThumbnailPathVideoInfoProgressWatcherReturnValue } } //MARK: - sendVoiceMessage - var sendVoiceMessageUrlAudioInfoWaveformCaptionFormattedCaptionProgressWatcherUseSendQueueUnderlyingCallsCount = 0 - open var sendVoiceMessageUrlAudioInfoWaveformCaptionFormattedCaptionProgressWatcherUseSendQueueCallsCount: Int { + open var sendVoiceMessageParamsAudioInfoWaveformProgressWatcherThrowableError: Error? + var sendVoiceMessageParamsAudioInfoWaveformProgressWatcherUnderlyingCallsCount = 0 + open var sendVoiceMessageParamsAudioInfoWaveformProgressWatcherCallsCount: Int { get { if Thread.isMainThread { - return sendVoiceMessageUrlAudioInfoWaveformCaptionFormattedCaptionProgressWatcherUseSendQueueUnderlyingCallsCount + return sendVoiceMessageParamsAudioInfoWaveformProgressWatcherUnderlyingCallsCount } else { var returnValue: Int? = nil DispatchQueue.main.sync { - returnValue = sendVoiceMessageUrlAudioInfoWaveformCaptionFormattedCaptionProgressWatcherUseSendQueueUnderlyingCallsCount + returnValue = sendVoiceMessageParamsAudioInfoWaveformProgressWatcherUnderlyingCallsCount } return returnValue! @@ -20396,29 +20482,29 @@ open class TimelineSDKMock: MatrixRustSDK.Timeline { } set { if Thread.isMainThread { - sendVoiceMessageUrlAudioInfoWaveformCaptionFormattedCaptionProgressWatcherUseSendQueueUnderlyingCallsCount = newValue + sendVoiceMessageParamsAudioInfoWaveformProgressWatcherUnderlyingCallsCount = newValue } else { DispatchQueue.main.sync { - sendVoiceMessageUrlAudioInfoWaveformCaptionFormattedCaptionProgressWatcherUseSendQueueUnderlyingCallsCount = newValue + sendVoiceMessageParamsAudioInfoWaveformProgressWatcherUnderlyingCallsCount = newValue } } } } - open var sendVoiceMessageUrlAudioInfoWaveformCaptionFormattedCaptionProgressWatcherUseSendQueueCalled: Bool { - return sendVoiceMessageUrlAudioInfoWaveformCaptionFormattedCaptionProgressWatcherUseSendQueueCallsCount > 0 + open var sendVoiceMessageParamsAudioInfoWaveformProgressWatcherCalled: Bool { + return sendVoiceMessageParamsAudioInfoWaveformProgressWatcherCallsCount > 0 } - open var sendVoiceMessageUrlAudioInfoWaveformCaptionFormattedCaptionProgressWatcherUseSendQueueReceivedArguments: (url: String, audioInfo: AudioInfo, waveform: [UInt16], caption: String?, formattedCaption: FormattedBody?, progressWatcher: ProgressWatcher?, useSendQueue: Bool)? - open var sendVoiceMessageUrlAudioInfoWaveformCaptionFormattedCaptionProgressWatcherUseSendQueueReceivedInvocations: [(url: String, audioInfo: AudioInfo, waveform: [UInt16], caption: String?, formattedCaption: FormattedBody?, progressWatcher: ProgressWatcher?, useSendQueue: Bool)] = [] + open var sendVoiceMessageParamsAudioInfoWaveformProgressWatcherReceivedArguments: (params: UploadParameters, audioInfo: AudioInfo, waveform: [UInt16], progressWatcher: ProgressWatcher?)? + open var sendVoiceMessageParamsAudioInfoWaveformProgressWatcherReceivedInvocations: [(params: UploadParameters, audioInfo: AudioInfo, waveform: [UInt16], progressWatcher: ProgressWatcher?)] = [] - var sendVoiceMessageUrlAudioInfoWaveformCaptionFormattedCaptionProgressWatcherUseSendQueueUnderlyingReturnValue: SendAttachmentJoinHandle! - open var sendVoiceMessageUrlAudioInfoWaveformCaptionFormattedCaptionProgressWatcherUseSendQueueReturnValue: SendAttachmentJoinHandle! { + var sendVoiceMessageParamsAudioInfoWaveformProgressWatcherUnderlyingReturnValue: SendAttachmentJoinHandle! + open var sendVoiceMessageParamsAudioInfoWaveformProgressWatcherReturnValue: SendAttachmentJoinHandle! { get { if Thread.isMainThread { - return sendVoiceMessageUrlAudioInfoWaveformCaptionFormattedCaptionProgressWatcherUseSendQueueUnderlyingReturnValue + return sendVoiceMessageParamsAudioInfoWaveformProgressWatcherUnderlyingReturnValue } else { var returnValue: SendAttachmentJoinHandle? = nil DispatchQueue.main.sync { - returnValue = sendVoiceMessageUrlAudioInfoWaveformCaptionFormattedCaptionProgressWatcherUseSendQueueUnderlyingReturnValue + returnValue = sendVoiceMessageParamsAudioInfoWaveformProgressWatcherUnderlyingReturnValue } return returnValue! @@ -20426,26 +20512,29 @@ open class TimelineSDKMock: MatrixRustSDK.Timeline { } set { if Thread.isMainThread { - sendVoiceMessageUrlAudioInfoWaveformCaptionFormattedCaptionProgressWatcherUseSendQueueUnderlyingReturnValue = newValue + sendVoiceMessageParamsAudioInfoWaveformProgressWatcherUnderlyingReturnValue = newValue } else { DispatchQueue.main.sync { - sendVoiceMessageUrlAudioInfoWaveformCaptionFormattedCaptionProgressWatcherUseSendQueueUnderlyingReturnValue = newValue + sendVoiceMessageParamsAudioInfoWaveformProgressWatcherUnderlyingReturnValue = newValue } } } } - open var sendVoiceMessageUrlAudioInfoWaveformCaptionFormattedCaptionProgressWatcherUseSendQueueClosure: ((String, AudioInfo, [UInt16], String?, FormattedBody?, ProgressWatcher?, Bool) -> SendAttachmentJoinHandle)? + open var sendVoiceMessageParamsAudioInfoWaveformProgressWatcherClosure: ((UploadParameters, AudioInfo, [UInt16], ProgressWatcher?) throws -> SendAttachmentJoinHandle)? - open override func sendVoiceMessage(url: String, audioInfo: AudioInfo, waveform: [UInt16], caption: String?, formattedCaption: FormattedBody?, progressWatcher: ProgressWatcher?, useSendQueue: Bool) -> SendAttachmentJoinHandle { - sendVoiceMessageUrlAudioInfoWaveformCaptionFormattedCaptionProgressWatcherUseSendQueueCallsCount += 1 - sendVoiceMessageUrlAudioInfoWaveformCaptionFormattedCaptionProgressWatcherUseSendQueueReceivedArguments = (url: url, audioInfo: audioInfo, waveform: waveform, caption: caption, formattedCaption: formattedCaption, progressWatcher: progressWatcher, useSendQueue: useSendQueue) + open override func sendVoiceMessage(params: UploadParameters, audioInfo: AudioInfo, waveform: [UInt16], progressWatcher: ProgressWatcher?) throws -> SendAttachmentJoinHandle { + if let error = sendVoiceMessageParamsAudioInfoWaveformProgressWatcherThrowableError { + throw error + } + sendVoiceMessageParamsAudioInfoWaveformProgressWatcherCallsCount += 1 + sendVoiceMessageParamsAudioInfoWaveformProgressWatcherReceivedArguments = (params: params, audioInfo: audioInfo, waveform: waveform, progressWatcher: progressWatcher) DispatchQueue.main.async { - self.sendVoiceMessageUrlAudioInfoWaveformCaptionFormattedCaptionProgressWatcherUseSendQueueReceivedInvocations.append((url: url, audioInfo: audioInfo, waveform: waveform, caption: caption, formattedCaption: formattedCaption, progressWatcher: progressWatcher, useSendQueue: useSendQueue)) + self.sendVoiceMessageParamsAudioInfoWaveformProgressWatcherReceivedInvocations.append((params: params, audioInfo: audioInfo, waveform: waveform, progressWatcher: progressWatcher)) } - if let sendVoiceMessageUrlAudioInfoWaveformCaptionFormattedCaptionProgressWatcherUseSendQueueClosure = sendVoiceMessageUrlAudioInfoWaveformCaptionFormattedCaptionProgressWatcherUseSendQueueClosure { - return sendVoiceMessageUrlAudioInfoWaveformCaptionFormattedCaptionProgressWatcherUseSendQueueClosure(url, audioInfo, waveform, caption, formattedCaption, progressWatcher, useSendQueue) + if let sendVoiceMessageParamsAudioInfoWaveformProgressWatcherClosure = sendVoiceMessageParamsAudioInfoWaveformProgressWatcherClosure { + return try sendVoiceMessageParamsAudioInfoWaveformProgressWatcherClosure(params, audioInfo, waveform, progressWatcher) } else { - return sendVoiceMessageUrlAudioInfoWaveformCaptionFormattedCaptionProgressWatcherUseSendQueueReturnValue + return sendVoiceMessageParamsAudioInfoWaveformProgressWatcherReturnValue } } @@ -21481,13 +21570,13 @@ open class TimelineEventSDKMock: MatrixRustSDK.TimelineEvent { return timestampCallsCount > 0 } - var timestampUnderlyingReturnValue: UInt64! - open var timestampReturnValue: UInt64! { + var timestampUnderlyingReturnValue: Timestamp! + open var timestampReturnValue: Timestamp! { get { if Thread.isMainThread { return timestampUnderlyingReturnValue } else { - var returnValue: UInt64? = nil + var returnValue: Timestamp? = nil DispatchQueue.main.sync { returnValue = timestampUnderlyingReturnValue } @@ -21505,9 +21594,9 @@ open class TimelineEventSDKMock: MatrixRustSDK.TimelineEvent { } } } - open var timestampClosure: (() -> UInt64)? + open var timestampClosure: (() -> Timestamp)? - open override func timestamp() -> UInt64 { + open override func timestamp() -> Timestamp { timestampCallsCount += 1 if let timestampClosure = timestampClosure { return timestampClosure() diff --git a/ElementX/Sources/Mocks/PhotoLibraryManagerMock.swift b/ElementX/Sources/Mocks/PhotoLibraryManagerMock.swift index 3eba13650d..716f94c5bb 100644 --- a/ElementX/Sources/Mocks/PhotoLibraryManagerMock.swift +++ b/ElementX/Sources/Mocks/PhotoLibraryManagerMock.swift @@ -12,7 +12,6 @@ extension PhotoLibraryManagerMock { var authorizationDenied = false } - // swiftlint:disable:next cyclomatic_complexity convenience init(_ configuration: Configuration) { self.init() diff --git a/ElementX/Sources/Services/Timeline/TimelineController/RoomTimelineController.swift b/ElementX/Sources/Services/Timeline/TimelineController/RoomTimelineController.swift index 9e765bbd5d..691073f28f 100644 --- a/ElementX/Sources/Services/Timeline/TimelineController/RoomTimelineController.swift +++ b/ElementX/Sources/Services/Timeline/TimelineController/RoomTimelineController.swift @@ -255,11 +255,12 @@ class RoomTimelineController: RoomTimelineControllerProtocol { message: String, html: String?, intentionalMentions: IntentionalMentions) async { - // We're waiting on an API for including mentions: https://github.com/matrix-org/matrix-rust-sdk/issues/4302 MXLog.info("Editing timeline item caption: \(eventOrTransactionID) in \(roomID)") // When formattedCaption is nil, caption will be parsed as markdown and generate the HTML for us. - let newContent = createCaptionEdit(caption: message, formattedCaption: html.map { .init(format: .html, body: $0) }) + let newContent = createCaptionEdit(caption: message, + formattedCaption: html.map { .init(format: .html, body: $0) }, + mentions: intentionalMentions.toRustMentions()) switch await activeTimeline.edit(eventOrTransactionID, newContent: newContent) { case .success: MXLog.info("Finished editing caption") @@ -270,7 +271,7 @@ class RoomTimelineController: RoomTimelineControllerProtocol { func removeCaption(_ eventOrTransactionID: EventOrTransactionId) async { // Set a `nil` caption to remove it from the event. - let newContent = createCaptionEdit(caption: nil, formattedCaption: nil) + let newContent = createCaptionEdit(caption: nil, formattedCaption: nil, mentions: nil) switch await activeTimeline.edit(eventOrTransactionID, newContent: newContent) { case .success: MXLog.info("Finished removing caption.") diff --git a/ElementX/Sources/Services/Timeline/TimelineProxy.swift b/ElementX/Sources/Services/Timeline/TimelineProxy.swift index dace6b943b..0513bad4f8 100644 --- a/ElementX/Sources/Services/Timeline/TimelineProxy.swift +++ b/ElementX/Sources/Services/Timeline/TimelineProxy.swift @@ -229,16 +229,17 @@ final class TimelineProxy: TimelineProxyProtocol { requestHandle: @MainActor (SendAttachmentJoinHandleProtocol) -> Void) async -> Result { MXLog.info("Sending audio") - let handle = timeline.sendAudio(url: url.path(percentEncoded: false), - audioInfo: audioInfo, - caption: caption, - formattedCaption: nil, // Rust will build this from the caption's markdown. - progressWatcher: nil, - useSendQueue: true) - - await requestHandle(handle) - do { + let handle = try timeline.sendAudio(params: .init(filename: url.path(percentEncoded: false), + caption: caption, + formattedCaption: nil, // Rust will build this from the caption's markdown. + mentions: nil, + useSendQueue: true), + audioInfo: audioInfo, + progressWatcher: nil) + + await requestHandle(handle) + try await handle.join() MXLog.info("Finished sending audio") } catch { @@ -255,16 +256,17 @@ final class TimelineProxy: TimelineProxyProtocol { requestHandle: @MainActor (SendAttachmentJoinHandleProtocol) -> Void) async -> Result { MXLog.info("Sending file") - let handle = timeline.sendFile(url: url.path(percentEncoded: false), - fileInfo: fileInfo, - caption: caption, - formattedCaption: nil, // Rust will build this from the caption's markdown. - progressWatcher: nil, - useSendQueue: true) - - await requestHandle(handle) - do { + let handle = try timeline.sendFile(params: .init(filename: url.path(percentEncoded: false), + caption: caption, + formattedCaption: nil, // Rust will build this from the caption's markdown. + mentions: nil, + useSendQueue: true), + fileInfo: fileInfo, + progressWatcher: nil) + + await requestHandle(handle) + try await handle.join() MXLog.info("Finished sending file") } catch { @@ -282,17 +284,18 @@ final class TimelineProxy: TimelineProxyProtocol { requestHandle: @MainActor (SendAttachmentJoinHandleProtocol) -> Void) async -> Result { MXLog.info("Sending image") - let handle = timeline.sendImage(url: url.path(percentEncoded: false), - thumbnailUrl: thumbnailURL.path(percentEncoded: false), - imageInfo: imageInfo, - caption: caption, - formattedCaption: nil, // Rust will build this from the caption's markdown. - progressWatcher: nil, - useSendQueue: true) - - await requestHandle(handle) - do { + let handle = try timeline.sendImage(params: .init(filename: url.path(percentEncoded: false), + caption: caption, + formattedCaption: nil, // Rust will build this from the caption's markdown. + mentions: nil, + useSendQueue: true), + thumbnailPath: thumbnailURL.path(percentEncoded: false), + imageInfo: imageInfo, + progressWatcher: nil) + + await requestHandle(handle) + try await handle.join() MXLog.info("Finished sending image") } catch { @@ -328,17 +331,18 @@ final class TimelineProxy: TimelineProxyProtocol { requestHandle: @MainActor (SendAttachmentJoinHandleProtocol) -> Void) async -> Result { MXLog.info("Sending video") - let handle = timeline.sendVideo(url: url.path(percentEncoded: false), - thumbnailUrl: thumbnailURL.path(percentEncoded: false), - videoInfo: videoInfo, - caption: caption, - formattedCaption: nil, // Rust will build this from the caption's markdown. - progressWatcher: nil, - useSendQueue: true) - - await requestHandle(handle) - do { + let handle = try timeline.sendVideo(params: .init(filename: url.path(percentEncoded: false), + caption: caption, + formattedCaption: nil, + mentions: nil, + useSendQueue: true), + thumbnailPath: thumbnailURL.path(percentEncoded: false), + videoInfo: videoInfo, + progressWatcher: nil) + + await requestHandle(handle) + try await handle.join() MXLog.info("Finished sending video") } catch { @@ -355,17 +359,18 @@ final class TimelineProxy: TimelineProxyProtocol { requestHandle: @MainActor (SendAttachmentJoinHandleProtocol) -> Void) async -> Result { MXLog.info("Sending voice message") - let handle = timeline.sendVoiceMessage(url: url.path(percentEncoded: false), - audioInfo: audioInfo, - waveform: waveform, - caption: nil, - formattedCaption: nil, - progressWatcher: nil, - useSendQueue: true) - - await requestHandle(handle) - do { + let handle = try timeline.sendVoiceMessage(params: .init(filename: url.path(percentEncoded: false), + caption: nil, + formattedCaption: nil, + mentions: nil, + useSendQueue: true), + audioInfo: audioInfo, + waveform: waveform, + progressWatcher: nil) + + await requestHandle(handle) + try await handle.join() MXLog.info("Finished sending voice message") } catch { diff --git a/project.yml b/project.yml index ba803c7823..c3fa4a9da7 100644 --- a/project.yml +++ b/project.yml @@ -61,7 +61,7 @@ packages: # Element/Matrix dependencies MatrixRustSDK: url: https://github.com/element-hq/matrix-rust-components-swift - exactVersion: 24.12.20 + exactVersion: 25.01.10-2 # path: ../matrix-rust-sdk Compound: url: https://github.com/element-hq/compound-ios