From 1e7afc93fa582102e4e014437ce37b9275ec9678 Mon Sep 17 00:00:00 2001 From: Stefan Ceriu Date: Tue, 22 Jul 2025 10:05:42 +0300 Subject: [PATCH] Remove `threadRootEventID` parameters from TimelineProxy send methods. This is now handled internally to the SDK as long as the right timeline instance is used. --- .../Sources/Application/AppCoordinator.swift | 1 - .../RoomFlowCoordinator.swift | 5 +- .../Mocks/Generated/GeneratedMocks.swift | 344 +++++++++--------- .../Mocks/Generated/SDKGeneratedMocks.swift | 189 ++++++---- .../MediaUploadPreviewScreenViewModel.swift | 9 +- .../Screens/Timeline/TimelineViewModel.swift | 2 +- .../AuthenticationService.swift | 3 +- .../Services/Timeline/TimelineProxy.swift | 79 +--- .../Timeline/TimelineProxyProtocol.swift | 11 +- .../VoiceMessage/VoiceMessageRecorder.swift | 3 +- ...henticationStartScreenViewModelTests.swift | 24 +- ...diaUploadPreviewScreenViewModelTests.swift | 8 +- ...rverConfirmationScreenViewModelTests.swift | 48 +-- 13 files changed, 361 insertions(+), 365 deletions(-) diff --git a/ElementX/Sources/Application/AppCoordinator.swift b/ElementX/Sources/Application/AppCoordinator.swift index cefb8fe09..76d4de04f 100644 --- a/ElementX/Sources/Application/AppCoordinator.swift +++ b/ElementX/Sources/Application/AppCoordinator.swift @@ -972,7 +972,6 @@ class AppCoordinator: AppCoordinatorProtocol, AuthenticationFlowCoordinatorDeleg switch await roomProxy.timeline.sendMessage(replyText, html: nil, - threadRootEventID: nil, inReplyToEventID: nil, intentionalMentions: .empty) { case .success: diff --git a/ElementX/Sources/FlowCoordinators/RoomFlowCoordinator.swift b/ElementX/Sources/FlowCoordinators/RoomFlowCoordinator.swift index 0067253aa..df3296067 100644 --- a/ElementX/Sources/FlowCoordinators/RoomFlowCoordinator.swift +++ b/ElementX/Sources/FlowCoordinators/RoomFlowCoordinator.swift @@ -997,8 +997,7 @@ class RoomFlowCoordinator: FlowCoordinatorProtocol { geoURI: geoURI, description: nil, zoomLevel: 15, - assetType: isUserLocation ? .sender : .pin, - threadRootEventID: threadRootEventID) + assetType: isUserLocation ? .sender : .pin) self.navigationStackCoordinator.setSheetCoordinator(nil) } @@ -1056,7 +1055,7 @@ class RoomFlowCoordinator: FlowCoordinatorProtocol { private func createPoll(question: String, options: [String], pollKind: Poll.Kind) { Task { - let result = await roomProxy.timeline.createPoll(question: question, answers: options, pollKind: pollKind, threadRootEventID: nil) + let result = await roomProxy.timeline.createPoll(question: question, answers: options, pollKind: pollKind) self.analytics.trackComposer(inThread: false, isEditing: false, diff --git a/ElementX/Sources/Mocks/Generated/GeneratedMocks.swift b/ElementX/Sources/Mocks/Generated/GeneratedMocks.swift index 7b8a9819d..55bd3fa4a 100644 --- a/ElementX/Sources/Mocks/Generated/GeneratedMocks.swift +++ b/ElementX/Sources/Mocks/Generated/GeneratedMocks.swift @@ -16874,15 +16874,15 @@ class TimelineProxyMock: TimelineProxyProtocol, @unchecked Sendable { } //MARK: - sendAudio - var sendAudioUrlAudioInfoCaptionThreadRootEventIDRequestHandleUnderlyingCallsCount = 0 - var sendAudioUrlAudioInfoCaptionThreadRootEventIDRequestHandleCallsCount: Int { + var sendAudioUrlAudioInfoCaptionRequestHandleUnderlyingCallsCount = 0 + var sendAudioUrlAudioInfoCaptionRequestHandleCallsCount: Int { get { if Thread.isMainThread { - return sendAudioUrlAudioInfoCaptionThreadRootEventIDRequestHandleUnderlyingCallsCount + return sendAudioUrlAudioInfoCaptionRequestHandleUnderlyingCallsCount } else { var returnValue: Int? = nil DispatchQueue.main.sync { - returnValue = sendAudioUrlAudioInfoCaptionThreadRootEventIDRequestHandleUnderlyingCallsCount + returnValue = sendAudioUrlAudioInfoCaptionRequestHandleUnderlyingCallsCount } return returnValue! @@ -16890,27 +16890,27 @@ class TimelineProxyMock: TimelineProxyProtocol, @unchecked Sendable { } set { if Thread.isMainThread { - sendAudioUrlAudioInfoCaptionThreadRootEventIDRequestHandleUnderlyingCallsCount = newValue + sendAudioUrlAudioInfoCaptionRequestHandleUnderlyingCallsCount = newValue } else { DispatchQueue.main.sync { - sendAudioUrlAudioInfoCaptionThreadRootEventIDRequestHandleUnderlyingCallsCount = newValue + sendAudioUrlAudioInfoCaptionRequestHandleUnderlyingCallsCount = newValue } } } } - var sendAudioUrlAudioInfoCaptionThreadRootEventIDRequestHandleCalled: Bool { - return sendAudioUrlAudioInfoCaptionThreadRootEventIDRequestHandleCallsCount > 0 + var sendAudioUrlAudioInfoCaptionRequestHandleCalled: Bool { + return sendAudioUrlAudioInfoCaptionRequestHandleCallsCount > 0 } - var sendAudioUrlAudioInfoCaptionThreadRootEventIDRequestHandleUnderlyingReturnValue: Result! - var sendAudioUrlAudioInfoCaptionThreadRootEventIDRequestHandleReturnValue: Result! { + var sendAudioUrlAudioInfoCaptionRequestHandleUnderlyingReturnValue: Result! + var sendAudioUrlAudioInfoCaptionRequestHandleReturnValue: Result! { get { if Thread.isMainThread { - return sendAudioUrlAudioInfoCaptionThreadRootEventIDRequestHandleUnderlyingReturnValue + return sendAudioUrlAudioInfoCaptionRequestHandleUnderlyingReturnValue } else { var returnValue: Result? = nil DispatchQueue.main.sync { - returnValue = sendAudioUrlAudioInfoCaptionThreadRootEventIDRequestHandleUnderlyingReturnValue + returnValue = sendAudioUrlAudioInfoCaptionRequestHandleUnderlyingReturnValue } return returnValue! @@ -16918,35 +16918,35 @@ class TimelineProxyMock: TimelineProxyProtocol, @unchecked Sendable { } set { if Thread.isMainThread { - sendAudioUrlAudioInfoCaptionThreadRootEventIDRequestHandleUnderlyingReturnValue = newValue + sendAudioUrlAudioInfoCaptionRequestHandleUnderlyingReturnValue = newValue } else { DispatchQueue.main.sync { - sendAudioUrlAudioInfoCaptionThreadRootEventIDRequestHandleUnderlyingReturnValue = newValue + sendAudioUrlAudioInfoCaptionRequestHandleUnderlyingReturnValue = newValue } } } } - var sendAudioUrlAudioInfoCaptionThreadRootEventIDRequestHandleClosure: ((URL, AudioInfo, String?, String?, @MainActor (SendAttachmentJoinHandleProtocol) -> Void) async -> Result)? + var sendAudioUrlAudioInfoCaptionRequestHandleClosure: ((URL, AudioInfo, String?, @MainActor (SendAttachmentJoinHandleProtocol) -> Void) async -> Result)? - func sendAudio(url: URL, audioInfo: AudioInfo, caption: String?, threadRootEventID: String?, requestHandle: @MainActor (SendAttachmentJoinHandleProtocol) -> Void) async -> Result { - sendAudioUrlAudioInfoCaptionThreadRootEventIDRequestHandleCallsCount += 1 - if let sendAudioUrlAudioInfoCaptionThreadRootEventIDRequestHandleClosure = sendAudioUrlAudioInfoCaptionThreadRootEventIDRequestHandleClosure { - return await sendAudioUrlAudioInfoCaptionThreadRootEventIDRequestHandleClosure(url, audioInfo, caption, threadRootEventID, requestHandle) + func sendAudio(url: URL, audioInfo: AudioInfo, caption: String?, requestHandle: @MainActor (SendAttachmentJoinHandleProtocol) -> Void) async -> Result { + sendAudioUrlAudioInfoCaptionRequestHandleCallsCount += 1 + if let sendAudioUrlAudioInfoCaptionRequestHandleClosure = sendAudioUrlAudioInfoCaptionRequestHandleClosure { + return await sendAudioUrlAudioInfoCaptionRequestHandleClosure(url, audioInfo, caption, requestHandle) } else { - return sendAudioUrlAudioInfoCaptionThreadRootEventIDRequestHandleReturnValue + return sendAudioUrlAudioInfoCaptionRequestHandleReturnValue } } //MARK: - sendFile - var sendFileUrlFileInfoCaptionThreadRootEventIDRequestHandleUnderlyingCallsCount = 0 - var sendFileUrlFileInfoCaptionThreadRootEventIDRequestHandleCallsCount: Int { + var sendFileUrlFileInfoCaptionRequestHandleUnderlyingCallsCount = 0 + var sendFileUrlFileInfoCaptionRequestHandleCallsCount: Int { get { if Thread.isMainThread { - return sendFileUrlFileInfoCaptionThreadRootEventIDRequestHandleUnderlyingCallsCount + return sendFileUrlFileInfoCaptionRequestHandleUnderlyingCallsCount } else { var returnValue: Int? = nil DispatchQueue.main.sync { - returnValue = sendFileUrlFileInfoCaptionThreadRootEventIDRequestHandleUnderlyingCallsCount + returnValue = sendFileUrlFileInfoCaptionRequestHandleUnderlyingCallsCount } return returnValue! @@ -16954,27 +16954,27 @@ class TimelineProxyMock: TimelineProxyProtocol, @unchecked Sendable { } set { if Thread.isMainThread { - sendFileUrlFileInfoCaptionThreadRootEventIDRequestHandleUnderlyingCallsCount = newValue + sendFileUrlFileInfoCaptionRequestHandleUnderlyingCallsCount = newValue } else { DispatchQueue.main.sync { - sendFileUrlFileInfoCaptionThreadRootEventIDRequestHandleUnderlyingCallsCount = newValue + sendFileUrlFileInfoCaptionRequestHandleUnderlyingCallsCount = newValue } } } } - var sendFileUrlFileInfoCaptionThreadRootEventIDRequestHandleCalled: Bool { - return sendFileUrlFileInfoCaptionThreadRootEventIDRequestHandleCallsCount > 0 + var sendFileUrlFileInfoCaptionRequestHandleCalled: Bool { + return sendFileUrlFileInfoCaptionRequestHandleCallsCount > 0 } - var sendFileUrlFileInfoCaptionThreadRootEventIDRequestHandleUnderlyingReturnValue: Result! - var sendFileUrlFileInfoCaptionThreadRootEventIDRequestHandleReturnValue: Result! { + var sendFileUrlFileInfoCaptionRequestHandleUnderlyingReturnValue: Result! + var sendFileUrlFileInfoCaptionRequestHandleReturnValue: Result! { get { if Thread.isMainThread { - return sendFileUrlFileInfoCaptionThreadRootEventIDRequestHandleUnderlyingReturnValue + return sendFileUrlFileInfoCaptionRequestHandleUnderlyingReturnValue } else { var returnValue: Result? = nil DispatchQueue.main.sync { - returnValue = sendFileUrlFileInfoCaptionThreadRootEventIDRequestHandleUnderlyingReturnValue + returnValue = sendFileUrlFileInfoCaptionRequestHandleUnderlyingReturnValue } return returnValue! @@ -16982,35 +16982,35 @@ class TimelineProxyMock: TimelineProxyProtocol, @unchecked Sendable { } set { if Thread.isMainThread { - sendFileUrlFileInfoCaptionThreadRootEventIDRequestHandleUnderlyingReturnValue = newValue + sendFileUrlFileInfoCaptionRequestHandleUnderlyingReturnValue = newValue } else { DispatchQueue.main.sync { - sendFileUrlFileInfoCaptionThreadRootEventIDRequestHandleUnderlyingReturnValue = newValue + sendFileUrlFileInfoCaptionRequestHandleUnderlyingReturnValue = newValue } } } } - var sendFileUrlFileInfoCaptionThreadRootEventIDRequestHandleClosure: ((URL, FileInfo, String?, String?, @MainActor (SendAttachmentJoinHandleProtocol) -> Void) async -> Result)? + var sendFileUrlFileInfoCaptionRequestHandleClosure: ((URL, FileInfo, String?, @MainActor (SendAttachmentJoinHandleProtocol) -> Void) async -> Result)? - func sendFile(url: URL, fileInfo: FileInfo, caption: String?, threadRootEventID: String?, requestHandle: @MainActor (SendAttachmentJoinHandleProtocol) -> Void) async -> Result { - sendFileUrlFileInfoCaptionThreadRootEventIDRequestHandleCallsCount += 1 - if let sendFileUrlFileInfoCaptionThreadRootEventIDRequestHandleClosure = sendFileUrlFileInfoCaptionThreadRootEventIDRequestHandleClosure { - return await sendFileUrlFileInfoCaptionThreadRootEventIDRequestHandleClosure(url, fileInfo, caption, threadRootEventID, requestHandle) + func sendFile(url: URL, fileInfo: FileInfo, caption: String?, requestHandle: @MainActor (SendAttachmentJoinHandleProtocol) -> Void) async -> Result { + sendFileUrlFileInfoCaptionRequestHandleCallsCount += 1 + if let sendFileUrlFileInfoCaptionRequestHandleClosure = sendFileUrlFileInfoCaptionRequestHandleClosure { + return await sendFileUrlFileInfoCaptionRequestHandleClosure(url, fileInfo, caption, requestHandle) } else { - return sendFileUrlFileInfoCaptionThreadRootEventIDRequestHandleReturnValue + return sendFileUrlFileInfoCaptionRequestHandleReturnValue } } //MARK: - sendImage - var sendImageUrlThumbnailURLImageInfoCaptionThreadRootEventIDRequestHandleUnderlyingCallsCount = 0 - var sendImageUrlThumbnailURLImageInfoCaptionThreadRootEventIDRequestHandleCallsCount: Int { + var sendImageUrlThumbnailURLImageInfoCaptionRequestHandleUnderlyingCallsCount = 0 + var sendImageUrlThumbnailURLImageInfoCaptionRequestHandleCallsCount: Int { get { if Thread.isMainThread { - return sendImageUrlThumbnailURLImageInfoCaptionThreadRootEventIDRequestHandleUnderlyingCallsCount + return sendImageUrlThumbnailURLImageInfoCaptionRequestHandleUnderlyingCallsCount } else { var returnValue: Int? = nil DispatchQueue.main.sync { - returnValue = sendImageUrlThumbnailURLImageInfoCaptionThreadRootEventIDRequestHandleUnderlyingCallsCount + returnValue = sendImageUrlThumbnailURLImageInfoCaptionRequestHandleUnderlyingCallsCount } return returnValue! @@ -17018,27 +17018,27 @@ class TimelineProxyMock: TimelineProxyProtocol, @unchecked Sendable { } set { if Thread.isMainThread { - sendImageUrlThumbnailURLImageInfoCaptionThreadRootEventIDRequestHandleUnderlyingCallsCount = newValue + sendImageUrlThumbnailURLImageInfoCaptionRequestHandleUnderlyingCallsCount = newValue } else { DispatchQueue.main.sync { - sendImageUrlThumbnailURLImageInfoCaptionThreadRootEventIDRequestHandleUnderlyingCallsCount = newValue + sendImageUrlThumbnailURLImageInfoCaptionRequestHandleUnderlyingCallsCount = newValue } } } } - var sendImageUrlThumbnailURLImageInfoCaptionThreadRootEventIDRequestHandleCalled: Bool { - return sendImageUrlThumbnailURLImageInfoCaptionThreadRootEventIDRequestHandleCallsCount > 0 + var sendImageUrlThumbnailURLImageInfoCaptionRequestHandleCalled: Bool { + return sendImageUrlThumbnailURLImageInfoCaptionRequestHandleCallsCount > 0 } - var sendImageUrlThumbnailURLImageInfoCaptionThreadRootEventIDRequestHandleUnderlyingReturnValue: Result! - var sendImageUrlThumbnailURLImageInfoCaptionThreadRootEventIDRequestHandleReturnValue: Result! { + var sendImageUrlThumbnailURLImageInfoCaptionRequestHandleUnderlyingReturnValue: Result! + var sendImageUrlThumbnailURLImageInfoCaptionRequestHandleReturnValue: Result! { get { if Thread.isMainThread { - return sendImageUrlThumbnailURLImageInfoCaptionThreadRootEventIDRequestHandleUnderlyingReturnValue + return sendImageUrlThumbnailURLImageInfoCaptionRequestHandleUnderlyingReturnValue } else { var returnValue: Result? = nil DispatchQueue.main.sync { - returnValue = sendImageUrlThumbnailURLImageInfoCaptionThreadRootEventIDRequestHandleUnderlyingReturnValue + returnValue = sendImageUrlThumbnailURLImageInfoCaptionRequestHandleUnderlyingReturnValue } return returnValue! @@ -17046,35 +17046,35 @@ class TimelineProxyMock: TimelineProxyProtocol, @unchecked Sendable { } set { if Thread.isMainThread { - sendImageUrlThumbnailURLImageInfoCaptionThreadRootEventIDRequestHandleUnderlyingReturnValue = newValue + sendImageUrlThumbnailURLImageInfoCaptionRequestHandleUnderlyingReturnValue = newValue } else { DispatchQueue.main.sync { - sendImageUrlThumbnailURLImageInfoCaptionThreadRootEventIDRequestHandleUnderlyingReturnValue = newValue + sendImageUrlThumbnailURLImageInfoCaptionRequestHandleUnderlyingReturnValue = newValue } } } } - var sendImageUrlThumbnailURLImageInfoCaptionThreadRootEventIDRequestHandleClosure: ((URL, URL, ImageInfo, String?, String?, @MainActor (SendAttachmentJoinHandleProtocol) -> Void) async -> Result)? + var sendImageUrlThumbnailURLImageInfoCaptionRequestHandleClosure: ((URL, URL, ImageInfo, String?, @MainActor (SendAttachmentJoinHandleProtocol) -> Void) async -> Result)? - func sendImage(url: URL, thumbnailURL: URL, imageInfo: ImageInfo, caption: String?, threadRootEventID: String?, requestHandle: @MainActor (SendAttachmentJoinHandleProtocol) -> Void) async -> Result { - sendImageUrlThumbnailURLImageInfoCaptionThreadRootEventIDRequestHandleCallsCount += 1 - if let sendImageUrlThumbnailURLImageInfoCaptionThreadRootEventIDRequestHandleClosure = sendImageUrlThumbnailURLImageInfoCaptionThreadRootEventIDRequestHandleClosure { - return await sendImageUrlThumbnailURLImageInfoCaptionThreadRootEventIDRequestHandleClosure(url, thumbnailURL, imageInfo, caption, threadRootEventID, requestHandle) + func sendImage(url: URL, thumbnailURL: URL, imageInfo: ImageInfo, caption: String?, requestHandle: @MainActor (SendAttachmentJoinHandleProtocol) -> Void) async -> Result { + sendImageUrlThumbnailURLImageInfoCaptionRequestHandleCallsCount += 1 + if let sendImageUrlThumbnailURLImageInfoCaptionRequestHandleClosure = sendImageUrlThumbnailURLImageInfoCaptionRequestHandleClosure { + return await sendImageUrlThumbnailURLImageInfoCaptionRequestHandleClosure(url, thumbnailURL, imageInfo, caption, requestHandle) } else { - return sendImageUrlThumbnailURLImageInfoCaptionThreadRootEventIDRequestHandleReturnValue + return sendImageUrlThumbnailURLImageInfoCaptionRequestHandleReturnValue } } //MARK: - sendLocation - var sendLocationBodyGeoURIDescriptionZoomLevelAssetTypeThreadRootEventIDUnderlyingCallsCount = 0 - var sendLocationBodyGeoURIDescriptionZoomLevelAssetTypeThreadRootEventIDCallsCount: Int { + var sendLocationBodyGeoURIDescriptionZoomLevelAssetTypeUnderlyingCallsCount = 0 + var sendLocationBodyGeoURIDescriptionZoomLevelAssetTypeCallsCount: Int { get { if Thread.isMainThread { - return sendLocationBodyGeoURIDescriptionZoomLevelAssetTypeThreadRootEventIDUnderlyingCallsCount + return sendLocationBodyGeoURIDescriptionZoomLevelAssetTypeUnderlyingCallsCount } else { var returnValue: Int? = nil DispatchQueue.main.sync { - returnValue = sendLocationBodyGeoURIDescriptionZoomLevelAssetTypeThreadRootEventIDUnderlyingCallsCount + returnValue = sendLocationBodyGeoURIDescriptionZoomLevelAssetTypeUnderlyingCallsCount } return returnValue! @@ -17082,29 +17082,29 @@ class TimelineProxyMock: TimelineProxyProtocol, @unchecked Sendable { } set { if Thread.isMainThread { - sendLocationBodyGeoURIDescriptionZoomLevelAssetTypeThreadRootEventIDUnderlyingCallsCount = newValue + sendLocationBodyGeoURIDescriptionZoomLevelAssetTypeUnderlyingCallsCount = newValue } else { DispatchQueue.main.sync { - sendLocationBodyGeoURIDescriptionZoomLevelAssetTypeThreadRootEventIDUnderlyingCallsCount = newValue + sendLocationBodyGeoURIDescriptionZoomLevelAssetTypeUnderlyingCallsCount = newValue } } } } - var sendLocationBodyGeoURIDescriptionZoomLevelAssetTypeThreadRootEventIDCalled: Bool { - return sendLocationBodyGeoURIDescriptionZoomLevelAssetTypeThreadRootEventIDCallsCount > 0 + var sendLocationBodyGeoURIDescriptionZoomLevelAssetTypeCalled: Bool { + return sendLocationBodyGeoURIDescriptionZoomLevelAssetTypeCallsCount > 0 } - var sendLocationBodyGeoURIDescriptionZoomLevelAssetTypeThreadRootEventIDReceivedArguments: (body: String, geoURI: GeoURI, description: String?, zoomLevel: UInt8?, assetType: AssetType?, threadRootEventID: String?)? - var sendLocationBodyGeoURIDescriptionZoomLevelAssetTypeThreadRootEventIDReceivedInvocations: [(body: String, geoURI: GeoURI, description: String?, zoomLevel: UInt8?, assetType: AssetType?, threadRootEventID: String?)] = [] + var sendLocationBodyGeoURIDescriptionZoomLevelAssetTypeReceivedArguments: (body: String, geoURI: GeoURI, description: String?, zoomLevel: UInt8?, assetType: AssetType?)? + var sendLocationBodyGeoURIDescriptionZoomLevelAssetTypeReceivedInvocations: [(body: String, geoURI: GeoURI, description: String?, zoomLevel: UInt8?, assetType: AssetType?)] = [] - var sendLocationBodyGeoURIDescriptionZoomLevelAssetTypeThreadRootEventIDUnderlyingReturnValue: Result! - var sendLocationBodyGeoURIDescriptionZoomLevelAssetTypeThreadRootEventIDReturnValue: Result! { + var sendLocationBodyGeoURIDescriptionZoomLevelAssetTypeUnderlyingReturnValue: Result! + var sendLocationBodyGeoURIDescriptionZoomLevelAssetTypeReturnValue: Result! { get { if Thread.isMainThread { - return sendLocationBodyGeoURIDescriptionZoomLevelAssetTypeThreadRootEventIDUnderlyingReturnValue + return sendLocationBodyGeoURIDescriptionZoomLevelAssetTypeUnderlyingReturnValue } else { var returnValue: Result? = nil DispatchQueue.main.sync { - returnValue = sendLocationBodyGeoURIDescriptionZoomLevelAssetTypeThreadRootEventIDUnderlyingReturnValue + returnValue = sendLocationBodyGeoURIDescriptionZoomLevelAssetTypeUnderlyingReturnValue } return returnValue! @@ -17112,39 +17112,39 @@ class TimelineProxyMock: TimelineProxyProtocol, @unchecked Sendable { } set { if Thread.isMainThread { - sendLocationBodyGeoURIDescriptionZoomLevelAssetTypeThreadRootEventIDUnderlyingReturnValue = newValue + sendLocationBodyGeoURIDescriptionZoomLevelAssetTypeUnderlyingReturnValue = newValue } else { DispatchQueue.main.sync { - sendLocationBodyGeoURIDescriptionZoomLevelAssetTypeThreadRootEventIDUnderlyingReturnValue = newValue + sendLocationBodyGeoURIDescriptionZoomLevelAssetTypeUnderlyingReturnValue = newValue } } } } - var sendLocationBodyGeoURIDescriptionZoomLevelAssetTypeThreadRootEventIDClosure: ((String, GeoURI, String?, UInt8?, AssetType?, String?) async -> Result)? + var sendLocationBodyGeoURIDescriptionZoomLevelAssetTypeClosure: ((String, GeoURI, String?, UInt8?, AssetType?) async -> Result)? - func sendLocation(body: String, geoURI: GeoURI, description: String?, zoomLevel: UInt8?, assetType: AssetType?, threadRootEventID: String?) async -> Result { - sendLocationBodyGeoURIDescriptionZoomLevelAssetTypeThreadRootEventIDCallsCount += 1 - sendLocationBodyGeoURIDescriptionZoomLevelAssetTypeThreadRootEventIDReceivedArguments = (body: body, geoURI: geoURI, description: description, zoomLevel: zoomLevel, assetType: assetType, threadRootEventID: threadRootEventID) + func sendLocation(body: String, geoURI: GeoURI, description: String?, zoomLevel: UInt8?, assetType: AssetType?) async -> Result { + sendLocationBodyGeoURIDescriptionZoomLevelAssetTypeCallsCount += 1 + sendLocationBodyGeoURIDescriptionZoomLevelAssetTypeReceivedArguments = (body: body, geoURI: geoURI, description: description, zoomLevel: zoomLevel, assetType: assetType) DispatchQueue.main.async { - self.sendLocationBodyGeoURIDescriptionZoomLevelAssetTypeThreadRootEventIDReceivedInvocations.append((body: body, geoURI: geoURI, description: description, zoomLevel: zoomLevel, assetType: assetType, threadRootEventID: threadRootEventID)) + self.sendLocationBodyGeoURIDescriptionZoomLevelAssetTypeReceivedInvocations.append((body: body, geoURI: geoURI, description: description, zoomLevel: zoomLevel, assetType: assetType)) } - if let sendLocationBodyGeoURIDescriptionZoomLevelAssetTypeThreadRootEventIDClosure = sendLocationBodyGeoURIDescriptionZoomLevelAssetTypeThreadRootEventIDClosure { - return await sendLocationBodyGeoURIDescriptionZoomLevelAssetTypeThreadRootEventIDClosure(body, geoURI, description, zoomLevel, assetType, threadRootEventID) + if let sendLocationBodyGeoURIDescriptionZoomLevelAssetTypeClosure = sendLocationBodyGeoURIDescriptionZoomLevelAssetTypeClosure { + return await sendLocationBodyGeoURIDescriptionZoomLevelAssetTypeClosure(body, geoURI, description, zoomLevel, assetType) } else { - return sendLocationBodyGeoURIDescriptionZoomLevelAssetTypeThreadRootEventIDReturnValue + return sendLocationBodyGeoURIDescriptionZoomLevelAssetTypeReturnValue } } //MARK: - sendVideo - var sendVideoUrlThumbnailURLVideoInfoCaptionThreadRootEventIDRequestHandleUnderlyingCallsCount = 0 - var sendVideoUrlThumbnailURLVideoInfoCaptionThreadRootEventIDRequestHandleCallsCount: Int { + var sendVideoUrlThumbnailURLVideoInfoCaptionRequestHandleUnderlyingCallsCount = 0 + var sendVideoUrlThumbnailURLVideoInfoCaptionRequestHandleCallsCount: Int { get { if Thread.isMainThread { - return sendVideoUrlThumbnailURLVideoInfoCaptionThreadRootEventIDRequestHandleUnderlyingCallsCount + return sendVideoUrlThumbnailURLVideoInfoCaptionRequestHandleUnderlyingCallsCount } else { var returnValue: Int? = nil DispatchQueue.main.sync { - returnValue = sendVideoUrlThumbnailURLVideoInfoCaptionThreadRootEventIDRequestHandleUnderlyingCallsCount + returnValue = sendVideoUrlThumbnailURLVideoInfoCaptionRequestHandleUnderlyingCallsCount } return returnValue! @@ -17152,27 +17152,27 @@ class TimelineProxyMock: TimelineProxyProtocol, @unchecked Sendable { } set { if Thread.isMainThread { - sendVideoUrlThumbnailURLVideoInfoCaptionThreadRootEventIDRequestHandleUnderlyingCallsCount = newValue + sendVideoUrlThumbnailURLVideoInfoCaptionRequestHandleUnderlyingCallsCount = newValue } else { DispatchQueue.main.sync { - sendVideoUrlThumbnailURLVideoInfoCaptionThreadRootEventIDRequestHandleUnderlyingCallsCount = newValue + sendVideoUrlThumbnailURLVideoInfoCaptionRequestHandleUnderlyingCallsCount = newValue } } } } - var sendVideoUrlThumbnailURLVideoInfoCaptionThreadRootEventIDRequestHandleCalled: Bool { - return sendVideoUrlThumbnailURLVideoInfoCaptionThreadRootEventIDRequestHandleCallsCount > 0 + var sendVideoUrlThumbnailURLVideoInfoCaptionRequestHandleCalled: Bool { + return sendVideoUrlThumbnailURLVideoInfoCaptionRequestHandleCallsCount > 0 } - var sendVideoUrlThumbnailURLVideoInfoCaptionThreadRootEventIDRequestHandleUnderlyingReturnValue: Result! - var sendVideoUrlThumbnailURLVideoInfoCaptionThreadRootEventIDRequestHandleReturnValue: Result! { + var sendVideoUrlThumbnailURLVideoInfoCaptionRequestHandleUnderlyingReturnValue: Result! + var sendVideoUrlThumbnailURLVideoInfoCaptionRequestHandleReturnValue: Result! { get { if Thread.isMainThread { - return sendVideoUrlThumbnailURLVideoInfoCaptionThreadRootEventIDRequestHandleUnderlyingReturnValue + return sendVideoUrlThumbnailURLVideoInfoCaptionRequestHandleUnderlyingReturnValue } else { var returnValue: Result? = nil DispatchQueue.main.sync { - returnValue = sendVideoUrlThumbnailURLVideoInfoCaptionThreadRootEventIDRequestHandleUnderlyingReturnValue + returnValue = sendVideoUrlThumbnailURLVideoInfoCaptionRequestHandleUnderlyingReturnValue } return returnValue! @@ -17180,35 +17180,35 @@ class TimelineProxyMock: TimelineProxyProtocol, @unchecked Sendable { } set { if Thread.isMainThread { - sendVideoUrlThumbnailURLVideoInfoCaptionThreadRootEventIDRequestHandleUnderlyingReturnValue = newValue + sendVideoUrlThumbnailURLVideoInfoCaptionRequestHandleUnderlyingReturnValue = newValue } else { DispatchQueue.main.sync { - sendVideoUrlThumbnailURLVideoInfoCaptionThreadRootEventIDRequestHandleUnderlyingReturnValue = newValue + sendVideoUrlThumbnailURLVideoInfoCaptionRequestHandleUnderlyingReturnValue = newValue } } } } - var sendVideoUrlThumbnailURLVideoInfoCaptionThreadRootEventIDRequestHandleClosure: ((URL, URL, VideoInfo, String?, String?, @MainActor (SendAttachmentJoinHandleProtocol) -> Void) async -> Result)? + var sendVideoUrlThumbnailURLVideoInfoCaptionRequestHandleClosure: ((URL, URL, VideoInfo, String?, @MainActor (SendAttachmentJoinHandleProtocol) -> Void) async -> Result)? - func sendVideo(url: URL, thumbnailURL: URL, videoInfo: VideoInfo, caption: String?, threadRootEventID: String?, requestHandle: @MainActor (SendAttachmentJoinHandleProtocol) -> Void) async -> Result { - sendVideoUrlThumbnailURLVideoInfoCaptionThreadRootEventIDRequestHandleCallsCount += 1 - if let sendVideoUrlThumbnailURLVideoInfoCaptionThreadRootEventIDRequestHandleClosure = sendVideoUrlThumbnailURLVideoInfoCaptionThreadRootEventIDRequestHandleClosure { - return await sendVideoUrlThumbnailURLVideoInfoCaptionThreadRootEventIDRequestHandleClosure(url, thumbnailURL, videoInfo, caption, threadRootEventID, requestHandle) + func sendVideo(url: URL, thumbnailURL: URL, videoInfo: VideoInfo, caption: String?, requestHandle: @MainActor (SendAttachmentJoinHandleProtocol) -> Void) async -> Result { + sendVideoUrlThumbnailURLVideoInfoCaptionRequestHandleCallsCount += 1 + if let sendVideoUrlThumbnailURLVideoInfoCaptionRequestHandleClosure = sendVideoUrlThumbnailURLVideoInfoCaptionRequestHandleClosure { + return await sendVideoUrlThumbnailURLVideoInfoCaptionRequestHandleClosure(url, thumbnailURL, videoInfo, caption, requestHandle) } else { - return sendVideoUrlThumbnailURLVideoInfoCaptionThreadRootEventIDRequestHandleReturnValue + return sendVideoUrlThumbnailURLVideoInfoCaptionRequestHandleReturnValue } } //MARK: - sendVoiceMessage - var sendVoiceMessageUrlAudioInfoWaveformThreadRootEventIDRequestHandleUnderlyingCallsCount = 0 - var sendVoiceMessageUrlAudioInfoWaveformThreadRootEventIDRequestHandleCallsCount: Int { + var sendVoiceMessageUrlAudioInfoWaveformRequestHandleUnderlyingCallsCount = 0 + var sendVoiceMessageUrlAudioInfoWaveformRequestHandleCallsCount: Int { get { if Thread.isMainThread { - return sendVoiceMessageUrlAudioInfoWaveformThreadRootEventIDRequestHandleUnderlyingCallsCount + return sendVoiceMessageUrlAudioInfoWaveformRequestHandleUnderlyingCallsCount } else { var returnValue: Int? = nil DispatchQueue.main.sync { - returnValue = sendVoiceMessageUrlAudioInfoWaveformThreadRootEventIDRequestHandleUnderlyingCallsCount + returnValue = sendVoiceMessageUrlAudioInfoWaveformRequestHandleUnderlyingCallsCount } return returnValue! @@ -17216,27 +17216,27 @@ class TimelineProxyMock: TimelineProxyProtocol, @unchecked Sendable { } set { if Thread.isMainThread { - sendVoiceMessageUrlAudioInfoWaveformThreadRootEventIDRequestHandleUnderlyingCallsCount = newValue + sendVoiceMessageUrlAudioInfoWaveformRequestHandleUnderlyingCallsCount = newValue } else { DispatchQueue.main.sync { - sendVoiceMessageUrlAudioInfoWaveformThreadRootEventIDRequestHandleUnderlyingCallsCount = newValue + sendVoiceMessageUrlAudioInfoWaveformRequestHandleUnderlyingCallsCount = newValue } } } } - var sendVoiceMessageUrlAudioInfoWaveformThreadRootEventIDRequestHandleCalled: Bool { - return sendVoiceMessageUrlAudioInfoWaveformThreadRootEventIDRequestHandleCallsCount > 0 + var sendVoiceMessageUrlAudioInfoWaveformRequestHandleCalled: Bool { + return sendVoiceMessageUrlAudioInfoWaveformRequestHandleCallsCount > 0 } - var sendVoiceMessageUrlAudioInfoWaveformThreadRootEventIDRequestHandleUnderlyingReturnValue: Result! - var sendVoiceMessageUrlAudioInfoWaveformThreadRootEventIDRequestHandleReturnValue: Result! { + var sendVoiceMessageUrlAudioInfoWaveformRequestHandleUnderlyingReturnValue: Result! + var sendVoiceMessageUrlAudioInfoWaveformRequestHandleReturnValue: Result! { get { if Thread.isMainThread { - return sendVoiceMessageUrlAudioInfoWaveformThreadRootEventIDRequestHandleUnderlyingReturnValue + return sendVoiceMessageUrlAudioInfoWaveformRequestHandleUnderlyingReturnValue } else { var returnValue: Result? = nil DispatchQueue.main.sync { - returnValue = sendVoiceMessageUrlAudioInfoWaveformThreadRootEventIDRequestHandleUnderlyingReturnValue + returnValue = sendVoiceMessageUrlAudioInfoWaveformRequestHandleUnderlyingReturnValue } return returnValue! @@ -17244,22 +17244,22 @@ class TimelineProxyMock: TimelineProxyProtocol, @unchecked Sendable { } set { if Thread.isMainThread { - sendVoiceMessageUrlAudioInfoWaveformThreadRootEventIDRequestHandleUnderlyingReturnValue = newValue + sendVoiceMessageUrlAudioInfoWaveformRequestHandleUnderlyingReturnValue = newValue } else { DispatchQueue.main.sync { - sendVoiceMessageUrlAudioInfoWaveformThreadRootEventIDRequestHandleUnderlyingReturnValue = newValue + sendVoiceMessageUrlAudioInfoWaveformRequestHandleUnderlyingReturnValue = newValue } } } } - var sendVoiceMessageUrlAudioInfoWaveformThreadRootEventIDRequestHandleClosure: ((URL, AudioInfo, [UInt16], String?, @MainActor (SendAttachmentJoinHandleProtocol) -> Void) async -> Result)? + var sendVoiceMessageUrlAudioInfoWaveformRequestHandleClosure: ((URL, AudioInfo, [UInt16], @MainActor (SendAttachmentJoinHandleProtocol) -> Void) async -> Result)? - func sendVoiceMessage(url: URL, audioInfo: AudioInfo, waveform: [UInt16], threadRootEventID: String?, requestHandle: @MainActor (SendAttachmentJoinHandleProtocol) -> Void) async -> Result { - sendVoiceMessageUrlAudioInfoWaveformThreadRootEventIDRequestHandleCallsCount += 1 - if let sendVoiceMessageUrlAudioInfoWaveformThreadRootEventIDRequestHandleClosure = sendVoiceMessageUrlAudioInfoWaveformThreadRootEventIDRequestHandleClosure { - return await sendVoiceMessageUrlAudioInfoWaveformThreadRootEventIDRequestHandleClosure(url, audioInfo, waveform, threadRootEventID, requestHandle) + func sendVoiceMessage(url: URL, audioInfo: AudioInfo, waveform: [UInt16], requestHandle: @MainActor (SendAttachmentJoinHandleProtocol) -> Void) async -> Result { + sendVoiceMessageUrlAudioInfoWaveformRequestHandleCallsCount += 1 + if let sendVoiceMessageUrlAudioInfoWaveformRequestHandleClosure = sendVoiceMessageUrlAudioInfoWaveformRequestHandleClosure { + return await sendVoiceMessageUrlAudioInfoWaveformRequestHandleClosure(url, audioInfo, waveform, requestHandle) } else { - return sendVoiceMessageUrlAudioInfoWaveformThreadRootEventIDRequestHandleReturnValue + return sendVoiceMessageUrlAudioInfoWaveformRequestHandleReturnValue } } //MARK: - sendReadReceipt @@ -17474,15 +17474,15 @@ class TimelineProxyMock: TimelineProxyProtocol, @unchecked Sendable { } //MARK: - sendMessage - var sendMessageHtmlThreadRootEventIDInReplyToEventIDIntentionalMentionsUnderlyingCallsCount = 0 - var sendMessageHtmlThreadRootEventIDInReplyToEventIDIntentionalMentionsCallsCount: Int { + var sendMessageHtmlInReplyToEventIDIntentionalMentionsUnderlyingCallsCount = 0 + var sendMessageHtmlInReplyToEventIDIntentionalMentionsCallsCount: Int { get { if Thread.isMainThread { - return sendMessageHtmlThreadRootEventIDInReplyToEventIDIntentionalMentionsUnderlyingCallsCount + return sendMessageHtmlInReplyToEventIDIntentionalMentionsUnderlyingCallsCount } else { var returnValue: Int? = nil DispatchQueue.main.sync { - returnValue = sendMessageHtmlThreadRootEventIDInReplyToEventIDIntentionalMentionsUnderlyingCallsCount + returnValue = sendMessageHtmlInReplyToEventIDIntentionalMentionsUnderlyingCallsCount } return returnValue! @@ -17490,29 +17490,29 @@ class TimelineProxyMock: TimelineProxyProtocol, @unchecked Sendable { } set { if Thread.isMainThread { - sendMessageHtmlThreadRootEventIDInReplyToEventIDIntentionalMentionsUnderlyingCallsCount = newValue + sendMessageHtmlInReplyToEventIDIntentionalMentionsUnderlyingCallsCount = newValue } else { DispatchQueue.main.sync { - sendMessageHtmlThreadRootEventIDInReplyToEventIDIntentionalMentionsUnderlyingCallsCount = newValue + sendMessageHtmlInReplyToEventIDIntentionalMentionsUnderlyingCallsCount = newValue } } } } - var sendMessageHtmlThreadRootEventIDInReplyToEventIDIntentionalMentionsCalled: Bool { - return sendMessageHtmlThreadRootEventIDInReplyToEventIDIntentionalMentionsCallsCount > 0 + var sendMessageHtmlInReplyToEventIDIntentionalMentionsCalled: Bool { + return sendMessageHtmlInReplyToEventIDIntentionalMentionsCallsCount > 0 } - var sendMessageHtmlThreadRootEventIDInReplyToEventIDIntentionalMentionsReceivedArguments: (message: String, html: String?, threadRootEventID: String?, inReplyToEventID: String?, intentionalMentions: IntentionalMentions)? - var sendMessageHtmlThreadRootEventIDInReplyToEventIDIntentionalMentionsReceivedInvocations: [(message: String, html: String?, threadRootEventID: String?, inReplyToEventID: String?, intentionalMentions: IntentionalMentions)] = [] + var sendMessageHtmlInReplyToEventIDIntentionalMentionsReceivedArguments: (message: String, html: String?, inReplyToEventID: String?, intentionalMentions: IntentionalMentions)? + var sendMessageHtmlInReplyToEventIDIntentionalMentionsReceivedInvocations: [(message: String, html: String?, inReplyToEventID: String?, intentionalMentions: IntentionalMentions)] = [] - var sendMessageHtmlThreadRootEventIDInReplyToEventIDIntentionalMentionsUnderlyingReturnValue: Result! - var sendMessageHtmlThreadRootEventIDInReplyToEventIDIntentionalMentionsReturnValue: Result! { + var sendMessageHtmlInReplyToEventIDIntentionalMentionsUnderlyingReturnValue: Result! + var sendMessageHtmlInReplyToEventIDIntentionalMentionsReturnValue: Result! { get { if Thread.isMainThread { - return sendMessageHtmlThreadRootEventIDInReplyToEventIDIntentionalMentionsUnderlyingReturnValue + return sendMessageHtmlInReplyToEventIDIntentionalMentionsUnderlyingReturnValue } else { var returnValue: Result? = nil DispatchQueue.main.sync { - returnValue = sendMessageHtmlThreadRootEventIDInReplyToEventIDIntentionalMentionsUnderlyingReturnValue + returnValue = sendMessageHtmlInReplyToEventIDIntentionalMentionsUnderlyingReturnValue } return returnValue! @@ -17520,26 +17520,26 @@ class TimelineProxyMock: TimelineProxyProtocol, @unchecked Sendable { } set { if Thread.isMainThread { - sendMessageHtmlThreadRootEventIDInReplyToEventIDIntentionalMentionsUnderlyingReturnValue = newValue + sendMessageHtmlInReplyToEventIDIntentionalMentionsUnderlyingReturnValue = newValue } else { DispatchQueue.main.sync { - sendMessageHtmlThreadRootEventIDInReplyToEventIDIntentionalMentionsUnderlyingReturnValue = newValue + sendMessageHtmlInReplyToEventIDIntentionalMentionsUnderlyingReturnValue = newValue } } } } - var sendMessageHtmlThreadRootEventIDInReplyToEventIDIntentionalMentionsClosure: ((String, String?, String?, String?, IntentionalMentions) async -> Result)? + var sendMessageHtmlInReplyToEventIDIntentionalMentionsClosure: ((String, String?, String?, IntentionalMentions) async -> Result)? - func sendMessage(_ message: String, html: String?, threadRootEventID: String?, inReplyToEventID: String?, intentionalMentions: IntentionalMentions) async -> Result { - sendMessageHtmlThreadRootEventIDInReplyToEventIDIntentionalMentionsCallsCount += 1 - sendMessageHtmlThreadRootEventIDInReplyToEventIDIntentionalMentionsReceivedArguments = (message: message, html: html, threadRootEventID: threadRootEventID, inReplyToEventID: inReplyToEventID, intentionalMentions: intentionalMentions) + func sendMessage(_ message: String, html: String?, inReplyToEventID: String?, intentionalMentions: IntentionalMentions) async -> Result { + sendMessageHtmlInReplyToEventIDIntentionalMentionsCallsCount += 1 + sendMessageHtmlInReplyToEventIDIntentionalMentionsReceivedArguments = (message: message, html: html, inReplyToEventID: inReplyToEventID, intentionalMentions: intentionalMentions) DispatchQueue.main.async { - self.sendMessageHtmlThreadRootEventIDInReplyToEventIDIntentionalMentionsReceivedInvocations.append((message: message, html: html, threadRootEventID: threadRootEventID, inReplyToEventID: inReplyToEventID, intentionalMentions: intentionalMentions)) + self.sendMessageHtmlInReplyToEventIDIntentionalMentionsReceivedInvocations.append((message: message, html: html, inReplyToEventID: inReplyToEventID, intentionalMentions: intentionalMentions)) } - if let sendMessageHtmlThreadRootEventIDInReplyToEventIDIntentionalMentionsClosure = sendMessageHtmlThreadRootEventIDInReplyToEventIDIntentionalMentionsClosure { - return await sendMessageHtmlThreadRootEventIDInReplyToEventIDIntentionalMentionsClosure(message, html, threadRootEventID, inReplyToEventID, intentionalMentions) + if let sendMessageHtmlInReplyToEventIDIntentionalMentionsClosure = sendMessageHtmlInReplyToEventIDIntentionalMentionsClosure { + return await sendMessageHtmlInReplyToEventIDIntentionalMentionsClosure(message, html, inReplyToEventID, intentionalMentions) } else { - return sendMessageHtmlThreadRootEventIDInReplyToEventIDIntentionalMentionsReturnValue + return sendMessageHtmlInReplyToEventIDIntentionalMentionsReturnValue } } //MARK: - toggleReaction @@ -17614,15 +17614,15 @@ class TimelineProxyMock: TimelineProxyProtocol, @unchecked Sendable { } //MARK: - createPoll - var createPollQuestionAnswersPollKindThreadRootEventIDUnderlyingCallsCount = 0 - var createPollQuestionAnswersPollKindThreadRootEventIDCallsCount: Int { + var createPollQuestionAnswersPollKindUnderlyingCallsCount = 0 + var createPollQuestionAnswersPollKindCallsCount: Int { get { if Thread.isMainThread { - return createPollQuestionAnswersPollKindThreadRootEventIDUnderlyingCallsCount + return createPollQuestionAnswersPollKindUnderlyingCallsCount } else { var returnValue: Int? = nil DispatchQueue.main.sync { - returnValue = createPollQuestionAnswersPollKindThreadRootEventIDUnderlyingCallsCount + returnValue = createPollQuestionAnswersPollKindUnderlyingCallsCount } return returnValue! @@ -17630,29 +17630,29 @@ class TimelineProxyMock: TimelineProxyProtocol, @unchecked Sendable { } set { if Thread.isMainThread { - createPollQuestionAnswersPollKindThreadRootEventIDUnderlyingCallsCount = newValue + createPollQuestionAnswersPollKindUnderlyingCallsCount = newValue } else { DispatchQueue.main.sync { - createPollQuestionAnswersPollKindThreadRootEventIDUnderlyingCallsCount = newValue + createPollQuestionAnswersPollKindUnderlyingCallsCount = newValue } } } } - var createPollQuestionAnswersPollKindThreadRootEventIDCalled: Bool { - return createPollQuestionAnswersPollKindThreadRootEventIDCallsCount > 0 + var createPollQuestionAnswersPollKindCalled: Bool { + return createPollQuestionAnswersPollKindCallsCount > 0 } - var createPollQuestionAnswersPollKindThreadRootEventIDReceivedArguments: (question: String, answers: [String], pollKind: Poll.Kind, threadRootEventID: String?)? - var createPollQuestionAnswersPollKindThreadRootEventIDReceivedInvocations: [(question: String, answers: [String], pollKind: Poll.Kind, threadRootEventID: String?)] = [] + var createPollQuestionAnswersPollKindReceivedArguments: (question: String, answers: [String], pollKind: Poll.Kind)? + var createPollQuestionAnswersPollKindReceivedInvocations: [(question: String, answers: [String], pollKind: Poll.Kind)] = [] - var createPollQuestionAnswersPollKindThreadRootEventIDUnderlyingReturnValue: Result! - var createPollQuestionAnswersPollKindThreadRootEventIDReturnValue: Result! { + var createPollQuestionAnswersPollKindUnderlyingReturnValue: Result! + var createPollQuestionAnswersPollKindReturnValue: Result! { get { if Thread.isMainThread { - return createPollQuestionAnswersPollKindThreadRootEventIDUnderlyingReturnValue + return createPollQuestionAnswersPollKindUnderlyingReturnValue } else { var returnValue: Result? = nil DispatchQueue.main.sync { - returnValue = createPollQuestionAnswersPollKindThreadRootEventIDUnderlyingReturnValue + returnValue = createPollQuestionAnswersPollKindUnderlyingReturnValue } return returnValue! @@ -17660,26 +17660,26 @@ class TimelineProxyMock: TimelineProxyProtocol, @unchecked Sendable { } set { if Thread.isMainThread { - createPollQuestionAnswersPollKindThreadRootEventIDUnderlyingReturnValue = newValue + createPollQuestionAnswersPollKindUnderlyingReturnValue = newValue } else { DispatchQueue.main.sync { - createPollQuestionAnswersPollKindThreadRootEventIDUnderlyingReturnValue = newValue + createPollQuestionAnswersPollKindUnderlyingReturnValue = newValue } } } } - var createPollQuestionAnswersPollKindThreadRootEventIDClosure: ((String, [String], Poll.Kind, String?) async -> Result)? + var createPollQuestionAnswersPollKindClosure: ((String, [String], Poll.Kind) async -> Result)? - func createPoll(question: String, answers: [String], pollKind: Poll.Kind, threadRootEventID: String?) async -> Result { - createPollQuestionAnswersPollKindThreadRootEventIDCallsCount += 1 - createPollQuestionAnswersPollKindThreadRootEventIDReceivedArguments = (question: question, answers: answers, pollKind: pollKind, threadRootEventID: threadRootEventID) + func createPoll(question: String, answers: [String], pollKind: Poll.Kind) async -> Result { + createPollQuestionAnswersPollKindCallsCount += 1 + createPollQuestionAnswersPollKindReceivedArguments = (question: question, answers: answers, pollKind: pollKind) DispatchQueue.main.async { - self.createPollQuestionAnswersPollKindThreadRootEventIDReceivedInvocations.append((question: question, answers: answers, pollKind: pollKind, threadRootEventID: threadRootEventID)) + self.createPollQuestionAnswersPollKindReceivedInvocations.append((question: question, answers: answers, pollKind: pollKind)) } - if let createPollQuestionAnswersPollKindThreadRootEventIDClosure = createPollQuestionAnswersPollKindThreadRootEventIDClosure { - return await createPollQuestionAnswersPollKindThreadRootEventIDClosure(question, answers, pollKind, threadRootEventID) + if let createPollQuestionAnswersPollKindClosure = createPollQuestionAnswersPollKindClosure { + return await createPollQuestionAnswersPollKindClosure(question, answers, pollKind) } else { - return createPollQuestionAnswersPollKindThreadRootEventIDReturnValue + return createPollQuestionAnswersPollKindReturnValue } } //MARK: - editPoll diff --git a/ElementX/Sources/Mocks/Generated/SDKGeneratedMocks.swift b/ElementX/Sources/Mocks/Generated/SDKGeneratedMocks.swift index 38d53af36..d4a11b642 100644 --- a/ElementX/Sources/Mocks/Generated/SDKGeneratedMocks.swift +++ b/ElementX/Sources/Mocks/Generated/SDKGeneratedMocks.swift @@ -5108,16 +5108,16 @@ open class ClientSDKMock: MatrixRustSDK.Client, @unchecked Sendable { //MARK: - urlForOidc - open var urlForOidcOidcConfigurationPromptLoginHintDeviceIdThrowableError: Error? - var urlForOidcOidcConfigurationPromptLoginHintDeviceIdUnderlyingCallsCount = 0 - open var urlForOidcOidcConfigurationPromptLoginHintDeviceIdCallsCount: Int { + open var urlForOidcOidcConfigurationPromptLoginHintDeviceIdAdditionalScopesThrowableError: Error? + var urlForOidcOidcConfigurationPromptLoginHintDeviceIdAdditionalScopesUnderlyingCallsCount = 0 + open var urlForOidcOidcConfigurationPromptLoginHintDeviceIdAdditionalScopesCallsCount: Int { get { if Thread.isMainThread { - return urlForOidcOidcConfigurationPromptLoginHintDeviceIdUnderlyingCallsCount + return urlForOidcOidcConfigurationPromptLoginHintDeviceIdAdditionalScopesUnderlyingCallsCount } else { var returnValue: Int? = nil DispatchQueue.main.sync { - returnValue = urlForOidcOidcConfigurationPromptLoginHintDeviceIdUnderlyingCallsCount + returnValue = urlForOidcOidcConfigurationPromptLoginHintDeviceIdAdditionalScopesUnderlyingCallsCount } return returnValue! @@ -5125,29 +5125,29 @@ open class ClientSDKMock: MatrixRustSDK.Client, @unchecked Sendable { } set { if Thread.isMainThread { - urlForOidcOidcConfigurationPromptLoginHintDeviceIdUnderlyingCallsCount = newValue + urlForOidcOidcConfigurationPromptLoginHintDeviceIdAdditionalScopesUnderlyingCallsCount = newValue } else { DispatchQueue.main.sync { - urlForOidcOidcConfigurationPromptLoginHintDeviceIdUnderlyingCallsCount = newValue + urlForOidcOidcConfigurationPromptLoginHintDeviceIdAdditionalScopesUnderlyingCallsCount = newValue } } } } - open var urlForOidcOidcConfigurationPromptLoginHintDeviceIdCalled: Bool { - return urlForOidcOidcConfigurationPromptLoginHintDeviceIdCallsCount > 0 + open var urlForOidcOidcConfigurationPromptLoginHintDeviceIdAdditionalScopesCalled: Bool { + return urlForOidcOidcConfigurationPromptLoginHintDeviceIdAdditionalScopesCallsCount > 0 } - open var urlForOidcOidcConfigurationPromptLoginHintDeviceIdReceivedArguments: (oidcConfiguration: OidcConfiguration, prompt: OidcPrompt?, loginHint: String?, deviceId: String?)? - open var urlForOidcOidcConfigurationPromptLoginHintDeviceIdReceivedInvocations: [(oidcConfiguration: OidcConfiguration, prompt: OidcPrompt?, loginHint: String?, deviceId: String?)] = [] + open var urlForOidcOidcConfigurationPromptLoginHintDeviceIdAdditionalScopesReceivedArguments: (oidcConfiguration: OidcConfiguration, prompt: OidcPrompt?, loginHint: String?, deviceId: String?, additionalScopes: [String]?)? + open var urlForOidcOidcConfigurationPromptLoginHintDeviceIdAdditionalScopesReceivedInvocations: [(oidcConfiguration: OidcConfiguration, prompt: OidcPrompt?, loginHint: String?, deviceId: String?, additionalScopes: [String]?)] = [] - var urlForOidcOidcConfigurationPromptLoginHintDeviceIdUnderlyingReturnValue: OAuthAuthorizationData! - open var urlForOidcOidcConfigurationPromptLoginHintDeviceIdReturnValue: OAuthAuthorizationData! { + var urlForOidcOidcConfigurationPromptLoginHintDeviceIdAdditionalScopesUnderlyingReturnValue: OAuthAuthorizationData! + open var urlForOidcOidcConfigurationPromptLoginHintDeviceIdAdditionalScopesReturnValue: OAuthAuthorizationData! { get { if Thread.isMainThread { - return urlForOidcOidcConfigurationPromptLoginHintDeviceIdUnderlyingReturnValue + return urlForOidcOidcConfigurationPromptLoginHintDeviceIdAdditionalScopesUnderlyingReturnValue } else { var returnValue: OAuthAuthorizationData? = nil DispatchQueue.main.sync { - returnValue = urlForOidcOidcConfigurationPromptLoginHintDeviceIdUnderlyingReturnValue + returnValue = urlForOidcOidcConfigurationPromptLoginHintDeviceIdAdditionalScopesUnderlyingReturnValue } return returnValue! @@ -5155,29 +5155,29 @@ open class ClientSDKMock: MatrixRustSDK.Client, @unchecked Sendable { } set { if Thread.isMainThread { - urlForOidcOidcConfigurationPromptLoginHintDeviceIdUnderlyingReturnValue = newValue + urlForOidcOidcConfigurationPromptLoginHintDeviceIdAdditionalScopesUnderlyingReturnValue = newValue } else { DispatchQueue.main.sync { - urlForOidcOidcConfigurationPromptLoginHintDeviceIdUnderlyingReturnValue = newValue + urlForOidcOidcConfigurationPromptLoginHintDeviceIdAdditionalScopesUnderlyingReturnValue = newValue } } } } - open var urlForOidcOidcConfigurationPromptLoginHintDeviceIdClosure: ((OidcConfiguration, OidcPrompt?, String?, String?) async throws -> OAuthAuthorizationData)? + open var urlForOidcOidcConfigurationPromptLoginHintDeviceIdAdditionalScopesClosure: ((OidcConfiguration, OidcPrompt?, String?, String?, [String]?) async throws -> OAuthAuthorizationData)? - open override func urlForOidc(oidcConfiguration: OidcConfiguration, prompt: OidcPrompt?, loginHint: String?, deviceId: String?) async throws -> OAuthAuthorizationData { - if let error = urlForOidcOidcConfigurationPromptLoginHintDeviceIdThrowableError { + open override func urlForOidc(oidcConfiguration: OidcConfiguration, prompt: OidcPrompt?, loginHint: String?, deviceId: String?, additionalScopes: [String]?) async throws -> OAuthAuthorizationData { + if let error = urlForOidcOidcConfigurationPromptLoginHintDeviceIdAdditionalScopesThrowableError { throw error } - urlForOidcOidcConfigurationPromptLoginHintDeviceIdCallsCount += 1 - urlForOidcOidcConfigurationPromptLoginHintDeviceIdReceivedArguments = (oidcConfiguration: oidcConfiguration, prompt: prompt, loginHint: loginHint, deviceId: deviceId) + urlForOidcOidcConfigurationPromptLoginHintDeviceIdAdditionalScopesCallsCount += 1 + urlForOidcOidcConfigurationPromptLoginHintDeviceIdAdditionalScopesReceivedArguments = (oidcConfiguration: oidcConfiguration, prompt: prompt, loginHint: loginHint, deviceId: deviceId, additionalScopes: additionalScopes) DispatchQueue.main.async { - self.urlForOidcOidcConfigurationPromptLoginHintDeviceIdReceivedInvocations.append((oidcConfiguration: oidcConfiguration, prompt: prompt, loginHint: loginHint, deviceId: deviceId)) + self.urlForOidcOidcConfigurationPromptLoginHintDeviceIdAdditionalScopesReceivedInvocations.append((oidcConfiguration: oidcConfiguration, prompt: prompt, loginHint: loginHint, deviceId: deviceId, additionalScopes: additionalScopes)) } - if let urlForOidcOidcConfigurationPromptLoginHintDeviceIdClosure = urlForOidcOidcConfigurationPromptLoginHintDeviceIdClosure { - return try await urlForOidcOidcConfigurationPromptLoginHintDeviceIdClosure(oidcConfiguration, prompt, loginHint, deviceId) + if let urlForOidcOidcConfigurationPromptLoginHintDeviceIdAdditionalScopesClosure = urlForOidcOidcConfigurationPromptLoginHintDeviceIdAdditionalScopesClosure { + return try await urlForOidcOidcConfigurationPromptLoginHintDeviceIdAdditionalScopesClosure(oidcConfiguration, prompt, loginHint, deviceId, additionalScopes) } else { - return urlForOidcOidcConfigurationPromptLoginHintDeviceIdReturnValue + return urlForOidcOidcConfigurationPromptLoginHintDeviceIdAdditionalScopesReturnValue } } @@ -8886,6 +8886,71 @@ open class HomeserverLoginDetailsSDKMock: MatrixRustSDK.HomeserverLoginDetails, } } + //MARK: - supportsSsoLogin + + var supportsSsoLoginUnderlyingCallsCount = 0 + open var supportsSsoLoginCallsCount: Int { + get { + if Thread.isMainThread { + return supportsSsoLoginUnderlyingCallsCount + } else { + var returnValue: Int? = nil + DispatchQueue.main.sync { + returnValue = supportsSsoLoginUnderlyingCallsCount + } + + return returnValue! + } + } + set { + if Thread.isMainThread { + supportsSsoLoginUnderlyingCallsCount = newValue + } else { + DispatchQueue.main.sync { + supportsSsoLoginUnderlyingCallsCount = newValue + } + } + } + } + open var supportsSsoLoginCalled: Bool { + return supportsSsoLoginCallsCount > 0 + } + + var supportsSsoLoginUnderlyingReturnValue: Bool! + open var supportsSsoLoginReturnValue: Bool! { + get { + if Thread.isMainThread { + return supportsSsoLoginUnderlyingReturnValue + } else { + var returnValue: Bool? = nil + DispatchQueue.main.sync { + returnValue = supportsSsoLoginUnderlyingReturnValue + } + + return returnValue! + } + } + set { + if Thread.isMainThread { + supportsSsoLoginUnderlyingReturnValue = newValue + } else { + DispatchQueue.main.sync { + supportsSsoLoginUnderlyingReturnValue = newValue + } + } + } + } + open var supportsSsoLoginClosure: (() -> Bool)? + + open override func supportsSsoLogin() -> Bool { + supportsSsoLoginCallsCount += 1 + if let supportsSsoLoginClosure = supportsSsoLoginClosure { + return supportsSsoLoginClosure() + } else { + return supportsSsoLoginReturnValue + } + } + //MARK: - url var urlUnderlyingCallsCount = 0 @@ -23218,16 +23283,16 @@ open class TimelineSDKMock: MatrixRustSDK.Timeline, @unchecked Sendable { //MARK: - sendLocation - open var sendLocationBodyGeoUriDescriptionZoomLevelAssetTypeReplyParamsThrowableError: Error? - var sendLocationBodyGeoUriDescriptionZoomLevelAssetTypeReplyParamsUnderlyingCallsCount = 0 - open var sendLocationBodyGeoUriDescriptionZoomLevelAssetTypeReplyParamsCallsCount: Int { + open var sendLocationBodyGeoUriDescriptionZoomLevelAssetTypeRepliedToEventIdThrowableError: Error? + var sendLocationBodyGeoUriDescriptionZoomLevelAssetTypeRepliedToEventIdUnderlyingCallsCount = 0 + open var sendLocationBodyGeoUriDescriptionZoomLevelAssetTypeRepliedToEventIdCallsCount: Int { get { if Thread.isMainThread { - return sendLocationBodyGeoUriDescriptionZoomLevelAssetTypeReplyParamsUnderlyingCallsCount + return sendLocationBodyGeoUriDescriptionZoomLevelAssetTypeRepliedToEventIdUnderlyingCallsCount } else { var returnValue: Int? = nil DispatchQueue.main.sync { - returnValue = sendLocationBodyGeoUriDescriptionZoomLevelAssetTypeReplyParamsUnderlyingCallsCount + returnValue = sendLocationBodyGeoUriDescriptionZoomLevelAssetTypeRepliedToEventIdUnderlyingCallsCount } return returnValue! @@ -23235,31 +23300,31 @@ open class TimelineSDKMock: MatrixRustSDK.Timeline, @unchecked Sendable { } set { if Thread.isMainThread { - sendLocationBodyGeoUriDescriptionZoomLevelAssetTypeReplyParamsUnderlyingCallsCount = newValue + sendLocationBodyGeoUriDescriptionZoomLevelAssetTypeRepliedToEventIdUnderlyingCallsCount = newValue } else { DispatchQueue.main.sync { - sendLocationBodyGeoUriDescriptionZoomLevelAssetTypeReplyParamsUnderlyingCallsCount = newValue + sendLocationBodyGeoUriDescriptionZoomLevelAssetTypeRepliedToEventIdUnderlyingCallsCount = newValue } } } } - open var sendLocationBodyGeoUriDescriptionZoomLevelAssetTypeReplyParamsCalled: Bool { - return sendLocationBodyGeoUriDescriptionZoomLevelAssetTypeReplyParamsCallsCount > 0 + open var sendLocationBodyGeoUriDescriptionZoomLevelAssetTypeRepliedToEventIdCalled: Bool { + return sendLocationBodyGeoUriDescriptionZoomLevelAssetTypeRepliedToEventIdCallsCount > 0 } - open var sendLocationBodyGeoUriDescriptionZoomLevelAssetTypeReplyParamsReceivedArguments: (body: String, geoUri: String, description: String?, zoomLevel: UInt8?, assetType: AssetType?, replyParams: ReplyParameters?)? - open var sendLocationBodyGeoUriDescriptionZoomLevelAssetTypeReplyParamsReceivedInvocations: [(body: String, geoUri: String, description: String?, zoomLevel: UInt8?, assetType: AssetType?, replyParams: ReplyParameters?)] = [] - open var sendLocationBodyGeoUriDescriptionZoomLevelAssetTypeReplyParamsClosure: ((String, String, String?, UInt8?, AssetType?, ReplyParameters?) async throws -> Void)? + open var sendLocationBodyGeoUriDescriptionZoomLevelAssetTypeRepliedToEventIdReceivedArguments: (body: String, geoUri: String, description: String?, zoomLevel: UInt8?, assetType: AssetType?, repliedToEventId: String?)? + open var sendLocationBodyGeoUriDescriptionZoomLevelAssetTypeRepliedToEventIdReceivedInvocations: [(body: String, geoUri: String, description: String?, zoomLevel: UInt8?, assetType: AssetType?, repliedToEventId: String?)] = [] + open var sendLocationBodyGeoUriDescriptionZoomLevelAssetTypeRepliedToEventIdClosure: ((String, String, String?, UInt8?, AssetType?, String?) async throws -> Void)? - open override func sendLocation(body: String, geoUri: String, description: String?, zoomLevel: UInt8?, assetType: AssetType?, replyParams: ReplyParameters?) async throws { - if let error = sendLocationBodyGeoUriDescriptionZoomLevelAssetTypeReplyParamsThrowableError { + open override func sendLocation(body: String, geoUri: String, description: String?, zoomLevel: UInt8?, assetType: AssetType?, repliedToEventId: String?) async throws { + if let error = sendLocationBodyGeoUriDescriptionZoomLevelAssetTypeRepliedToEventIdThrowableError { throw error } - sendLocationBodyGeoUriDescriptionZoomLevelAssetTypeReplyParamsCallsCount += 1 - sendLocationBodyGeoUriDescriptionZoomLevelAssetTypeReplyParamsReceivedArguments = (body: body, geoUri: geoUri, description: description, zoomLevel: zoomLevel, assetType: assetType, replyParams: replyParams) + sendLocationBodyGeoUriDescriptionZoomLevelAssetTypeRepliedToEventIdCallsCount += 1 + sendLocationBodyGeoUriDescriptionZoomLevelAssetTypeRepliedToEventIdReceivedArguments = (body: body, geoUri: geoUri, description: description, zoomLevel: zoomLevel, assetType: assetType, repliedToEventId: repliedToEventId) DispatchQueue.main.async { - self.sendLocationBodyGeoUriDescriptionZoomLevelAssetTypeReplyParamsReceivedInvocations.append((body: body, geoUri: geoUri, description: description, zoomLevel: zoomLevel, assetType: assetType, replyParams: replyParams)) + self.sendLocationBodyGeoUriDescriptionZoomLevelAssetTypeRepliedToEventIdReceivedInvocations.append((body: body, geoUri: geoUri, description: description, zoomLevel: zoomLevel, assetType: assetType, repliedToEventId: repliedToEventId)) } - try await sendLocationBodyGeoUriDescriptionZoomLevelAssetTypeReplyParamsClosure?(body, geoUri, description, zoomLevel, assetType, replyParams) + try await sendLocationBodyGeoUriDescriptionZoomLevelAssetTypeRepliedToEventIdClosure?(body, geoUri, description, zoomLevel, assetType, repliedToEventId) } //MARK: - sendPollResponse @@ -23356,16 +23421,16 @@ open class TimelineSDKMock: MatrixRustSDK.Timeline, @unchecked Sendable { //MARK: - sendReply - open var sendReplyMsgReplyParamsThrowableError: Error? - var sendReplyMsgReplyParamsUnderlyingCallsCount = 0 - open var sendReplyMsgReplyParamsCallsCount: Int { + open var sendReplyMsgEventIdThrowableError: Error? + var sendReplyMsgEventIdUnderlyingCallsCount = 0 + open var sendReplyMsgEventIdCallsCount: Int { get { if Thread.isMainThread { - return sendReplyMsgReplyParamsUnderlyingCallsCount + return sendReplyMsgEventIdUnderlyingCallsCount } else { var returnValue: Int? = nil DispatchQueue.main.sync { - returnValue = sendReplyMsgReplyParamsUnderlyingCallsCount + returnValue = sendReplyMsgEventIdUnderlyingCallsCount } return returnValue! @@ -23373,31 +23438,31 @@ open class TimelineSDKMock: MatrixRustSDK.Timeline, @unchecked Sendable { } set { if Thread.isMainThread { - sendReplyMsgReplyParamsUnderlyingCallsCount = newValue + sendReplyMsgEventIdUnderlyingCallsCount = newValue } else { DispatchQueue.main.sync { - sendReplyMsgReplyParamsUnderlyingCallsCount = newValue + sendReplyMsgEventIdUnderlyingCallsCount = newValue } } } } - open var sendReplyMsgReplyParamsCalled: Bool { - return sendReplyMsgReplyParamsCallsCount > 0 + open var sendReplyMsgEventIdCalled: Bool { + return sendReplyMsgEventIdCallsCount > 0 } - open var sendReplyMsgReplyParamsReceivedArguments: (msg: RoomMessageEventContentWithoutRelation, replyParams: ReplyParameters)? - open var sendReplyMsgReplyParamsReceivedInvocations: [(msg: RoomMessageEventContentWithoutRelation, replyParams: ReplyParameters)] = [] - open var sendReplyMsgReplyParamsClosure: ((RoomMessageEventContentWithoutRelation, ReplyParameters) async throws -> Void)? + open var sendReplyMsgEventIdReceivedArguments: (msg: RoomMessageEventContentWithoutRelation, eventId: String)? + open var sendReplyMsgEventIdReceivedInvocations: [(msg: RoomMessageEventContentWithoutRelation, eventId: String)] = [] + open var sendReplyMsgEventIdClosure: ((RoomMessageEventContentWithoutRelation, String) async throws -> Void)? - open override func sendReply(msg: RoomMessageEventContentWithoutRelation, replyParams: ReplyParameters) async throws { - if let error = sendReplyMsgReplyParamsThrowableError { + open override func sendReply(msg: RoomMessageEventContentWithoutRelation, eventId: String) async throws { + if let error = sendReplyMsgEventIdThrowableError { throw error } - sendReplyMsgReplyParamsCallsCount += 1 - sendReplyMsgReplyParamsReceivedArguments = (msg: msg, replyParams: replyParams) + sendReplyMsgEventIdCallsCount += 1 + sendReplyMsgEventIdReceivedArguments = (msg: msg, eventId: eventId) DispatchQueue.main.async { - self.sendReplyMsgReplyParamsReceivedInvocations.append((msg: msg, replyParams: replyParams)) + self.sendReplyMsgEventIdReceivedInvocations.append((msg: msg, eventId: eventId)) } - try await sendReplyMsgReplyParamsClosure?(msg, replyParams) + try await sendReplyMsgEventIdClosure?(msg, eventId) } //MARK: - sendVideo diff --git a/ElementX/Sources/Screens/MediaUploadPreviewScreen/MediaUploadPreviewScreenViewModel.swift b/ElementX/Sources/Screens/MediaUploadPreviewScreen/MediaUploadPreviewScreenViewModel.swift index 6ba3b163a..8f1fccc5a 100644 --- a/ElementX/Sources/Screens/MediaUploadPreviewScreen/MediaUploadPreviewScreenViewModel.swift +++ b/ElementX/Sources/Screens/MediaUploadPreviewScreen/MediaUploadPreviewScreenViewModel.swift @@ -61,8 +61,7 @@ class MediaUploadPreviewScreenViewModel: MediaUploadPreviewScreenViewModelType, switch await processingTask.value { case .success(let mediaInfo): switch await sendAttachment(mediaInfo: mediaInfo, - caption: caption, - threadRootEventID: threadRootEventID) { + caption: caption) { case .success: actionsSubject.send(.dismiss) case .failure(let error): @@ -90,7 +89,7 @@ class MediaUploadPreviewScreenViewModel: MediaUploadPreviewScreenViewModelType, // MARK: - Private - private func sendAttachment(mediaInfo: MediaInfo, caption: String?, threadRootEventID: String?) async -> Result { + private func sendAttachment(mediaInfo: MediaInfo, caption: String?) async -> Result { let requestHandle: ((SendAttachmentJoinHandleProtocol) -> Void) = { [weak self] handle in self?.requestHandle = handle } @@ -101,26 +100,22 @@ class MediaUploadPreviewScreenViewModel: MediaUploadPreviewScreenViewModelType, thumbnailURL: thumbnailURL, imageInfo: imageInfo, caption: caption, - threadRootEventID: threadRootEventID, requestHandle: requestHandle) case let .video(videoURL, thumbnailURL, videoInfo): return await roomProxy.timeline.sendVideo(url: videoURL, thumbnailURL: thumbnailURL, videoInfo: videoInfo, caption: caption, - threadRootEventID: threadRootEventID, requestHandle: requestHandle) case let .audio(audioURL, audioInfo): return await roomProxy.timeline.sendAudio(url: audioURL, audioInfo: audioInfo, caption: caption, - threadRootEventID: threadRootEventID, requestHandle: requestHandle) case let .file(fileURL, fileInfo): return await roomProxy.timeline.sendFile(url: fileURL, fileInfo: fileInfo, caption: caption, - threadRootEventID: threadRootEventID, requestHandle: requestHandle) } } diff --git a/ElementX/Sources/Screens/Timeline/TimelineViewModel.swift b/ElementX/Sources/Screens/Timeline/TimelineViewModel.swift index 75782e83e..beef9df5d 100644 --- a/ElementX/Sources/Screens/Timeline/TimelineViewModel.swift +++ b/ElementX/Sources/Screens/Timeline/TimelineViewModel.swift @@ -998,7 +998,7 @@ extension TimelineViewModel { let clientProxyMock = ClientProxyMock(.init()) clientProxyMock.roomSummaryForAliasReturnValue = .mock(id: "!room:matrix.org", name: "Room") clientProxyMock.roomSummaryForIdentifierReturnValue = .mock(id: "!room:matrix.org", name: "Room", canonicalAlias: "#room:matrix.org") - let roomProxy = JoinedRoomProxyMock(.init(name: "Preview room", predecessor: hasPredecessor ? .init(roomId: UUID().uuidString, lastEventId: UUID().uuidString) : nil)) + let roomProxy = JoinedRoomProxyMock(.init(name: "Preview room", predecessor: hasPredecessor ? .init(roomId: UUID().uuidString) : nil)) return TimelineViewModel(roomProxy: roomProxy, focussedEventID: nil, timelineController: timelineController ?? MockTimelineController(timelineKind: timelineKind), diff --git a/ElementX/Sources/Services/Authentication/AuthenticationService.swift b/ElementX/Sources/Services/Authentication/AuthenticationService.swift index 15c0f4fbd..405ed4a82 100644 --- a/ElementX/Sources/Services/Authentication/AuthenticationService.swift +++ b/ElementX/Sources/Services/Authentication/AuthenticationService.swift @@ -97,7 +97,8 @@ class AuthenticationService: AuthenticationServiceProtocol { let oidcData = try await client.urlForOidc(oidcConfiguration: appSettings.oidcConfiguration.rustValue, prompt: .consent, loginHint: loginHint, - deviceId: nil) + deviceId: nil, + additionalScopes: nil) return .success(OIDCAuthorizationDataProxy(underlyingData: oidcData)) } catch { MXLog.error("Failed to get URL for OIDC login: \(error)") diff --git a/ElementX/Sources/Services/Timeline/TimelineProxy.swift b/ElementX/Sources/Services/Timeline/TimelineProxy.swift index ea4d9b550..973ea344d 100644 --- a/ElementX/Sources/Services/Timeline/TimelineProxy.swift +++ b/ElementX/Sources/Services/Timeline/TimelineProxy.swift @@ -229,22 +229,15 @@ final class TimelineProxy: TimelineProxyProtocol { func sendAudio(url: URL, audioInfo: AudioInfo, caption: String?, - threadRootEventID: String?, requestHandle: @MainActor (SendAttachmentJoinHandleProtocol) -> Void) async -> Result { MXLog.info("Sending audio") - let replyParameters: ReplyParameters? = if let threadRootEventID { - ReplyParameters(eventId: threadRootEventID, enforceThread: true, replyWithinThread: false) - } else { - nil - } - do { let handle = try timeline.sendAudio(params: .init(source: .file(filename: url.path(percentEncoded: false)), caption: caption, formattedCaption: nil, // Rust will build this from the caption's markdown. mentions: nil, - replyParams: replyParameters, + inReplyTo: nil, useSendQueue: true), audioInfo: audioInfo, progressWatcher: nil) @@ -264,22 +257,15 @@ final class TimelineProxy: TimelineProxyProtocol { func sendFile(url: URL, fileInfo: FileInfo, caption: String?, - threadRootEventID: String?, requestHandle: @MainActor (SendAttachmentJoinHandleProtocol) -> Void) async -> Result { MXLog.info("Sending file") - let replyParameters: ReplyParameters? = if let threadRootEventID { - ReplyParameters(eventId: threadRootEventID, enforceThread: true, replyWithinThread: false) - } else { - nil - } - do { let handle = try timeline.sendFile(params: .init(source: .file(filename: url.path(percentEncoded: false)), caption: caption, formattedCaption: nil, // Rust will build this from the caption's markdown. mentions: nil, - replyParams: replyParameters, + inReplyTo: nil, useSendQueue: true), fileInfo: fileInfo, progressWatcher: nil) @@ -300,22 +286,15 @@ final class TimelineProxy: TimelineProxyProtocol { thumbnailURL: URL, imageInfo: ImageInfo, caption: String?, - threadRootEventID: String?, requestHandle: @MainActor (SendAttachmentJoinHandleProtocol) -> Void) async -> Result { MXLog.info("Sending image") - let replyParameters: ReplyParameters? = if let threadRootEventID { - ReplyParameters(eventId: threadRootEventID, enforceThread: true, replyWithinThread: false) - } else { - nil - } - do { let handle = try timeline.sendImage(params: .init(source: .file(filename: url.path(percentEncoded: false)), caption: caption, formattedCaption: nil, // Rust will build this from the caption's markdown. mentions: nil, - replyParams: replyParameters, + inReplyTo: nil, useSendQueue: true), thumbnailPath: thumbnailURL.path(percentEncoded: false), imageInfo: imageInfo, @@ -337,23 +316,16 @@ final class TimelineProxy: TimelineProxyProtocol { geoURI: GeoURI, description: String?, zoomLevel: UInt8?, - assetType: AssetType?, - threadRootEventID: String?) async -> Result { + assetType: AssetType?) async -> Result { MXLog.info("Sending location") - let replyParameters: ReplyParameters? = if let threadRootEventID { - ReplyParameters(eventId: threadRootEventID, enforceThread: true, replyWithinThread: false) - } else { - nil - } - do { try await timeline.sendLocation(body: body, geoUri: geoURI.string, description: description, zoomLevel: zoomLevel, assetType: assetType, - replyParams: replyParameters) + repliedToEventId: nil) MXLog.info("Finished sending location") } catch { @@ -368,22 +340,15 @@ final class TimelineProxy: TimelineProxyProtocol { thumbnailURL: URL, videoInfo: VideoInfo, caption: String?, - threadRootEventID: String?, requestHandle: @MainActor (SendAttachmentJoinHandleProtocol) -> Void) async -> Result { MXLog.info("Sending video") - let replyParameters: ReplyParameters? = if let threadRootEventID { - ReplyParameters(eventId: threadRootEventID, enforceThread: true, replyWithinThread: false) - } else { - nil - } - do { let handle = try timeline.sendVideo(params: .init(source: .file(filename: url.path(percentEncoded: false)), caption: caption, formattedCaption: nil, mentions: nil, - replyParams: replyParameters, + inReplyTo: nil, useSendQueue: true), thumbnailPath: thumbnailURL.path(percentEncoded: false), videoInfo: videoInfo, @@ -404,22 +369,15 @@ final class TimelineProxy: TimelineProxyProtocol { func sendVoiceMessage(url: URL, audioInfo: AudioInfo, waveform: [UInt16], - threadRootEventID: String?, requestHandle: @MainActor (SendAttachmentJoinHandleProtocol) -> Void) async -> Result { MXLog.info("Sending voice message") - let replyParameters: ReplyParameters? = if let threadRootEventID { - ReplyParameters(eventId: threadRootEventID, enforceThread: true, replyWithinThread: false) - } else { - nil - } - do { let handle = try timeline.sendVoiceMessage(params: .init(source: .file(filename: url.path(percentEncoded: false)), caption: nil, formattedCaption: nil, mentions: nil, - replyParams: replyParameters, + inReplyTo: nil, useSendQueue: true), audioInfo: audioInfo, waveform: waveform, @@ -438,14 +396,10 @@ final class TimelineProxy: TimelineProxyProtocol { } /// Send a message within a room. If `inReplyToEventID` is specified then it will be sent as a reply - /// to that particular message. If the `threadRootEventID` is also specified then it will be sent - /// as a reply to the given `inReplyToEventID` within the thread rooted in `threadRootEventID` - /// - /// Internally `enforceThread` is set to true whenever `threadRootEventID` is specified - /// and `replyWithinThread` when `inReplyToEventID` is. + /// to that particular message. This works for both normal and threaded timelines with the relation and + /// fallback logic being handled SDK side based on the timeline instance focus mode. func sendMessage(_ message: String, html: String?, - threadRootEventID: String?, inReplyToEventID: String? = nil, intentionalMentions: IntentionalMentions) async -> Result { if let inReplyToEventID { @@ -460,18 +414,10 @@ final class TimelineProxy: TimelineProxyProtocol { do { if let inReplyToEventID { - try await timeline.sendReply(msg: messageContent, replyParams: .init(eventId: inReplyToEventID, - enforceThread: threadRootEventID != nil, - replyWithinThread: threadRootEventID != nil)) + try await timeline.sendReply(msg: messageContent, eventId: inReplyToEventID) MXLog.info("Finished sending reply to eventID: \(inReplyToEventID)") } else { - if let threadRootEventID { - try await timeline.sendReply(msg: messageContent, replyParams: .init(eventId: threadRootEventID, - enforceThread: true, - replyWithinThread: false)) - } else { - _ = try await timeline.send(msg: messageContent) - } + _ = try await timeline.send(msg: messageContent) MXLog.info("Finished sending message") } } catch { @@ -543,8 +489,7 @@ final class TimelineProxy: TimelineProxyProtocol { // MARK: - Polls func createPoll(question: String, answers: [String], - pollKind: Poll.Kind, - threadRootEventID: String? = nil) async -> Result { + pollKind: Poll.Kind) async -> Result { MXLog.info("Creating poll") do { diff --git a/ElementX/Sources/Services/Timeline/TimelineProxyProtocol.swift b/ElementX/Sources/Services/Timeline/TimelineProxyProtocol.swift index fa24e8781..408bec4a7 100644 --- a/ElementX/Sources/Services/Timeline/TimelineProxyProtocol.swift +++ b/ElementX/Sources/Services/Timeline/TimelineProxyProtocol.swift @@ -82,40 +82,34 @@ protocol TimelineProxyProtocol { func sendAudio(url: URL, audioInfo: AudioInfo, caption: String?, - threadRootEventID: String?, requestHandle: @MainActor (SendAttachmentJoinHandleProtocol) -> Void) async -> Result func sendFile(url: URL, fileInfo: FileInfo, caption: String?, - threadRootEventID: String?, requestHandle: @MainActor (SendAttachmentJoinHandleProtocol) -> Void) async -> Result func sendImage(url: URL, thumbnailURL: URL, imageInfo: ImageInfo, caption: String?, - threadRootEventID: String?, requestHandle: @MainActor (SendAttachmentJoinHandleProtocol) -> Void) async -> Result func sendLocation(body: String, geoURI: GeoURI, description: String?, zoomLevel: UInt8?, - assetType: AssetType?, - threadRootEventID: String?) async -> Result + assetType: AssetType?) async -> Result func sendVideo(url: URL, thumbnailURL: URL, videoInfo: VideoInfo, caption: String?, - threadRootEventID: String?, requestHandle: @MainActor (SendAttachmentJoinHandleProtocol) -> Void) async -> Result func sendVoiceMessage(url: URL, audioInfo: AudioInfo, waveform: [UInt16], - threadRootEventID: String?, requestHandle: @MainActor (SendAttachmentJoinHandleProtocol) -> Void) async -> Result func sendReadReceipt(for eventID: String, type: ReceiptType) async -> Result @@ -125,13 +119,12 @@ protocol TimelineProxyProtocol { func sendMessage(_ message: String, html: String?, - threadRootEventID: String?, inReplyToEventID: String?, intentionalMentions: IntentionalMentions) async -> Result func toggleReaction(_ reaction: String, to eventID: TimelineItemIdentifier.EventOrTransactionID) async -> Result - func createPoll(question: String, answers: [String], pollKind: Poll.Kind, threadRootEventID: String?) async -> Result + func createPoll(question: String, answers: [String], pollKind: Poll.Kind) async -> Result func editPoll(original eventID: String, question: String, diff --git a/ElementX/Sources/Services/VoiceMessage/VoiceMessageRecorder.swift b/ElementX/Sources/Services/VoiceMessage/VoiceMessageRecorder.swift index c9f5eaee4..3cd639678 100644 --- a/ElementX/Sources/Services/VoiceMessage/VoiceMessageRecorder.swift +++ b/ElementX/Sources/Services/VoiceMessage/VoiceMessageRecorder.swift @@ -180,8 +180,7 @@ class VoiceMessageRecorder: VoiceMessageRecorderProtocol { let result = await roomProxy.timeline.sendVoiceMessage(url: oggFile, audioInfo: audioInfo, - waveform: waveform, - threadRootEventID: threadRootEventID) { _ in } + waveform: waveform) { _ in } if case .failure(let error) = result { MXLog.error("Failed to send the voice message. \(error)") diff --git a/UnitTests/Sources/AuthenticationStartScreenViewModelTests.swift b/UnitTests/Sources/AuthenticationStartScreenViewModelTests.swift index 62d4509b7..17f330a00 100644 --- a/UnitTests/Sources/AuthenticationStartScreenViewModelTests.swift +++ b/UnitTests/Sources/AuthenticationStartScreenViewModelTests.swift @@ -34,7 +34,7 @@ class AuthenticationStartScreenViewModelTests: XCTestCase { // Given a view model that has no provisioning parameters. setupViewModel() XCTAssertEqual(authenticationService.homeserver.value.loginMode, .unknown) - XCTAssertEqual(client.urlForOidcOidcConfigurationPromptLoginHintDeviceIdCallsCount, 0) + XCTAssertEqual(client.urlForOidcOidcConfigurationPromptLoginHintDeviceIdAdditionalScopesCallsCount, 0) // When tapping any of the buttons on the screen let actions: [(AuthenticationStartScreenViewAction, AuthenticationStartScreenViewModelAction)] = [ @@ -51,7 +51,7 @@ class AuthenticationStartScreenViewModelTests: XCTestCase { // Then the authentication service should not be used yet. XCTAssertEqual(clientFactory.makeClientHomeserverAddressSessionDirectoriesPassphraseClientSessionDelegateAppSettingsAppHooksCallsCount, 0) - XCTAssertEqual(client.urlForOidcOidcConfigurationPromptLoginHintDeviceIdCallsCount, 0) + XCTAssertEqual(client.urlForOidcOidcConfigurationPromptLoginHintDeviceIdAdditionalScopesCallsCount, 0) XCTAssertEqual(authenticationService.homeserver.value.loginMode, .unknown) } } @@ -60,7 +60,7 @@ class AuthenticationStartScreenViewModelTests: XCTestCase { // Given a view model that has been provisioned with a server that supports OIDC. setupViewModel(provisioningParameters: .init(accountProvider: "company.com", loginHint: "user@company.com")) XCTAssertEqual(authenticationService.homeserver.value.loginMode, .unknown) - XCTAssertEqual(client.urlForOidcOidcConfigurationPromptLoginHintDeviceIdCallsCount, 0) + XCTAssertEqual(client.urlForOidcOidcConfigurationPromptLoginHintDeviceIdAdditionalScopesCallsCount, 0) // When tapping the login button the authentication service should be used and the screen // should request to continue the flow without any server selection needed. @@ -69,9 +69,9 @@ class AuthenticationStartScreenViewModelTests: XCTestCase { try await deferred.fulfill() XCTAssertEqual(clientFactory.makeClientHomeserverAddressSessionDirectoriesPassphraseClientSessionDelegateAppSettingsAppHooksCallsCount, 1) - XCTAssertEqual(client.urlForOidcOidcConfigurationPromptLoginHintDeviceIdCallsCount, 1) - XCTAssertEqual(client.urlForOidcOidcConfigurationPromptLoginHintDeviceIdReceivedArguments?.prompt, .consent) - XCTAssertEqual(client.urlForOidcOidcConfigurationPromptLoginHintDeviceIdReceivedArguments?.loginHint, "user@company.com") + XCTAssertEqual(client.urlForOidcOidcConfigurationPromptLoginHintDeviceIdAdditionalScopesCallsCount, 1) + XCTAssertEqual(client.urlForOidcOidcConfigurationPromptLoginHintDeviceIdAdditionalScopesReceivedArguments?.prompt, .consent) + XCTAssertEqual(client.urlForOidcOidcConfigurationPromptLoginHintDeviceIdAdditionalScopesReceivedArguments?.loginHint, "user@company.com") XCTAssertEqual(authenticationService.homeserver.value.loginMode, .oidc(supportsCreatePrompt: false)) } @@ -79,7 +79,7 @@ class AuthenticationStartScreenViewModelTests: XCTestCase { // Given a view model that has been provisioned with a server that does not support OIDC. setupViewModel(provisioningParameters: .init(accountProvider: "company.com", loginHint: "user@company.com"), supportsOIDC: false) XCTAssertEqual(authenticationService.homeserver.value.loginMode, .unknown) - XCTAssertEqual(client.urlForOidcOidcConfigurationPromptLoginHintDeviceIdCallsCount, 0) + XCTAssertEqual(client.urlForOidcOidcConfigurationPromptLoginHintDeviceIdAdditionalScopesCallsCount, 0) // When tapping the login button the authentication service should be used and the screen // should request to continue the flow without any server selection needed. @@ -97,7 +97,7 @@ class AuthenticationStartScreenViewModelTests: XCTestCase { setAllowedAccountProviders(["company.com"]) setupViewModel() XCTAssertEqual(authenticationService.homeserver.value.loginMode, .unknown) - XCTAssertEqual(client.urlForOidcOidcConfigurationPromptLoginHintDeviceIdCallsCount, 0) + XCTAssertEqual(client.urlForOidcOidcConfigurationPromptLoginHintDeviceIdAdditionalScopesCallsCount, 0) // When tapping the login button the authentication service should be used and the screen // should request to continue the flow without any server selection needed. @@ -106,9 +106,9 @@ class AuthenticationStartScreenViewModelTests: XCTestCase { try await deferred.fulfill() XCTAssertEqual(clientFactory.makeClientHomeserverAddressSessionDirectoriesPassphraseClientSessionDelegateAppSettingsAppHooksCallsCount, 1) - XCTAssertEqual(client.urlForOidcOidcConfigurationPromptLoginHintDeviceIdCallsCount, 1) - XCTAssertEqual(client.urlForOidcOidcConfigurationPromptLoginHintDeviceIdReceivedArguments?.prompt, .consent) - XCTAssertEqual(client.urlForOidcOidcConfigurationPromptLoginHintDeviceIdReceivedArguments?.loginHint, nil) + XCTAssertEqual(client.urlForOidcOidcConfigurationPromptLoginHintDeviceIdAdditionalScopesCallsCount, 1) + XCTAssertEqual(client.urlForOidcOidcConfigurationPromptLoginHintDeviceIdAdditionalScopesReceivedArguments?.prompt, .consent) + XCTAssertEqual(client.urlForOidcOidcConfigurationPromptLoginHintDeviceIdAdditionalScopesReceivedArguments?.loginHint, nil) XCTAssertEqual(authenticationService.homeserver.value.loginMode, .oidc(supportsCreatePrompt: false)) } @@ -117,7 +117,7 @@ class AuthenticationStartScreenViewModelTests: XCTestCase { setAllowedAccountProviders(["company.com"]) setupViewModel(supportsOIDC: false) XCTAssertEqual(authenticationService.homeserver.value.loginMode, .unknown) - XCTAssertEqual(client.urlForOidcOidcConfigurationPromptLoginHintDeviceIdCallsCount, 0) + XCTAssertEqual(client.urlForOidcOidcConfigurationPromptLoginHintDeviceIdAdditionalScopesCallsCount, 0) // When tapping the login button the authentication service should be used and the screen // should request to continue the flow without any server selection needed. diff --git a/UnitTests/Sources/MediaUploadPreviewScreenViewModelTests.swift b/UnitTests/Sources/MediaUploadPreviewScreenViewModelTests.swift index 80e51afeb..03c59588b 100644 --- a/UnitTests/Sources/MediaUploadPreviewScreenViewModelTests.swift +++ b/UnitTests/Sources/MediaUploadPreviewScreenViewModelTests.swift @@ -106,16 +106,16 @@ class MediaUploadPreviewScreenViewModelTests: XCTestCase { private func setUpViewModel(url: URL, expectedCaption: String?) { timelineProxy = TimelineProxyMock(.init()) - timelineProxy.sendAudioUrlAudioInfoCaptionThreadRootEventIDRequestHandleClosure = { [weak self] _, _, caption, _, _ in + timelineProxy.sendAudioUrlAudioInfoCaptionRequestHandleClosure = { [weak self] _, _, caption, _ in self?.verifyCaption(caption, expectedCaption: expectedCaption) ?? .failure(.sdkError(TestError.unknown)) } - timelineProxy.sendFileUrlFileInfoCaptionThreadRootEventIDRequestHandleClosure = { [weak self] _, _, caption, _, _ in + timelineProxy.sendFileUrlFileInfoCaptionRequestHandleClosure = { [weak self] _, _, caption, _ in self?.verifyCaption(caption, expectedCaption: expectedCaption) ?? .failure(.sdkError(TestError.unknown)) } - timelineProxy.sendImageUrlThumbnailURLImageInfoCaptionThreadRootEventIDRequestHandleClosure = { [weak self] _, _, _, caption, _, _ in + timelineProxy.sendImageUrlThumbnailURLImageInfoCaptionRequestHandleClosure = { [weak self] _, _, _, caption, _ in self?.verifyCaption(caption, expectedCaption: expectedCaption) ?? .failure(.sdkError(TestError.unknown)) } - timelineProxy.sendVideoUrlThumbnailURLVideoInfoCaptionThreadRootEventIDRequestHandleClosure = { [weak self] _, _, _, caption, _, _ in + timelineProxy.sendVideoUrlThumbnailURLVideoInfoCaptionRequestHandleClosure = { [weak self] _, _, _, caption, _ in self?.verifyCaption(caption, expectedCaption: expectedCaption) ?? .failure(.sdkError(TestError.unknown)) } diff --git a/UnitTests/Sources/ServerConfirmationScreenViewModelTests.swift b/UnitTests/Sources/ServerConfirmationScreenViewModelTests.swift index 2aa7e0da0..b4843b47d 100644 --- a/UnitTests/Sources/ServerConfirmationScreenViewModelTests.swift +++ b/UnitTests/Sources/ServerConfirmationScreenViewModelTests.swift @@ -38,7 +38,7 @@ class ServerConfirmationScreenViewModelTests: XCTestCase { XCTAssertEqual(service.homeserver.value.loginMode, .unknown) XCTAssertEqual(context.viewState.mode, .confirmation(service.homeserver.value.address)) XCTAssertEqual(clientFactory.makeClientHomeserverAddressSessionDirectoriesPassphraseClientSessionDelegateAppSettingsAppHooksCallsCount, 0) - XCTAssertEqual(client.urlForOidcOidcConfigurationPromptLoginHintDeviceIdCallsCount, 0) + XCTAssertEqual(client.urlForOidcOidcConfigurationPromptLoginHintDeviceIdAdditionalScopesCallsCount, 0) // When continuing from the confirmation screen. let deferred = deferFulfillment(viewModel.actions) { $0.isContinueWithOIDC } @@ -47,8 +47,8 @@ class ServerConfirmationScreenViewModelTests: XCTestCase { // Then a call to configure service should be made. XCTAssertEqual(clientFactory.makeClientHomeserverAddressSessionDirectoriesPassphraseClientSessionDelegateAppSettingsAppHooksCallsCount, 1) - XCTAssertEqual(client.urlForOidcOidcConfigurationPromptLoginHintDeviceIdCallsCount, 1) - XCTAssertEqual(client.urlForOidcOidcConfigurationPromptLoginHintDeviceIdReceivedArguments?.prompt, .consent) + XCTAssertEqual(client.urlForOidcOidcConfigurationPromptLoginHintDeviceIdAdditionalScopesCallsCount, 1) + XCTAssertEqual(client.urlForOidcOidcConfigurationPromptLoginHintDeviceIdAdditionalScopesReceivedArguments?.prompt, .consent) XCTAssertEqual(service.homeserver.value.loginMode, .oidc(supportsCreatePrompt: true)) } @@ -62,7 +62,7 @@ class ServerConfirmationScreenViewModelTests: XCTestCase { XCTAssertEqual(service.homeserver.value.loginMode, .oidc(supportsCreatePrompt: true)) XCTAssertEqual(context.viewState.mode, .confirmation(service.homeserver.value.address)) XCTAssertEqual(clientFactory.makeClientHomeserverAddressSessionDirectoriesPassphraseClientSessionDelegateAppSettingsAppHooksCallsCount, 1) - XCTAssertEqual(client.urlForOidcOidcConfigurationPromptLoginHintDeviceIdCallsCount, 0) + XCTAssertEqual(client.urlForOidcOidcConfigurationPromptLoginHintDeviceIdAdditionalScopesCallsCount, 0) // When continuing from the confirmation screen. let deferred = deferFulfillment(viewModel.actions) { $0.isContinueWithOIDC } @@ -71,8 +71,8 @@ class ServerConfirmationScreenViewModelTests: XCTestCase { // Then the configured homeserver should be used and no additional client should be built. XCTAssertEqual(clientFactory.makeClientHomeserverAddressSessionDirectoriesPassphraseClientSessionDelegateAppSettingsAppHooksCallsCount, 1) - XCTAssertEqual(client.urlForOidcOidcConfigurationPromptLoginHintDeviceIdCallsCount, 1) - XCTAssertEqual(client.urlForOidcOidcConfigurationPromptLoginHintDeviceIdReceivedArguments?.prompt, .consent) + XCTAssertEqual(client.urlForOidcOidcConfigurationPromptLoginHintDeviceIdAdditionalScopesCallsCount, 1) + XCTAssertEqual(client.urlForOidcOidcConfigurationPromptLoginHintDeviceIdAdditionalScopesReceivedArguments?.prompt, .consent) } func testConfirmRegisterWithoutConfiguration() async throws { @@ -81,7 +81,7 @@ class ServerConfirmationScreenViewModelTests: XCTestCase { XCTAssertEqual(service.homeserver.value.loginMode, .unknown) XCTAssertEqual(context.viewState.mode, .confirmation(service.homeserver.value.address)) XCTAssertEqual(clientFactory.makeClientHomeserverAddressSessionDirectoriesPassphraseClientSessionDelegateAppSettingsAppHooksCallsCount, 0) - XCTAssertEqual(client.urlForOidcOidcConfigurationPromptLoginHintDeviceIdCallsCount, 0) + XCTAssertEqual(client.urlForOidcOidcConfigurationPromptLoginHintDeviceIdAdditionalScopesCallsCount, 0) // When continuing from the confirmation screen. let deferred = deferFulfillment(viewModel.actions) { $0.isContinueWithOIDC } @@ -90,7 +90,7 @@ class ServerConfirmationScreenViewModelTests: XCTestCase { // Then a call to configure service should be made. XCTAssertEqual(clientFactory.makeClientHomeserverAddressSessionDirectoriesPassphraseClientSessionDelegateAppSettingsAppHooksCallsCount, 1) - XCTAssertEqual(client.urlForOidcOidcConfigurationPromptLoginHintDeviceIdCallsCount, 1) + XCTAssertEqual(client.urlForOidcOidcConfigurationPromptLoginHintDeviceIdAdditionalScopesCallsCount, 1) // The create prompt is broken: https://github.com/element-hq/matrix-authentication-service/issues/3429 // XCTAssertEqual(client.urlForOidcOidcConfigurationPromptReceivedArguments?.prompt, .create) XCTAssertEqual(service.homeserver.value.loginMode, .oidc(supportsCreatePrompt: true)) @@ -106,7 +106,7 @@ class ServerConfirmationScreenViewModelTests: XCTestCase { XCTAssertEqual(service.homeserver.value.loginMode, .oidc(supportsCreatePrompt: true)) XCTAssertEqual(context.viewState.mode, .confirmation(service.homeserver.value.address)) XCTAssertEqual(clientFactory.makeClientHomeserverAddressSessionDirectoriesPassphraseClientSessionDelegateAppSettingsAppHooksCallsCount, 1) - XCTAssertEqual(client.urlForOidcOidcConfigurationPromptLoginHintDeviceIdCallsCount, 0) + XCTAssertEqual(client.urlForOidcOidcConfigurationPromptLoginHintDeviceIdAdditionalScopesCallsCount, 0) // When continuing from the confirmation screen. let deferred = deferFulfillment(viewModel.actions) { $0.isContinueWithOIDC } @@ -117,7 +117,7 @@ class ServerConfirmationScreenViewModelTests: XCTestCase { XCTAssertEqual(clientFactory.makeClientHomeserverAddressSessionDirectoriesPassphraseClientSessionDelegateAppSettingsAppHooksCallsCount, 1) // The create prompt is broken: https://github.com/element-hq/matrix-authentication-service/issues/3429 // XCTAssertEqual(client.urlForOidcOidcConfigurationPromptReceivedArguments?.prompt, .create) - XCTAssertEqual(client.urlForOidcOidcConfigurationPromptLoginHintDeviceIdCallsCount, 1) + XCTAssertEqual(client.urlForOidcOidcConfigurationPromptLoginHintDeviceIdAdditionalScopesCallsCount, 1) } func testConfirmPasswordLoginWithoutConfiguration() async throws { @@ -126,7 +126,7 @@ class ServerConfirmationScreenViewModelTests: XCTestCase { XCTAssertEqual(service.homeserver.value.loginMode, .unknown) XCTAssertEqual(context.viewState.mode, .confirmation(service.homeserver.value.address)) XCTAssertEqual(clientFactory.makeClientHomeserverAddressSessionDirectoriesPassphraseClientSessionDelegateAppSettingsAppHooksCallsCount, 0) - XCTAssertEqual(client.urlForOidcOidcConfigurationPromptLoginHintDeviceIdCallsCount, 0) + XCTAssertEqual(client.urlForOidcOidcConfigurationPromptLoginHintDeviceIdAdditionalScopesCallsCount, 0) // When continuing from the confirmation screen. let deferred = deferFulfillment(viewModel.actions) { $0.isContinueWithPassword } @@ -135,7 +135,7 @@ class ServerConfirmationScreenViewModelTests: XCTestCase { // Then a call to configure service should be made, but not for the OIDC URL. XCTAssertEqual(clientFactory.makeClientHomeserverAddressSessionDirectoriesPassphraseClientSessionDelegateAppSettingsAppHooksCallsCount, 1) - XCTAssertEqual(client.urlForOidcOidcConfigurationPromptLoginHintDeviceIdCallsCount, 0) + XCTAssertEqual(client.urlForOidcOidcConfigurationPromptLoginHintDeviceIdAdditionalScopesCallsCount, 0) XCTAssertEqual(service.homeserver.value.loginMode, .password) } @@ -149,7 +149,7 @@ class ServerConfirmationScreenViewModelTests: XCTestCase { XCTAssertEqual(service.homeserver.value.loginMode, .password) XCTAssertEqual(context.viewState.mode, .confirmation(service.homeserver.value.address)) XCTAssertEqual(clientFactory.makeClientHomeserverAddressSessionDirectoriesPassphraseClientSessionDelegateAppSettingsAppHooksCallsCount, 1) - XCTAssertEqual(client.urlForOidcOidcConfigurationPromptLoginHintDeviceIdCallsCount, 0) + XCTAssertEqual(client.urlForOidcOidcConfigurationPromptLoginHintDeviceIdAdditionalScopesCallsCount, 0) // When continuing from the confirmation screen. let deferred = deferFulfillment(viewModel.actions) { $0.isContinueWithPassword } @@ -158,7 +158,7 @@ class ServerConfirmationScreenViewModelTests: XCTestCase { // Then the configured homeserver should be used and no additional client should be built, nor a call to get the OIDC URL. XCTAssertEqual(clientFactory.makeClientHomeserverAddressSessionDirectoriesPassphraseClientSessionDelegateAppSettingsAppHooksCallsCount, 1) - XCTAssertEqual(client.urlForOidcOidcConfigurationPromptLoginHintDeviceIdCallsCount, 0) + XCTAssertEqual(client.urlForOidcOidcConfigurationPromptLoginHintDeviceIdAdditionalScopesCallsCount, 0) } func testRegistrationNotSupportedAlert() async throws { @@ -221,7 +221,7 @@ class ServerConfirmationScreenViewModelTests: XCTestCase { XCTAssertEqual(service.homeserver.value.loginMode, .unknown) XCTAssertEqual(context.viewState.mode, .picker(appSettings.accountProviders)) XCTAssertEqual(clientFactory.makeClientHomeserverAddressSessionDirectoriesPassphraseClientSessionDelegateAppSettingsAppHooksCallsCount, 0) - XCTAssertEqual(client.urlForOidcOidcConfigurationPromptLoginHintDeviceIdCallsCount, 0) + XCTAssertEqual(client.urlForOidcOidcConfigurationPromptLoginHintDeviceIdAdditionalScopesCallsCount, 0) // When continuing from the confirmation screen. let deferred = deferFulfillment(viewModel.actions) { $0.isContinueWithOIDC } @@ -230,8 +230,8 @@ class ServerConfirmationScreenViewModelTests: XCTestCase { // Then a call to configure service should be made. XCTAssertEqual(clientFactory.makeClientHomeserverAddressSessionDirectoriesPassphraseClientSessionDelegateAppSettingsAppHooksCallsCount, 1) - XCTAssertEqual(client.urlForOidcOidcConfigurationPromptLoginHintDeviceIdCallsCount, 1) - XCTAssertEqual(client.urlForOidcOidcConfigurationPromptLoginHintDeviceIdReceivedArguments?.prompt, .consent) + XCTAssertEqual(client.urlForOidcOidcConfigurationPromptLoginHintDeviceIdAdditionalScopesCallsCount, 1) + XCTAssertEqual(client.urlForOidcOidcConfigurationPromptLoginHintDeviceIdAdditionalScopesReceivedArguments?.prompt, .consent) XCTAssertEqual(service.homeserver.value.loginMode, .oidc(supportsCreatePrompt: true)) } @@ -245,7 +245,7 @@ class ServerConfirmationScreenViewModelTests: XCTestCase { XCTAssertEqual(service.homeserver.value.loginMode, .oidc(supportsCreatePrompt: true)) XCTAssertEqual(context.viewState.mode, .picker(appSettings.accountProviders)) XCTAssertEqual(clientFactory.makeClientHomeserverAddressSessionDirectoriesPassphraseClientSessionDelegateAppSettingsAppHooksCallsCount, 1) - XCTAssertEqual(client.urlForOidcOidcConfigurationPromptLoginHintDeviceIdCallsCount, 0) + XCTAssertEqual(client.urlForOidcOidcConfigurationPromptLoginHintDeviceIdAdditionalScopesCallsCount, 0) // When continuing from the confirmation screen. let deferred = deferFulfillment(viewModel.actions) { $0.isContinueWithOIDC } @@ -254,8 +254,8 @@ class ServerConfirmationScreenViewModelTests: XCTestCase { // Then the configured homeserver should be used and no additional client should be built. XCTAssertEqual(clientFactory.makeClientHomeserverAddressSessionDirectoriesPassphraseClientSessionDelegateAppSettingsAppHooksCallsCount, 1) - XCTAssertEqual(client.urlForOidcOidcConfigurationPromptLoginHintDeviceIdCallsCount, 1) - XCTAssertEqual(client.urlForOidcOidcConfigurationPromptLoginHintDeviceIdReceivedArguments?.prompt, .consent) + XCTAssertEqual(client.urlForOidcOidcConfigurationPromptLoginHintDeviceIdAdditionalScopesCallsCount, 1) + XCTAssertEqual(client.urlForOidcOidcConfigurationPromptLoginHintDeviceIdAdditionalScopesReceivedArguments?.prompt, .consent) } func testPickerForPasswordLoginWithoutConfiguration() async throws { @@ -264,7 +264,7 @@ class ServerConfirmationScreenViewModelTests: XCTestCase { XCTAssertEqual(service.homeserver.value.loginMode, .unknown) XCTAssertEqual(context.viewState.mode, .picker(appSettings.accountProviders)) XCTAssertEqual(clientFactory.makeClientHomeserverAddressSessionDirectoriesPassphraseClientSessionDelegateAppSettingsAppHooksCallsCount, 0) - XCTAssertEqual(client.urlForOidcOidcConfigurationPromptLoginHintDeviceIdCallsCount, 0) + XCTAssertEqual(client.urlForOidcOidcConfigurationPromptLoginHintDeviceIdAdditionalScopesCallsCount, 0) // When continuing from the confirmation screen. let deferred = deferFulfillment(viewModel.actions) { $0.isContinueWithPassword } @@ -273,7 +273,7 @@ class ServerConfirmationScreenViewModelTests: XCTestCase { // Then a call to configure service should be made, but not for the OIDC URL. XCTAssertEqual(clientFactory.makeClientHomeserverAddressSessionDirectoriesPassphraseClientSessionDelegateAppSettingsAppHooksCallsCount, 1) - XCTAssertEqual(client.urlForOidcOidcConfigurationPromptLoginHintDeviceIdCallsCount, 0) + XCTAssertEqual(client.urlForOidcOidcConfigurationPromptLoginHintDeviceIdAdditionalScopesCallsCount, 0) XCTAssertEqual(service.homeserver.value.loginMode, .password) } @@ -287,7 +287,7 @@ class ServerConfirmationScreenViewModelTests: XCTestCase { XCTAssertEqual(service.homeserver.value.loginMode, .password) XCTAssertEqual(context.viewState.mode, .picker(appSettings.accountProviders)) XCTAssertEqual(clientFactory.makeClientHomeserverAddressSessionDirectoriesPassphraseClientSessionDelegateAppSettingsAppHooksCallsCount, 1) - XCTAssertEqual(client.urlForOidcOidcConfigurationPromptLoginHintDeviceIdCallsCount, 0) + XCTAssertEqual(client.urlForOidcOidcConfigurationPromptLoginHintDeviceIdAdditionalScopesCallsCount, 0) // When continuing from the confirmation screen. let deferred = deferFulfillment(viewModel.actions) { $0.isContinueWithPassword } @@ -296,7 +296,7 @@ class ServerConfirmationScreenViewModelTests: XCTestCase { // Then the configured homeserver should be used and no additional client should be built, nor a call to get the OIDC URL. XCTAssertEqual(clientFactory.makeClientHomeserverAddressSessionDirectoriesPassphraseClientSessionDelegateAppSettingsAppHooksCallsCount, 1) - XCTAssertEqual(client.urlForOidcOidcConfigurationPromptLoginHintDeviceIdCallsCount, 0) + XCTAssertEqual(client.urlForOidcOidcConfigurationPromptLoginHintDeviceIdAdditionalScopesCallsCount, 0) } // MARK: - Helpers