From c392c57c257ef3d5f02ae032eb748c2f3c5dcb47 Mon Sep 17 00:00:00 2001 From: Stefan Ceriu Date: Tue, 1 Apr 2025 09:45:53 +0300 Subject: [PATCH] Bump the RustSDK to v25.03.31 - adopt new async throwing methods - use the sdk side TimelineStart virtual timeline item - remove async from `directRoomForUserID` as it's not async on the rust side - remove async from `retryDecryption` as it's spawning not blocking on the rust side --- ElementX.xcodeproj/project.pbxproj | 2 +- .../xcshareddata/swiftpm/Package.resolved | 4 +- .../Mocks/Generated/GeneratedMocks.swift | 12 ++-- .../Mocks/Generated/SDKGeneratedMocks.swift | 62 +++++++++++++++++-- .../RoomMemberDetailsScreenViewModel.swift | 8 +-- .../RoomScreen/RoomScreenViewModel.swift | 4 +- .../StartChatScreenViewModel.swift | 25 ++++---- .../UserProfileScreenViewModel.swift | 9 +-- .../Sources/Services/Client/ClientProxy.swift | 16 +++-- .../Services/Client/ClientProxyProtocol.swift | 2 +- .../Services/Room/JoinedRoomProxy.swift | 22 ++++--- .../TimelineController.swift | 12 ++-- .../Services/Timeline/TimelineProvider.swift | 2 + .../Services/Timeline/TimelineProxy.swift | 28 ++++----- .../Timeline/TimelineProxyProtocol.swift | 8 +-- project.yml | 2 +- 16 files changed, 130 insertions(+), 88 deletions(-) diff --git a/ElementX.xcodeproj/project.pbxproj b/ElementX.xcodeproj/project.pbxproj index e0f5e7356..e70de42a5 100644 --- a/ElementX.xcodeproj/project.pbxproj +++ b/ElementX.xcodeproj/project.pbxproj @@ -8549,7 +8549,7 @@ repositoryURL = "https://github.com/element-hq/matrix-rust-components-swift"; requirement = { kind = exactVersion; - version = 25.03.24; + version = 25.03.31; }; }; 701C7BEF8F70F7A83E852DCC /* XCRemoteSwiftPackageReference "GZIP" */ = { diff --git a/ElementX.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved b/ElementX.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved index c826c422c..c4df83f9e 100644 --- a/ElementX.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved +++ b/ElementX.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved @@ -158,8 +158,8 @@ "kind" : "remoteSourceControl", "location" : "https://github.com/element-hq/matrix-rust-components-swift", "state" : { - "revision" : "0da89f2a2ddaf2306144f42aed642af3f3228a1c", - "version" : "25.3.24" + "revision" : "271f8e34dd754ff6873350576d601442fe18b1d8", + "version" : "25.3.31" } }, { diff --git a/ElementX/Sources/Mocks/Generated/GeneratedMocks.swift b/ElementX/Sources/Mocks/Generated/GeneratedMocks.swift index 957e22a28..47411e300 100644 --- a/ElementX/Sources/Mocks/Generated/GeneratedMocks.swift +++ b/ElementX/Sources/Mocks/Generated/GeneratedMocks.swift @@ -2599,16 +2599,16 @@ class ClientProxyMock: ClientProxyProtocol, @unchecked Sendable { } } } - var directRoomForUserIDClosure: ((String) async -> Result)? + var directRoomForUserIDClosure: ((String) -> Result)? - func directRoomForUserID(_ userID: String) async -> Result { + func directRoomForUserID(_ userID: String) -> Result { directRoomForUserIDCallsCount += 1 directRoomForUserIDReceivedUserID = userID DispatchQueue.main.async { self.directRoomForUserIDReceivedInvocations.append(userID) } if let directRoomForUserIDClosure = directRoomForUserIDClosure { - return await directRoomForUserIDClosure(userID) + return directRoomForUserIDClosure(userID) } else { return directRoomForUserIDReturnValue } @@ -15143,15 +15143,15 @@ class TimelineProxyMock: TimelineProxyProtocol, @unchecked Sendable { } var retryDecryptionSessionIDsReceivedSessionIDs: [String]? var retryDecryptionSessionIDsReceivedInvocations: [[String]?] = [] - var retryDecryptionSessionIDsClosure: (([String]?) async -> Void)? + var retryDecryptionSessionIDsClosure: (([String]?) -> Void)? - func retryDecryption(sessionIDs: [String]?) async { + func retryDecryption(sessionIDs: [String]?) { retryDecryptionSessionIDsCallsCount += 1 retryDecryptionSessionIDsReceivedSessionIDs = sessionIDs DispatchQueue.main.async { self.retryDecryptionSessionIDsReceivedInvocations.append(sessionIDs) } - await retryDecryptionSessionIDsClosure?(sessionIDs) + retryDecryptionSessionIDsClosure?(sessionIDs) } //MARK: - paginateBackwards diff --git a/ElementX/Sources/Mocks/Generated/SDKGeneratedMocks.swift b/ElementX/Sources/Mocks/Generated/SDKGeneratedMocks.swift index 7e0e01faf..7804f8f32 100644 --- a/ElementX/Sources/Mocks/Generated/SDKGeneratedMocks.swift +++ b/ElementX/Sources/Mocks/Generated/SDKGeneratedMocks.swift @@ -14727,6 +14727,7 @@ open class RoomSDKMock: MatrixRustSDK.Room, @unchecked Sendable { //MARK: - subscribeToIdentityStatusChanges + open var subscribeToIdentityStatusChangesListenerThrowableError: Error? var subscribeToIdentityStatusChangesListenerUnderlyingCallsCount = 0 open var subscribeToIdentityStatusChangesListenerCallsCount: Int { get { @@ -14781,16 +14782,19 @@ open class RoomSDKMock: MatrixRustSDK.Room, @unchecked Sendable { } } } - open var subscribeToIdentityStatusChangesListenerClosure: ((IdentityStatusChangeListener) -> TaskHandle)? + open var subscribeToIdentityStatusChangesListenerClosure: ((IdentityStatusChangeListener) async throws -> TaskHandle)? - open override func subscribeToIdentityStatusChanges(listener: IdentityStatusChangeListener) -> TaskHandle { + open override func subscribeToIdentityStatusChanges(listener: IdentityStatusChangeListener) async throws -> TaskHandle { + if let error = subscribeToIdentityStatusChangesListenerThrowableError { + throw error + } subscribeToIdentityStatusChangesListenerCallsCount += 1 subscribeToIdentityStatusChangesListenerReceivedListener = listener DispatchQueue.main.async { self.subscribeToIdentityStatusChangesListenerReceivedInvocations.append(listener) } if let subscribeToIdentityStatusChangesListenerClosure = subscribeToIdentityStatusChangesListenerClosure { - return subscribeToIdentityStatusChangesListenerClosure(listener) + return try await subscribeToIdentityStatusChangesListenerClosure(listener) } else { return subscribeToIdentityStatusChangesListenerReturnValue } @@ -20227,9 +20231,9 @@ open class TimelineSDKMock: MatrixRustSDK.Timeline, @unchecked Sendable { } open var endPollPollStartEventIdTextReceivedArguments: (pollStartEventId: String, text: String)? open var endPollPollStartEventIdTextReceivedInvocations: [(pollStartEventId: String, text: String)] = [] - open var endPollPollStartEventIdTextClosure: ((String, String) throws -> Void)? + open var endPollPollStartEventIdTextClosure: ((String, String) async throws -> Void)? - open override func endPoll(pollStartEventId: String, text: String) throws { + open override func endPoll(pollStartEventId: String, text: String) async throws { if let error = endPollPollStartEventIdTextThrowableError { throw error } @@ -20238,7 +20242,7 @@ open class TimelineSDKMock: MatrixRustSDK.Timeline, @unchecked Sendable { DispatchQueue.main.async { self.endPollPollStartEventIdTextReceivedInvocations.append((pollStartEventId: pollStartEventId, text: text)) } - try endPollPollStartEventIdTextClosure?(pollStartEventId, text) + try await endPollPollStartEventIdTextClosure?(pollStartEventId, text) } //MARK: - fetchDetailsForEvent @@ -21312,6 +21316,52 @@ open class TimelineSDKMock: MatrixRustSDK.Timeline, @unchecked Sendable { try await sendReplyMsgEventIdClosure?(msg, eventId) } + //MARK: - sendThreadReply + + open var sendThreadReplyMsgEventIdIsReplyThrowableError: Error? + var sendThreadReplyMsgEventIdIsReplyUnderlyingCallsCount = 0 + open var sendThreadReplyMsgEventIdIsReplyCallsCount: Int { + get { + if Thread.isMainThread { + return sendThreadReplyMsgEventIdIsReplyUnderlyingCallsCount + } else { + var returnValue: Int? = nil + DispatchQueue.main.sync { + returnValue = sendThreadReplyMsgEventIdIsReplyUnderlyingCallsCount + } + + return returnValue! + } + } + set { + if Thread.isMainThread { + sendThreadReplyMsgEventIdIsReplyUnderlyingCallsCount = newValue + } else { + DispatchQueue.main.sync { + sendThreadReplyMsgEventIdIsReplyUnderlyingCallsCount = newValue + } + } + } + } + open var sendThreadReplyMsgEventIdIsReplyCalled: Bool { + return sendThreadReplyMsgEventIdIsReplyCallsCount > 0 + } + open var sendThreadReplyMsgEventIdIsReplyReceivedArguments: (msg: RoomMessageEventContentWithoutRelation, eventId: String, isReply: Bool)? + open var sendThreadReplyMsgEventIdIsReplyReceivedInvocations: [(msg: RoomMessageEventContentWithoutRelation, eventId: String, isReply: Bool)] = [] + open var sendThreadReplyMsgEventIdIsReplyClosure: ((RoomMessageEventContentWithoutRelation, String, Bool) async throws -> Void)? + + open override func sendThreadReply(msg: RoomMessageEventContentWithoutRelation, eventId: String, isReply: Bool) async throws { + if let error = sendThreadReplyMsgEventIdIsReplyThrowableError { + throw error + } + sendThreadReplyMsgEventIdIsReplyCallsCount += 1 + sendThreadReplyMsgEventIdIsReplyReceivedArguments = (msg: msg, eventId: eventId, isReply: isReply) + DispatchQueue.main.async { + self.sendThreadReplyMsgEventIdIsReplyReceivedInvocations.append((msg: msg, eventId: eventId, isReply: isReply)) + } + try await sendThreadReplyMsgEventIdIsReplyClosure?(msg, eventId, isReply) + } + //MARK: - sendVideo open var sendVideoParamsThumbnailPathVideoInfoProgressWatcherThrowableError: Error? diff --git a/ElementX/Sources/Screens/RoomMemberDetailsScreen/RoomMemberDetailsScreenViewModel.swift b/ElementX/Sources/Screens/RoomMemberDetailsScreen/RoomMemberDetailsScreenViewModel.swift index a2d464c40..d5ce7df66 100644 --- a/ElementX/Sources/Screens/RoomMemberDetailsScreen/RoomMemberDetailsScreenViewModel.swift +++ b/ElementX/Sources/Screens/RoomMemberDetailsScreen/RoomMemberDetailsScreenViewModel.swift @@ -80,7 +80,7 @@ class RoomMemberDetailsScreenViewModel: RoomMemberDetailsScreenViewModelType, Ro case .displayAvatar(let url): Task { await displayFullScreenAvatar(url) } case .openDirectChat: - Task { await openDirectChat() } + openDirectChat() case .createDirectChat: Task { await createDirectChat() } case .startCall(let roomID): @@ -100,7 +100,7 @@ class RoomMemberDetailsScreenViewModel: RoomMemberDetailsScreenViewModelType, Ro roomMemberProxy = member state.memberDetails = RoomMemberDetails(withProxy: member) state.isOwnMemberDetails = member.userID == roomProxy.ownUserID - switch await clientProxy.directRoomForUserID(member.userID) { + switch clientProxy.directRoomForUserID(member.userID) { case .success(let roomID): state.dmRoomID = roomID case .failure: @@ -184,7 +184,7 @@ class RoomMemberDetailsScreenViewModel: RoomMemberDetailsScreenViewModelType, Ro } } - private func openDirectChat() async { + private func openDirectChat() { guard let roomMemberProxy else { fatalError() } let loadingIndicatorIdentifier = "openDirectChatLoadingIndicator" @@ -195,7 +195,7 @@ class RoomMemberDetailsScreenViewModel: RoomMemberDetailsScreenViewModelType, Ro delay: .milliseconds(200)) defer { userIndicatorController.retractIndicatorWithId(loadingIndicatorIdentifier) } - switch await clientProxy.directRoomForUserID(roomMemberProxy.userID) { + switch clientProxy.directRoomForUserID(roomMemberProxy.userID) { case .success(let roomID): if let roomID { actionsSubject.send(.openDirectChat(roomID: roomID)) diff --git a/ElementX/Sources/Screens/RoomScreen/RoomScreenViewModel.swift b/ElementX/Sources/Screens/RoomScreen/RoomScreenViewModel.swift index a1f6b188a..59db0e1e3 100644 --- a/ElementX/Sources/Screens/RoomScreen/RoomScreenViewModel.swift +++ b/ElementX/Sources/Screens/RoomScreen/RoomScreenViewModel.swift @@ -224,9 +224,7 @@ class RoomScreenViewModel: RoomScreenViewModelType, RoomScreenViewModelProtocol NotificationCenter.default.publisher(for: UIApplication.didBecomeActiveNotification) .sink { [weak self] _ in - Task { - await self?.roomProxy.timeline.retryDecryption() - } + self?.roomProxy.timeline.retryDecryption(sessionIDs: nil) } .store(in: &cancellables) } diff --git a/ElementX/Sources/Screens/StartChatScreen/StartChatScreenViewModel.swift b/ElementX/Sources/Screens/StartChatScreen/StartChatScreenViewModel.swift index 5f5c6c8d3..aae054298 100644 --- a/ElementX/Sources/Screens/StartChatScreen/StartChatScreenViewModel.swift +++ b/ElementX/Sources/Screens/StartChatScreen/StartChatScreenViewModel.swift @@ -59,19 +59,18 @@ class StartChatScreenViewModel: StartChatScreenViewModelType, StartChatScreenVie actionsSubject.send(.createRoom) case .selectUser(let user): showLoadingIndicator(delay: .milliseconds(200)) - Task { - let currentDirectRoom = await userSession.clientProxy.directRoomForUserID(user.userID) - switch currentDirectRoom { - case .success(.some(let roomId)): - hideLoadingIndicator() - actionsSubject.send(.showRoom(withIdentifier: roomId)) - case .success: - hideLoadingIndicator() - state.bindings.selectedUserToInvite = user - case .failure: - hideLoadingIndicator() - displayError() - } + + let currentDirectRoom = userSession.clientProxy.directRoomForUserID(user.userID) + switch currentDirectRoom { + case .success(.some(let roomId)): + hideLoadingIndicator() + actionsSubject.send(.showRoom(withIdentifier: roomId)) + case .success: + hideLoadingIndicator() + state.bindings.selectedUserToInvite = user + case .failure: + hideLoadingIndicator() + displayError() } case .createDM(let user): Task { await createDirectRoom(user: user) } diff --git a/ElementX/Sources/Screens/UserProfileScreen/UserProfileScreenViewModel.swift b/ElementX/Sources/Screens/UserProfileScreen/UserProfileScreenViewModel.swift index aa6535618..4d97be85b 100644 --- a/ElementX/Sources/Screens/UserProfileScreen/UserProfileScreenViewModel.swift +++ b/ElementX/Sources/Screens/UserProfileScreen/UserProfileScreenViewModel.swift @@ -61,7 +61,7 @@ class UserProfileScreenViewModel: UserProfileScreenViewModelType, UserProfileScr case .displayAvatar(let url): Task { await displayFullScreenAvatar(url) } case .openDirectChat: - Task { await openDirectChat() } + openDirectChat() case .createDirectChat: Task { await createDirectChat() } case .startCall(let roomID): @@ -81,7 +81,8 @@ class UserProfileScreenViewModel: UserProfileScreenViewModelType, UserProfileScr case .success(let userProfile): state.userProfile = userProfile state.permalink = (try? matrixToUserPermalink(userId: state.userID)).flatMap(URL.init(string:)) - switch await clientProxy.directRoomForUserID(userProfile.userID) { + + switch clientProxy.directRoomForUserID(userProfile.userID) { case .success(let roomID): state.dmRoomID = roomID case .failure: @@ -112,13 +113,13 @@ class UserProfileScreenViewModel: UserProfileScreenViewModelType, UserProfileScr } } - private func openDirectChat() async { + private func openDirectChat() { guard let userProfile = state.userProfile else { fatalError() } showLoadingIndicator(allowsInteraction: false) defer { hideLoadingIndicator() } - switch await clientProxy.directRoomForUserID(userProfile.userID) { + switch clientProxy.directRoomForUserID(userProfile.userID) { case .success(let roomID): if let roomID { actionsSubject.send(.openDirectChat(roomID: roomID)) diff --git a/ElementX/Sources/Services/Client/ClientProxy.swift b/ElementX/Sources/Services/Client/ClientProxy.swift index dfca7b176..4379e3dcf 100644 --- a/ElementX/Sources/Services/Client/ClientProxy.swift +++ b/ElementX/Sources/Services/Client/ClientProxy.swift @@ -353,15 +353,13 @@ class ClientProxy: ClientProxyProtocol { try? await client.accountUrl(action: action).flatMap(URL.init(string:)) } - func directRoomForUserID(_ userID: String) async -> Result { - await Task.dispatch(on: clientQueue) { - do { - let roomID = try self.client.getDmRoom(userId: userID)?.id() - return .success(roomID) - } catch { - MXLog.error("Failed retrieving direct room for userID: \(userID) with error: \(error)") - return .failure(.sdkError(error)) - } + func directRoomForUserID(_ userID: String) -> Result { + do { + let roomID = try client.getDmRoom(userId: userID)?.id() + return .success(roomID) + } catch { + MXLog.error("Failed retrieving direct room for userID: \(userID) with error: \(error)") + return .failure(.sdkError(error)) } } diff --git a/ElementX/Sources/Services/Client/ClientProxyProtocol.swift b/ElementX/Sources/Services/Client/ClientProxyProtocol.swift index eb659caf3..4c66f64b5 100644 --- a/ElementX/Sources/Services/Client/ClientProxyProtocol.swift +++ b/ElementX/Sources/Services/Client/ClientProxyProtocol.swift @@ -122,7 +122,7 @@ protocol ClientProxyProtocol: AnyObject, MediaLoaderProtocol { func accountURL(action: AccountManagementAction) async -> URL? - func directRoomForUserID(_ userID: String) async -> Result + func directRoomForUserID(_ userID: String) -> Result func createDirectRoom(with userID: String, expectedRoomName: String?) async -> Result diff --git a/ElementX/Sources/Services/Room/JoinedRoomProxy.swift b/ElementX/Sources/Services/Room/JoinedRoomProxy.swift index 380c1a1df..50a1e6273 100644 --- a/ElementX/Sources/Services/Room/JoinedRoomProxy.swift +++ b/ElementX/Sources/Services/Room/JoinedRoomProxy.swift @@ -147,7 +147,7 @@ class JoinedRoomProxy: JoinedRoomProxyProtocol { await subscribeToKnockRequests() if infoPublisher.value.isEncrypted { - subscribeToIdentityStatusChanges() + await subscribeToIdentityStatusChanges() } } } @@ -763,14 +763,18 @@ class JoinedRoomProxy: JoinedRoomProxyProtocol { }) } - private func subscribeToIdentityStatusChanges() { - identityStatusChangesObservationToken = room.subscribeToIdentityStatusChanges(listener: RoomIdentityStatusChangeListener { [weak self] changes in - guard let self else { return } - - MXLog.info("Received identity status changes: \(changes)") - - identityStatusChangesSubject.send(changes) - }) + private func subscribeToIdentityStatusChanges() async { + do { + identityStatusChangesObservationToken = try await room.subscribeToIdentityStatusChanges(listener: RoomIdentityStatusChangeListener { [weak self] changes in + guard let self else { return } + + MXLog.info("Received identity status changes: \(changes)") + + identityStatusChangesSubject.send(changes) + }) + } catch { + MXLog.error("Failed subscribing to identity status changes with error: \(error)") + } } private func subscribeToKnockRequests() async { diff --git a/ElementX/Sources/Services/Timeline/TimelineController/TimelineController.swift b/ElementX/Sources/Services/Timeline/TimelineController/TimelineController.swift index 1ec917668..60909442c 100644 --- a/ElementX/Sources/Services/Timeline/TimelineController/TimelineController.swift +++ b/ElementX/Sources/Services/Timeline/TimelineController/TimelineController.swift @@ -392,6 +392,7 @@ class TimelineController: TimelineControllerProtocol { isSwitchingTimelines = false let isDM = roomProxy.isDirectOneToOneRoom + let displayName = roomProxy.infoPublisher.value.displayName var newTimelineItems = await Task.detached { [timelineItemFactory, activeTimeline] in var newTimelineItems = [RoomTimelineItemProtocol]() @@ -404,6 +405,7 @@ class TimelineController: TimelineControllerProtocol { let items = collapsibleChunk.compactMap { itemProxy in let timelineItem = self.buildTimelineItem(for: itemProxy, isDM: isDM, + roomDisplayName: displayName, timelineItemFactory: timelineItemFactory, activeTimeline: activeTimeline) @@ -432,14 +434,9 @@ class TimelineController: TimelineControllerProtocol { // Check if we need to add anything to the top of the timeline. switch paginationState.backward { - case .timelineEndReached: - if timelineKind != .pinned, !roomProxy.isDirectOneToOneRoom { - let timelineStart = TimelineStartRoomTimelineItem(name: roomProxy.infoPublisher.value.displayName) - newTimelineItems.insert(timelineStart, at: 0) - } case .paginating: newTimelineItems.insert(PaginationIndicatorRoomTimelineItem(position: .start), at: 0) - case .idle: + case .idle, .timelineEndReached: break } @@ -458,6 +455,7 @@ class TimelineController: TimelineControllerProtocol { private nonisolated func buildTimelineItem(for itemProxy: TimelineItemProxy, isDM: Bool, + roomDisplayName: String?, timelineItemFactory: RoomTimelineItemFactoryProtocol, activeTimeline: TimelineProxyProtocol) -> RoomTimelineItemProtocol? { switch itemProxy { @@ -480,6 +478,8 @@ class TimelineController: TimelineControllerProtocol { return SeparatorRoomTimelineItem(id: .virtual(uniqueID: uniqueID), timestamp: date) case .readMarker: return ReadMarkerRoomTimelineItem(id: .virtual(uniqueID: uniqueID)) + case .timelineStart: + return isDM ? nil : TimelineStartRoomTimelineItem(name: roomDisplayName) } case .unknown: return nil diff --git a/ElementX/Sources/Services/Timeline/TimelineProvider.swift b/ElementX/Sources/Services/Timeline/TimelineProvider.swift index e384f3d39..956e8e32e 100644 --- a/ElementX/Sources/Services/Timeline/TimelineProvider.swift +++ b/ElementX/Sources/Services/Timeline/TimelineProvider.swift @@ -209,6 +209,8 @@ private extension VirtualTimelineItem { return "DayDiviver(\(timestamp))" case .readMarker: return "ReadMarker" + case .timelineStart: + return "TimelineStart" } } } diff --git a/ElementX/Sources/Services/Timeline/TimelineProxy.swift b/ElementX/Sources/Services/Timeline/TimelineProxy.swift index 420b9da02..bd821baf2 100644 --- a/ElementX/Sources/Services/Timeline/TimelineProxy.swift +++ b/ElementX/Sources/Services/Timeline/TimelineProxy.swift @@ -159,15 +159,13 @@ final class TimelineProxy: TimelineProxyProtocol { } } - func retryDecryption(sessionIDs: [String]?) async { + func retryDecryption(sessionIDs: [String]?) { let sessionIDs = sessionIDs ?? [] MXLog.info("Retrying decryption for sessionIDs: \(sessionIDs)") - await Task.dispatch(on: .global()) { [weak self] in - self?.timeline.retryDecryption(sessionIds: sessionIDs) - MXLog.info("Finished retrying decryption for sessionID: \(sessionIDs)") - } + timeline.retryDecryption(sessionIds: sessionIDs) + MXLog.info("Finished retrying decryption for sessionID: \(sessionIDs)") } func edit(_ eventOrTransactionID: TimelineItemIdentifier.EventOrTransactionID, newContent: EditedContent) async -> Result { @@ -504,17 +502,15 @@ final class TimelineProxy: TimelineProxyProtocol { func endPoll(pollStartID: String, text: String) async -> Result { MXLog.info("Ending poll with eventID: \(pollStartID)") - return await Task.dispatch(on: .global()) { - do { - try self.timeline.endPoll(pollStartEventId: pollStartID, text: text) - - MXLog.info("Finished ending poll with eventID: \(pollStartID)") - - return .success(()) - } catch { - MXLog.error("Failed ending poll with eventID: \(pollStartID) with error: \(error)") - return .failure(.sdkError(error)) - } + do { + try await timeline.endPoll(pollStartEventId: pollStartID, text: text) + + MXLog.info("Finished ending poll with eventID: \(pollStartID)") + + return .success(()) + } catch { + MXLog.error("Failed ending poll with eventID: \(pollStartID) with error: \(error)") + return .failure(.sdkError(error)) } } diff --git a/ElementX/Sources/Services/Timeline/TimelineProxyProtocol.swift b/ElementX/Sources/Services/Timeline/TimelineProxyProtocol.swift index fece30843..337146487 100644 --- a/ElementX/Sources/Services/Timeline/TimelineProxyProtocol.swift +++ b/ElementX/Sources/Services/Timeline/TimelineProxyProtocol.swift @@ -45,7 +45,7 @@ protocol TimelineProxyProtocol { func messageEventContent(for timelineItemID: TimelineItemIdentifier) async -> RoomMessageEventContentWithoutRelation? - func retryDecryption(sessionIDs: [String]?) async + func retryDecryption(sessionIDs: [String]?) func paginateBackwards(requestSize: UInt16) async -> Result func paginateForwards(requestSize: UInt16) async -> Result @@ -123,9 +123,3 @@ protocol TimelineProxyProtocol { html: String?, intentionalMentions: Mentions) -> RoomMessageEventContentWithoutRelation } - -extension TimelineProxyProtocol { - func retryDecryption() async { - await retryDecryption(sessionIDs: nil) - } -} diff --git a/project.yml b/project.yml index 76842e1f5..c75d5eac9 100644 --- a/project.yml +++ b/project.yml @@ -59,7 +59,7 @@ packages: # Element/Matrix dependencies MatrixRustSDK: url: https://github.com/element-hq/matrix-rust-components-swift - exactVersion: 25.03.24 + exactVersion: 25.03.31 # path: ../matrix-rust-sdk Compound: url: https://github.com/element-hq/compound-ios