Make sure we pass the via parameters with all the routes.

Put the event ID first.

Fix tests.

Bump the SDK.
This commit is contained in:
Doug
2024-05-09 12:25:54 +01:00
committed by Stefan Ceriu
parent 52b6c25bd8
commit 1e0a6d76ae
23 changed files with 293 additions and 199 deletions
@@ -2428,15 +2428,15 @@ class ClientProxyMock: ClientProxyProtocol {
}
//MARK: - joinRoom
var joinRoomUnderlyingCallsCount = 0
var joinRoomCallsCount: Int {
var joinRoomViaUnderlyingCallsCount = 0
var joinRoomViaCallsCount: Int {
get {
if Thread.isMainThread {
return joinRoomUnderlyingCallsCount
return joinRoomViaUnderlyingCallsCount
} else {
var returnValue: Int? = nil
DispatchQueue.main.sync {
returnValue = joinRoomUnderlyingCallsCount
returnValue = joinRoomViaUnderlyingCallsCount
}
return returnValue!
@@ -2444,29 +2444,29 @@ class ClientProxyMock: ClientProxyProtocol {
}
set {
if Thread.isMainThread {
joinRoomUnderlyingCallsCount = newValue
joinRoomViaUnderlyingCallsCount = newValue
} else {
DispatchQueue.main.sync {
joinRoomUnderlyingCallsCount = newValue
joinRoomViaUnderlyingCallsCount = newValue
}
}
}
}
var joinRoomCalled: Bool {
return joinRoomCallsCount > 0
var joinRoomViaCalled: Bool {
return joinRoomViaCallsCount > 0
}
var joinRoomReceivedRoomID: String?
var joinRoomReceivedInvocations: [String] = []
var joinRoomViaReceivedArguments: (roomID: String, via: [String])?
var joinRoomViaReceivedInvocations: [(roomID: String, via: [String])] = []
var joinRoomUnderlyingReturnValue: Result<Void, ClientProxyError>!
var joinRoomReturnValue: Result<Void, ClientProxyError>! {
var joinRoomViaUnderlyingReturnValue: Result<Void, ClientProxyError>!
var joinRoomViaReturnValue: Result<Void, ClientProxyError>! {
get {
if Thread.isMainThread {
return joinRoomUnderlyingReturnValue
return joinRoomViaUnderlyingReturnValue
} else {
var returnValue: Result<Void, ClientProxyError>? = nil
DispatchQueue.main.sync {
returnValue = joinRoomUnderlyingReturnValue
returnValue = joinRoomViaUnderlyingReturnValue
}
return returnValue!
@@ -2474,24 +2474,24 @@ class ClientProxyMock: ClientProxyProtocol {
}
set {
if Thread.isMainThread {
joinRoomUnderlyingReturnValue = newValue
joinRoomViaUnderlyingReturnValue = newValue
} else {
DispatchQueue.main.sync {
joinRoomUnderlyingReturnValue = newValue
joinRoomViaUnderlyingReturnValue = newValue
}
}
}
}
var joinRoomClosure: ((String) async -> Result<Void, ClientProxyError>)?
var joinRoomViaClosure: ((String, [String]) async -> Result<Void, ClientProxyError>)?
func joinRoom(_ roomID: String) async -> Result<Void, ClientProxyError> {
joinRoomCallsCount += 1
joinRoomReceivedRoomID = roomID
joinRoomReceivedInvocations.append(roomID)
if let joinRoomClosure = joinRoomClosure {
return await joinRoomClosure(roomID)
func joinRoom(_ roomID: String, via: [String]) async -> Result<Void, ClientProxyError> {
joinRoomViaCallsCount += 1
joinRoomViaReceivedArguments = (roomID: roomID, via: via)
joinRoomViaReceivedInvocations.append((roomID: roomID, via: via))
if let joinRoomViaClosure = joinRoomViaClosure {
return await joinRoomViaClosure(roomID, via)
} else {
return joinRoomReturnValue
return joinRoomViaReturnValue
}
}
//MARK: - uploadMedia
@@ -3431,13 +3431,13 @@ class ClientProxyMock: ClientProxyProtocol {
var resolveRoomAliasReceivedAlias: String?
var resolveRoomAliasReceivedInvocations: [String] = []
var resolveRoomAliasUnderlyingReturnValue: String?
var resolveRoomAliasReturnValue: String? {
var resolveRoomAliasUnderlyingReturnValue: ResolvedRoomAlias?
var resolveRoomAliasReturnValue: ResolvedRoomAlias? {
get {
if Thread.isMainThread {
return resolveRoomAliasUnderlyingReturnValue
} else {
var returnValue: String?? = nil
var returnValue: ResolvedRoomAlias?? = nil
DispatchQueue.main.sync {
returnValue = resolveRoomAliasUnderlyingReturnValue
}
@@ -3455,9 +3455,9 @@ class ClientProxyMock: ClientProxyProtocol {
}
}
}
var resolveRoomAliasClosure: ((String) async -> String?)?
var resolveRoomAliasClosure: ((String) async -> ResolvedRoomAlias?)?
func resolveRoomAlias(_ alias: String) async -> String? {
func resolveRoomAlias(_ alias: String) async -> ResolvedRoomAlias? {
resolveRoomAliasCallsCount += 1
resolveRoomAliasReceivedAlias = alias
resolveRoomAliasReceivedInvocations.append(alias)
@@ -1480,6 +1480,78 @@ class SDKClientMock: SDKClientProtocol {
return joinRoomByIdRoomIdReturnValue
}
}
//MARK: - joinRoomByIdOrAlias
public var joinRoomByIdOrAliasRoomIdOrAliasServerNamesThrowableError: Error?
var joinRoomByIdOrAliasRoomIdOrAliasServerNamesUnderlyingCallsCount = 0
public var joinRoomByIdOrAliasRoomIdOrAliasServerNamesCallsCount: Int {
get {
if Thread.isMainThread {
return joinRoomByIdOrAliasRoomIdOrAliasServerNamesUnderlyingCallsCount
} else {
var returnValue: Int? = nil
DispatchQueue.main.sync {
returnValue = joinRoomByIdOrAliasRoomIdOrAliasServerNamesUnderlyingCallsCount
}
return returnValue!
}
}
set {
if Thread.isMainThread {
joinRoomByIdOrAliasRoomIdOrAliasServerNamesUnderlyingCallsCount = newValue
} else {
DispatchQueue.main.sync {
joinRoomByIdOrAliasRoomIdOrAliasServerNamesUnderlyingCallsCount = newValue
}
}
}
}
public var joinRoomByIdOrAliasRoomIdOrAliasServerNamesCalled: Bool {
return joinRoomByIdOrAliasRoomIdOrAliasServerNamesCallsCount > 0
}
public var joinRoomByIdOrAliasRoomIdOrAliasServerNamesReceivedArguments: (roomIdOrAlias: String, serverNames: [String])?
public var joinRoomByIdOrAliasRoomIdOrAliasServerNamesReceivedInvocations: [(roomIdOrAlias: String, serverNames: [String])] = []
var joinRoomByIdOrAliasRoomIdOrAliasServerNamesUnderlyingReturnValue: Room!
public var joinRoomByIdOrAliasRoomIdOrAliasServerNamesReturnValue: Room! {
get {
if Thread.isMainThread {
return joinRoomByIdOrAliasRoomIdOrAliasServerNamesUnderlyingReturnValue
} else {
var returnValue: Room? = nil
DispatchQueue.main.sync {
returnValue = joinRoomByIdOrAliasRoomIdOrAliasServerNamesUnderlyingReturnValue
}
return returnValue!
}
}
set {
if Thread.isMainThread {
joinRoomByIdOrAliasRoomIdOrAliasServerNamesUnderlyingReturnValue = newValue
} else {
DispatchQueue.main.sync {
joinRoomByIdOrAliasRoomIdOrAliasServerNamesUnderlyingReturnValue = newValue
}
}
}
}
public var joinRoomByIdOrAliasRoomIdOrAliasServerNamesClosure: ((String, [String]) async throws -> Room)?
public func joinRoomByIdOrAlias(roomIdOrAlias: String, serverNames: [String]) async throws -> Room {
if let error = joinRoomByIdOrAliasRoomIdOrAliasServerNamesThrowableError {
throw error
}
joinRoomByIdOrAliasRoomIdOrAliasServerNamesCallsCount += 1
joinRoomByIdOrAliasRoomIdOrAliasServerNamesReceivedArguments = (roomIdOrAlias: roomIdOrAlias, serverNames: serverNames)
joinRoomByIdOrAliasRoomIdOrAliasServerNamesReceivedInvocations.append((roomIdOrAlias: roomIdOrAlias, serverNames: serverNames))
if let joinRoomByIdOrAliasRoomIdOrAliasServerNamesClosure = joinRoomByIdOrAliasRoomIdOrAliasServerNamesClosure {
return try await joinRoomByIdOrAliasRoomIdOrAliasServerNamesClosure(roomIdOrAlias, serverNames)
} else {
return joinRoomByIdOrAliasRoomIdOrAliasServerNamesReturnValue
}
}
//MARK: - login
public var loginUsernamePasswordInitialDeviceNameDeviceIdThrowableError: Error?
@@ -1735,13 +1807,13 @@ class SDKClientMock: SDKClientProtocol {
public var resolveRoomAliasRoomAliasReceivedRoomAlias: String?
public var resolveRoomAliasRoomAliasReceivedInvocations: [String] = []
var resolveRoomAliasRoomAliasUnderlyingReturnValue: String!
public var resolveRoomAliasRoomAliasReturnValue: String! {
var resolveRoomAliasRoomAliasUnderlyingReturnValue: ResolvedRoomAlias!
public var resolveRoomAliasRoomAliasReturnValue: ResolvedRoomAlias! {
get {
if Thread.isMainThread {
return resolveRoomAliasRoomAliasUnderlyingReturnValue
} else {
var returnValue: String? = nil
var returnValue: ResolvedRoomAlias? = nil
DispatchQueue.main.sync {
returnValue = resolveRoomAliasRoomAliasUnderlyingReturnValue
}
@@ -1759,9 +1831,9 @@ class SDKClientMock: SDKClientProtocol {
}
}
}
public var resolveRoomAliasRoomAliasClosure: ((String) async throws -> String)?
public var resolveRoomAliasRoomAliasClosure: ((String) async throws -> ResolvedRoomAlias)?
public func resolveRoomAlias(roomAlias: String) async throws -> String {
public func resolveRoomAlias(roomAlias: String) async throws -> ResolvedRoomAlias {
if let error = resolveRoomAliasRoomAliasThrowableError {
throw error
}