Remove threadRootEventID parameters from TimelineProxy send methods. This is now handled internally to the SDK as long as the right timeline instance is used.

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