mirror of
https://github.com/Novaloop-AG/element-x-ios.git
synced 2026-11-04 01:20:12 +00:00
Adopt room info power levels (#4245)
* Use the newly RoomInfo published PowerLevels; update permissions at the same time as the room info and avoid unnecessary async calls. * Introduce a RoomInfoProxyProtocol and associated mock and move away from mocked SDK RoomInfos * Bump the SDK to v25.06.23 * Expose new non-throwing methods for checking one's own user permissions * Fix the unit and preview tests (except the TimelineMediaPreviewDetails for which simplified snapshots were generated) * Converge on one single implementation for computing a room's avatar. * Fix more unit tests * Fix the TimelineMediaPreviewDetailsView snapshot tests This reverts commit 9b6c819e611ad2fa3de2c34a4a7aa556fc9faadd. --------- Co-authored-by: Doug <douglase@element.io>
This commit is contained in:
@@ -26,7 +26,7 @@ class RoomScreenViewModelTests: XCTestCase {
|
||||
func testPinnedEventsBanner() async throws {
|
||||
var configuration = JoinedRoomProxyMockConfiguration()
|
||||
let timelineSubject = PassthroughSubject<TimelineProxyProtocol, Never>()
|
||||
let infoSubject = CurrentValueSubject<RoomInfoProxy, Never>(.init(roomInfo: RoomInfo(configuration)))
|
||||
let infoSubject = CurrentValueSubject<RoomInfoProxyProtocol, Never>(RoomInfoProxyMock(configuration))
|
||||
let roomProxyMock = JoinedRoomProxyMock(configuration)
|
||||
// setup a way to inject the mock of the pinned events timeline
|
||||
roomProxyMock.pinnedEventsTimelineClosure = {
|
||||
@@ -63,7 +63,7 @@ class RoomScreenViewModelTests: XCTestCase {
|
||||
viewState.pinnedEventsBannerState.count == 2
|
||||
}
|
||||
configuration.pinnedEventIDs = ["test1", "test2"]
|
||||
infoSubject.send(.init(roomInfo: RoomInfo(configuration)))
|
||||
infoSubject.send(RoomInfoProxyMock(configuration))
|
||||
try await deferred.fulfill()
|
||||
XCTAssertTrue(viewModel.context.viewState.pinnedEventsBannerState.isLoading)
|
||||
XCTAssertTrue(viewModel.context.viewState.shouldShowPinnedEventsBanner)
|
||||
@@ -165,7 +165,7 @@ class RoomScreenViewModelTests: XCTestCase {
|
||||
|
||||
func testRoomInfoUpdate() async throws {
|
||||
var configuration = JoinedRoomProxyMockConfiguration(id: "TestID", name: "StartingName", avatarURL: nil, hasOngoingCall: false)
|
||||
let infoSubject = CurrentValueSubject<RoomInfoProxy, Never>(.init(roomInfo: RoomInfo(configuration)))
|
||||
let infoSubject = CurrentValueSubject<RoomInfoProxyProtocol, Never>(RoomInfoProxyMock(configuration))
|
||||
let roomProxyMock = JoinedRoomProxyMock(configuration)
|
||||
|
||||
let powerLevelsMock = RoomPowerLevelsProxyMock(configuration: .init())
|
||||
@@ -206,7 +206,7 @@ class RoomScreenViewModelTests: XCTestCase {
|
||||
viewState.hasOngoingCall
|
||||
}
|
||||
|
||||
infoSubject.send(.init(roomInfo: RoomInfo(configuration)))
|
||||
infoSubject.send(RoomInfoProxyMock(configuration))
|
||||
try await deferred.fulfill()
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user