using roomPreview API for invited rooms (#3530)

* using roomPreview for invited rooms

* Update ElementX/Sources/Services/Room/RoomInfoProxy.swift

Co-authored-by: Doug <6060466+pixlwave@users.noreply.github.com>

* improved code

* fix, but requires a SDK PR

* update sdk

* package resolved

* fixed the tests

---------

Co-authored-by: Doug <6060466+pixlwave@users.noreply.github.com>
This commit is contained in:
Mauro
2024-11-19 20:23:06 +01:00
committed by GitHub
parent b75ad6a5aa
commit bce3b3a385
12 changed files with 52 additions and 112 deletions
@@ -5831,11 +5831,12 @@ class ElementCallWidgetDriverMock: ElementCallWidgetDriverProtocol {
}
}
class InvitedRoomProxyMock: InvitedRoomProxyProtocol {
var info: RoomInfoProxy {
var info: BaseRoomInfoProxyProtocol {
get { return underlyingInfo }
set(value) { underlyingInfo = value }
}
var underlyingInfo: RoomInfoProxy!
var underlyingInfo: BaseRoomInfoProxyProtocol!
var inviter: RoomMemberProxyProtocol?
var id: String {
get { return underlyingId }
set(value) { underlyingId = value }
@@ -5911,70 +5912,6 @@ class InvitedRoomProxyMock: InvitedRoomProxyProtocol {
return rejectInvitationReturnValue
}
}
//MARK: - acceptInvitation
var acceptInvitationUnderlyingCallsCount = 0
var acceptInvitationCallsCount: Int {
get {
if Thread.isMainThread {
return acceptInvitationUnderlyingCallsCount
} else {
var returnValue: Int? = nil
DispatchQueue.main.sync {
returnValue = acceptInvitationUnderlyingCallsCount
}
return returnValue!
}
}
set {
if Thread.isMainThread {
acceptInvitationUnderlyingCallsCount = newValue
} else {
DispatchQueue.main.sync {
acceptInvitationUnderlyingCallsCount = newValue
}
}
}
}
var acceptInvitationCalled: Bool {
return acceptInvitationCallsCount > 0
}
var acceptInvitationUnderlyingReturnValue: Result<Void, RoomProxyError>!
var acceptInvitationReturnValue: Result<Void, RoomProxyError>! {
get {
if Thread.isMainThread {
return acceptInvitationUnderlyingReturnValue
} else {
var returnValue: Result<Void, RoomProxyError>? = nil
DispatchQueue.main.sync {
returnValue = acceptInvitationUnderlyingReturnValue
}
return returnValue!
}
}
set {
if Thread.isMainThread {
acceptInvitationUnderlyingReturnValue = newValue
} else {
DispatchQueue.main.sync {
acceptInvitationUnderlyingReturnValue = newValue
}
}
}
}
var acceptInvitationClosure: (() async -> Result<Void, RoomProxyError>)?
func acceptInvitation() async -> Result<Void, RoomProxyError> {
acceptInvitationCallsCount += 1
if let acceptInvitationClosure = acceptInvitationClosure {
return await acceptInvitationClosure()
} else {
return acceptInvitationReturnValue
}
}
}
class JoinedRoomProxyMock: JoinedRoomProxyProtocol {
var isEncrypted: Bool {