diff --git a/ElementX.xcodeproj/project.pbxproj b/ElementX.xcodeproj/project.pbxproj index a0c529c6ef..bab5fb81f7 100644 --- a/ElementX.xcodeproj/project.pbxproj +++ b/ElementX.xcodeproj/project.pbxproj @@ -7834,7 +7834,7 @@ repositoryURL = "https://github.com/element-hq/matrix-rust-components-swift"; requirement = { kind = exactVersion; - version = 1.0.62; + version = 1.0.63; }; }; 701C7BEF8F70F7A83E852DCC /* XCRemoteSwiftPackageReference "GZIP" */ = { diff --git a/ElementX.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved b/ElementX.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved index 4751bc7db7..eff2b29b05 100644 --- a/ElementX.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved +++ b/ElementX.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved @@ -149,8 +149,8 @@ "kind" : "remoteSourceControl", "location" : "https://github.com/element-hq/matrix-rust-components-swift", "state" : { - "revision" : "9b26e40ae6c27c56e233577c863569ff074f84fd", - "version" : "1.0.62" + "revision" : "0dcb3a3ee8b0b1bb92c2e9d6395202e2547fe0d8", + "version" : "1.0.63" } }, { diff --git a/ElementX/Sources/Mocks/Generated/SDKGeneratedMocks.swift b/ElementX/Sources/Mocks/Generated/SDKGeneratedMocks.swift index ec51a42ede..94918f2205 100644 --- a/ElementX/Sources/Mocks/Generated/SDKGeneratedMocks.swift +++ b/ElementX/Sources/Mocks/Generated/SDKGeneratedMocks.swift @@ -7047,6 +7047,71 @@ open class HomeserverLoginDetailsSDKMock: MatrixRustSDK.HomeserverLoginDetails { } } + //MARK: - supportedOidcPrompts + + var supportedOidcPromptsUnderlyingCallsCount = 0 + open var supportedOidcPromptsCallsCount: Int { + get { + if Thread.isMainThread { + return supportedOidcPromptsUnderlyingCallsCount + } else { + var returnValue: Int? = nil + DispatchQueue.main.sync { + returnValue = supportedOidcPromptsUnderlyingCallsCount + } + + return returnValue! + } + } + set { + if Thread.isMainThread { + supportedOidcPromptsUnderlyingCallsCount = newValue + } else { + DispatchQueue.main.sync { + supportedOidcPromptsUnderlyingCallsCount = newValue + } + } + } + } + open var supportedOidcPromptsCalled: Bool { + return supportedOidcPromptsCallsCount > 0 + } + + var supportedOidcPromptsUnderlyingReturnValue: [OidcPrompt]! + open var supportedOidcPromptsReturnValue: [OidcPrompt]! { + get { + if Thread.isMainThread { + return supportedOidcPromptsUnderlyingReturnValue + } else { + var returnValue: [OidcPrompt]? = nil + DispatchQueue.main.sync { + returnValue = supportedOidcPromptsUnderlyingReturnValue + } + + return returnValue! + } + } + set { + if Thread.isMainThread { + supportedOidcPromptsUnderlyingReturnValue = newValue + } else { + DispatchQueue.main.sync { + supportedOidcPromptsUnderlyingReturnValue = newValue + } + } + } + } + open var supportedOidcPromptsClosure: (() -> [OidcPrompt])? + + open override func supportedOidcPrompts() -> [OidcPrompt] { + supportedOidcPromptsCallsCount += 1 + if let supportedOidcPromptsClosure = supportedOidcPromptsClosure { + return supportedOidcPromptsClosure() + } else { + return supportedOidcPromptsReturnValue + } + } + //MARK: - supportsOidcLogin var supportsOidcLoginUnderlyingCallsCount = 0 @@ -14359,16 +14424,16 @@ open class RoomDirectorySearchSDKMock: MatrixRustSDK.RoomDirectorySearch { //MARK: - search - open var searchFilterBatchSizeThrowableError: Error? - var searchFilterBatchSizeUnderlyingCallsCount = 0 - open var searchFilterBatchSizeCallsCount: Int { + open var searchFilterBatchSizeViaServerNameThrowableError: Error? + var searchFilterBatchSizeViaServerNameUnderlyingCallsCount = 0 + open var searchFilterBatchSizeViaServerNameCallsCount: Int { get { if Thread.isMainThread { - return searchFilterBatchSizeUnderlyingCallsCount + return searchFilterBatchSizeViaServerNameUnderlyingCallsCount } else { var returnValue: Int? = nil DispatchQueue.main.sync { - returnValue = searchFilterBatchSizeUnderlyingCallsCount + returnValue = searchFilterBatchSizeViaServerNameUnderlyingCallsCount } return returnValue! @@ -14376,31 +14441,31 @@ open class RoomDirectorySearchSDKMock: MatrixRustSDK.RoomDirectorySearch { } set { if Thread.isMainThread { - searchFilterBatchSizeUnderlyingCallsCount = newValue + searchFilterBatchSizeViaServerNameUnderlyingCallsCount = newValue } else { DispatchQueue.main.sync { - searchFilterBatchSizeUnderlyingCallsCount = newValue + searchFilterBatchSizeViaServerNameUnderlyingCallsCount = newValue } } } } - open var searchFilterBatchSizeCalled: Bool { - return searchFilterBatchSizeCallsCount > 0 + open var searchFilterBatchSizeViaServerNameCalled: Bool { + return searchFilterBatchSizeViaServerNameCallsCount > 0 } - open var searchFilterBatchSizeReceivedArguments: (filter: String?, batchSize: UInt32)? - open var searchFilterBatchSizeReceivedInvocations: [(filter: String?, batchSize: UInt32)] = [] - open var searchFilterBatchSizeClosure: ((String?, UInt32) async throws -> Void)? + open var searchFilterBatchSizeViaServerNameReceivedArguments: (filter: String?, batchSize: UInt32, viaServerName: String?)? + open var searchFilterBatchSizeViaServerNameReceivedInvocations: [(filter: String?, batchSize: UInt32, viaServerName: String?)] = [] + open var searchFilterBatchSizeViaServerNameClosure: ((String?, UInt32, String?) async throws -> Void)? - open override func search(filter: String?, batchSize: UInt32) async throws { - if let error = searchFilterBatchSizeThrowableError { + open override func search(filter: String?, batchSize: UInt32, viaServerName: String?) async throws { + if let error = searchFilterBatchSizeViaServerNameThrowableError { throw error } - searchFilterBatchSizeCallsCount += 1 - searchFilterBatchSizeReceivedArguments = (filter: filter, batchSize: batchSize) + searchFilterBatchSizeViaServerNameCallsCount += 1 + searchFilterBatchSizeViaServerNameReceivedArguments = (filter: filter, batchSize: batchSize, viaServerName: viaServerName) DispatchQueue.main.async { - self.searchFilterBatchSizeReceivedInvocations.append((filter: filter, batchSize: batchSize)) + self.searchFilterBatchSizeViaServerNameReceivedInvocations.append((filter: filter, batchSize: batchSize, viaServerName: viaServerName)) } - try await searchFilterBatchSizeClosure?(filter, batchSize) + try await searchFilterBatchSizeViaServerNameClosure?(filter, batchSize, viaServerName) } } open class RoomListSDKMock: MatrixRustSDK.RoomList { @@ -15710,6 +15775,81 @@ open class RoomListItemSDKMock: MatrixRustSDK.RoomListItem { } } + //MARK: - previewRoom + + open var previewRoomViaThrowableError: Error? + var previewRoomViaUnderlyingCallsCount = 0 + open var previewRoomViaCallsCount: Int { + get { + if Thread.isMainThread { + return previewRoomViaUnderlyingCallsCount + } else { + var returnValue: Int? = nil + DispatchQueue.main.sync { + returnValue = previewRoomViaUnderlyingCallsCount + } + + return returnValue! + } + } + set { + if Thread.isMainThread { + previewRoomViaUnderlyingCallsCount = newValue + } else { + DispatchQueue.main.sync { + previewRoomViaUnderlyingCallsCount = newValue + } + } + } + } + open var previewRoomViaCalled: Bool { + return previewRoomViaCallsCount > 0 + } + open var previewRoomViaReceivedVia: [String]? + open var previewRoomViaReceivedInvocations: [[String]] = [] + + var previewRoomViaUnderlyingReturnValue: RoomPreview! + open var previewRoomViaReturnValue: RoomPreview! { + get { + if Thread.isMainThread { + return previewRoomViaUnderlyingReturnValue + } else { + var returnValue: RoomPreview? = nil + DispatchQueue.main.sync { + returnValue = previewRoomViaUnderlyingReturnValue + } + + return returnValue! + } + } + set { + if Thread.isMainThread { + previewRoomViaUnderlyingReturnValue = newValue + } else { + DispatchQueue.main.sync { + previewRoomViaUnderlyingReturnValue = newValue + } + } + } + } + open var previewRoomViaClosure: (([String]) async throws -> RoomPreview)? + + open override func previewRoom(via: [String]) async throws -> RoomPreview { + if let error = previewRoomViaThrowableError { + throw error + } + previewRoomViaCallsCount += 1 + previewRoomViaReceivedVia = via + DispatchQueue.main.async { + self.previewRoomViaReceivedInvocations.append(via) + } + if let previewRoomViaClosure = previewRoomViaClosure { + return try await previewRoomViaClosure(via) + } else { + return previewRoomViaReturnValue + } + } + //MARK: - roomInfo open var roomInfoThrowableError: Error? @@ -16351,6 +16491,126 @@ open class RoomMessageEventContentWithoutRelationSDKMock: MatrixRustSDK.RoomMess } } } +open class RoomPreviewSDKMock: MatrixRustSDK.RoomPreview { + init() { + super.init(noPointer: .init()) + } + + public required init(unsafeFromRawPointer pointer: UnsafeMutableRawPointer) { + fatalError("init(unsafeFromRawPointer:) has not been implemented") + } + + fileprivate var pointer: UnsafeMutableRawPointer! + + //MARK: - info + + open var infoThrowableError: Error? + var infoUnderlyingCallsCount = 0 + open var infoCallsCount: Int { + get { + if Thread.isMainThread { + return infoUnderlyingCallsCount + } else { + var returnValue: Int? = nil + DispatchQueue.main.sync { + returnValue = infoUnderlyingCallsCount + } + + return returnValue! + } + } + set { + if Thread.isMainThread { + infoUnderlyingCallsCount = newValue + } else { + DispatchQueue.main.sync { + infoUnderlyingCallsCount = newValue + } + } + } + } + open var infoCalled: Bool { + return infoCallsCount > 0 + } + + var infoUnderlyingReturnValue: RoomPreviewInfo! + open var infoReturnValue: RoomPreviewInfo! { + get { + if Thread.isMainThread { + return infoUnderlyingReturnValue + } else { + var returnValue: RoomPreviewInfo? = nil + DispatchQueue.main.sync { + returnValue = infoUnderlyingReturnValue + } + + return returnValue! + } + } + set { + if Thread.isMainThread { + infoUnderlyingReturnValue = newValue + } else { + DispatchQueue.main.sync { + infoUnderlyingReturnValue = newValue + } + } + } + } + open var infoClosure: (() throws -> RoomPreviewInfo)? + + open override func info() throws -> RoomPreviewInfo { + if let error = infoThrowableError { + throw error + } + infoCallsCount += 1 + if let infoClosure = infoClosure { + return try infoClosure() + } else { + return infoReturnValue + } + } + + //MARK: - leave + + open var leaveThrowableError: Error? + var leaveUnderlyingCallsCount = 0 + open var leaveCallsCount: Int { + get { + if Thread.isMainThread { + return leaveUnderlyingCallsCount + } else { + var returnValue: Int? = nil + DispatchQueue.main.sync { + returnValue = leaveUnderlyingCallsCount + } + + return returnValue! + } + } + set { + if Thread.isMainThread { + leaveUnderlyingCallsCount = newValue + } else { + DispatchQueue.main.sync { + leaveUnderlyingCallsCount = newValue + } + } + } + } + open var leaveCalled: Bool { + return leaveCallsCount > 0 + } + open var leaveClosure: (() async throws -> Void)? + + open override func leave() async throws { + if let error = leaveThrowableError { + throw error + } + leaveCallsCount += 1 + try await leaveClosure?() + } +} open class SendAttachmentJoinHandleSDKMock: MatrixRustSDK.SendAttachmentJoinHandle { init() { super.init(noPointer: .init()) diff --git a/ElementX/Sources/Services/RoomDirectorySearch/RoomDirectorySearchProxy.swift b/ElementX/Sources/Services/RoomDirectorySearch/RoomDirectorySearchProxy.swift index a07767bce1..7b1a74b63e 100644 --- a/ElementX/Sources/Services/RoomDirectorySearch/RoomDirectorySearchProxy.swift +++ b/ElementX/Sources/Services/RoomDirectorySearch/RoomDirectorySearchProxy.swift @@ -47,7 +47,7 @@ final class RoomDirectorySearchProxy: RoomDirectorySearchProxyProtocol { func search(query: String?) async -> Result { do { - try await roomDirectorySearch.search(filter: query, batchSize: 50) + try await roomDirectorySearch.search(filter: query, batchSize: 50, viaServerName: nil) return .success(()) } catch { return .failure(.searchFailed) diff --git a/project.yml b/project.yml index aeae881b60..1126076d92 100644 --- a/project.yml +++ b/project.yml @@ -60,7 +60,7 @@ packages: # Element/Matrix dependencies MatrixRustSDK: url: https://github.com/element-hq/matrix-rust-components-swift - exactVersion: 1.0.62 + exactVersion: 1.0.63 # path: ../matrix-rust-sdk Compound: url: https://github.com/element-hq/compound-ios