mirror of
https://github.com/Novaloop-AG/element-x-ios.git
synced 2026-11-02 21:33:26 +00:00
Handle external links to a user. (#2690)
This commit is contained in:
@@ -2077,6 +2077,74 @@ class ClientProxyMock: ClientProxyProtocol {
|
||||
return accountURLActionReturnValue
|
||||
}
|
||||
}
|
||||
//MARK: - createDirectRoomIfNeeded
|
||||
|
||||
var createDirectRoomIfNeededWithExpectedRoomNameUnderlyingCallsCount = 0
|
||||
var createDirectRoomIfNeededWithExpectedRoomNameCallsCount: Int {
|
||||
get {
|
||||
if Thread.isMainThread {
|
||||
return createDirectRoomIfNeededWithExpectedRoomNameUnderlyingCallsCount
|
||||
} else {
|
||||
var returnValue: Int? = nil
|
||||
DispatchQueue.main.sync {
|
||||
returnValue = createDirectRoomIfNeededWithExpectedRoomNameUnderlyingCallsCount
|
||||
}
|
||||
|
||||
return returnValue!
|
||||
}
|
||||
}
|
||||
set {
|
||||
if Thread.isMainThread {
|
||||
createDirectRoomIfNeededWithExpectedRoomNameUnderlyingCallsCount = newValue
|
||||
} else {
|
||||
DispatchQueue.main.sync {
|
||||
createDirectRoomIfNeededWithExpectedRoomNameUnderlyingCallsCount = newValue
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
var createDirectRoomIfNeededWithExpectedRoomNameCalled: Bool {
|
||||
return createDirectRoomIfNeededWithExpectedRoomNameCallsCount > 0
|
||||
}
|
||||
var createDirectRoomIfNeededWithExpectedRoomNameReceivedArguments: (userID: String, expectedRoomName: String?)?
|
||||
var createDirectRoomIfNeededWithExpectedRoomNameReceivedInvocations: [(userID: String, expectedRoomName: String?)] = []
|
||||
|
||||
var createDirectRoomIfNeededWithExpectedRoomNameUnderlyingReturnValue: Result<(roomID: String, isNewRoom: Bool), ClientProxyError>!
|
||||
var createDirectRoomIfNeededWithExpectedRoomNameReturnValue: Result<(roomID: String, isNewRoom: Bool), ClientProxyError>! {
|
||||
get {
|
||||
if Thread.isMainThread {
|
||||
return createDirectRoomIfNeededWithExpectedRoomNameUnderlyingReturnValue
|
||||
} else {
|
||||
var returnValue: Result<(roomID: String, isNewRoom: Bool), ClientProxyError>? = nil
|
||||
DispatchQueue.main.sync {
|
||||
returnValue = createDirectRoomIfNeededWithExpectedRoomNameUnderlyingReturnValue
|
||||
}
|
||||
|
||||
return returnValue!
|
||||
}
|
||||
}
|
||||
set {
|
||||
if Thread.isMainThread {
|
||||
createDirectRoomIfNeededWithExpectedRoomNameUnderlyingReturnValue = newValue
|
||||
} else {
|
||||
DispatchQueue.main.sync {
|
||||
createDirectRoomIfNeededWithExpectedRoomNameUnderlyingReturnValue = newValue
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
var createDirectRoomIfNeededWithExpectedRoomNameClosure: ((String, String?) async -> Result<(roomID: String, isNewRoom: Bool), ClientProxyError>)?
|
||||
|
||||
func createDirectRoomIfNeeded(with userID: String, expectedRoomName: String?) async -> Result<(roomID: String, isNewRoom: Bool), ClientProxyError> {
|
||||
createDirectRoomIfNeededWithExpectedRoomNameCallsCount += 1
|
||||
createDirectRoomIfNeededWithExpectedRoomNameReceivedArguments = (userID: userID, expectedRoomName: expectedRoomName)
|
||||
createDirectRoomIfNeededWithExpectedRoomNameReceivedInvocations.append((userID: userID, expectedRoomName: expectedRoomName))
|
||||
if let createDirectRoomIfNeededWithExpectedRoomNameClosure = createDirectRoomIfNeededWithExpectedRoomNameClosure {
|
||||
return await createDirectRoomIfNeededWithExpectedRoomNameClosure(userID, expectedRoomName)
|
||||
} else {
|
||||
return createDirectRoomIfNeededWithExpectedRoomNameReturnValue
|
||||
}
|
||||
}
|
||||
//MARK: - directRoomForUserID
|
||||
|
||||
var directRoomForUserIDUnderlyingCallsCount = 0
|
||||
|
||||
Reference in New Issue
Block a user