Adopt the lastest SDK APIs and refactor how we deal with user permissions.

This patch introduces a new RoomPowerLevelsProxy and its associated mock and adopts newer Rust APIs to make working with user power levels and permissions easier.
This commit is contained in:
Stefan Ceriu
2025-06-20 14:20:01 +03:00
committed by Stefan Ceriu
parent 96e5ed06f5
commit f522e15dac
25 changed files with 1863 additions and 1660 deletions
@@ -167,8 +167,12 @@ class RoomScreenViewModelTests: XCTestCase {
var configuration = JoinedRoomProxyMockConfiguration(id: "TestID", name: "StartingName", avatarURL: nil, hasOngoingCall: false)
let infoSubject = CurrentValueSubject<RoomInfoProxy, Never>(.init(roomInfo: RoomInfo(configuration)))
let roomProxyMock = JoinedRoomProxyMock(configuration)
let powerLevelsMock = RoomPowerLevelsProxyMock(configuration: .init())
roomProxyMock.powerLevelsReturnValue = .success(powerLevelsMock)
// setup the room proxy actions publisher
roomProxyMock.canUserJoinCallUserIDReturnValue = .success(false)
powerLevelsMock.canUserJoinCallUserIDReturnValue = .success(false)
roomProxyMock.underlyingInfoPublisher = infoSubject.asCurrentValuePublisher()
let viewModel = RoomScreenViewModel(clientProxy: ClientProxyMock(),
roomProxy: roomProxyMock,
@@ -193,7 +197,7 @@ class RoomScreenViewModelTests: XCTestCase {
configuration.name = "NewName"
configuration.avatarURL = .mockMXCAvatar
configuration.hasOngoingCall = true
roomProxyMock.canUserJoinCallUserIDReturnValue = .success(true)
powerLevelsMock.canUserJoinCallUserIDReturnValue = .success(true)
deferred = deferFulfillment(viewModel.context.$viewState) { viewState in
viewState.roomTitle == "NewName" &&