Knocking feature polishing part 2 (#3738)

* improved implementation of the unknown state

* forget button in the banned state

* error handling for forbidden access

* added the forget function

fixed DMs, and updated preview tests

* removed banned room proxy

* code polishing and test improvement
This commit is contained in:
Mauro
2025-02-05 14:48:24 +01:00
committed by GitHub
parent cfaa1b455a
commit 3839025caa
28 changed files with 466 additions and 101 deletions
@@ -13393,6 +13393,70 @@ class RoomPreviewProxyMock: RoomPreviewProxyProtocol, @unchecked Sendable {
var underlyingOwnMembershipDetails: RoomMembershipDetailsProxyProtocol?
var ownMembershipDetailsClosure: (() async -> RoomMembershipDetailsProxyProtocol?)?
//MARK: - forgetRoom
var forgetRoomUnderlyingCallsCount = 0
var forgetRoomCallsCount: Int {
get {
if Thread.isMainThread {
return forgetRoomUnderlyingCallsCount
} else {
var returnValue: Int? = nil
DispatchQueue.main.sync {
returnValue = forgetRoomUnderlyingCallsCount
}
return returnValue!
}
}
set {
if Thread.isMainThread {
forgetRoomUnderlyingCallsCount = newValue
} else {
DispatchQueue.main.sync {
forgetRoomUnderlyingCallsCount = newValue
}
}
}
}
var forgetRoomCalled: Bool {
return forgetRoomCallsCount > 0
}
var forgetRoomUnderlyingReturnValue: Result<Void, RoomProxyError>!
var forgetRoomReturnValue: Result<Void, RoomProxyError>! {
get {
if Thread.isMainThread {
return forgetRoomUnderlyingReturnValue
} else {
var returnValue: Result<Void, RoomProxyError>? = nil
DispatchQueue.main.sync {
returnValue = forgetRoomUnderlyingReturnValue
}
return returnValue!
}
}
set {
if Thread.isMainThread {
forgetRoomUnderlyingReturnValue = newValue
} else {
DispatchQueue.main.sync {
forgetRoomUnderlyingReturnValue = newValue
}
}
}
}
var forgetRoomClosure: (() async -> Result<Void, RoomProxyError>)?
func forgetRoom() async -> Result<Void, RoomProxyError> {
forgetRoomCallsCount += 1
if let forgetRoomClosure = forgetRoomClosure {
return await forgetRoomClosure()
} else {
return forgetRoomReturnValue
}
}
}
class RoomProxyMock: RoomProxyProtocol, @unchecked Sendable {
var id: String {