feat: report a room

updated tests

updated tests

added a feature flag to report room

removed delay

rename
This commit is contained in:
Mauro Romito
2025-04-02 17:44:24 +02:00
committed by Mauro
parent 8149107aef
commit 2ee5c1b403
31 changed files with 750 additions and 104 deletions
@@ -6689,6 +6689,76 @@ class JoinedRoomProxyMock: JoinedRoomProxyProtocol, @unchecked Sendable {
return reportContentReasonReturnValue
}
}
//MARK: - reportRoom
var reportRoomReasonUnderlyingCallsCount = 0
var reportRoomReasonCallsCount: Int {
get {
if Thread.isMainThread {
return reportRoomReasonUnderlyingCallsCount
} else {
var returnValue: Int? = nil
DispatchQueue.main.sync {
returnValue = reportRoomReasonUnderlyingCallsCount
}
return returnValue!
}
}
set {
if Thread.isMainThread {
reportRoomReasonUnderlyingCallsCount = newValue
} else {
DispatchQueue.main.sync {
reportRoomReasonUnderlyingCallsCount = newValue
}
}
}
}
var reportRoomReasonCalled: Bool {
return reportRoomReasonCallsCount > 0
}
var reportRoomReasonReceivedReason: String?
var reportRoomReasonReceivedInvocations: [String?] = []
var reportRoomReasonUnderlyingReturnValue: Result<Void, RoomProxyError>!
var reportRoomReasonReturnValue: Result<Void, RoomProxyError>! {
get {
if Thread.isMainThread {
return reportRoomReasonUnderlyingReturnValue
} else {
var returnValue: Result<Void, RoomProxyError>? = nil
DispatchQueue.main.sync {
returnValue = reportRoomReasonUnderlyingReturnValue
}
return returnValue!
}
}
set {
if Thread.isMainThread {
reportRoomReasonUnderlyingReturnValue = newValue
} else {
DispatchQueue.main.sync {
reportRoomReasonUnderlyingReturnValue = newValue
}
}
}
}
var reportRoomReasonClosure: ((String?) async -> Result<Void, RoomProxyError>)?
func reportRoom(reason: String?) async -> Result<Void, RoomProxyError> {
reportRoomReasonCallsCount += 1
reportRoomReasonReceivedReason = reason
DispatchQueue.main.async {
self.reportRoomReasonReceivedInvocations.append(reason)
}
if let reportRoomReasonClosure = reportRoomReasonClosure {
return await reportRoomReasonClosure(reason)
} else {
return reportRoomReasonReturnValue
}
}
//MARK: - leaveRoom
var leaveRoomUnderlyingCallsCount = 0