mirror of
https://github.com/Novaloop-AG/element-x-ios.git
synced 2026-11-03 06:55:59 +00:00
Allow joined rooms to be pushed within a space. (#4460)
* Allow joined rooms to be pushed within a space. * Push a room in the space flow tests. Also fixes some snapshots stale snapshots. * Show the selected space/room within a space and set a custom title view.
This commit is contained in:
@@ -19,16 +19,17 @@ struct SpaceScreen: View {
|
||||
rooms
|
||||
}
|
||||
}
|
||||
.navigationTitle(context.viewState.space.name ?? L10n.commonSpace)
|
||||
.navigationBarTitleDisplayMode(.inline)
|
||||
.background(Color.compound.bgCanvasDefault.ignoresSafeArea())
|
||||
.navigationTitle(context.viewState.spaceName)
|
||||
.navigationBarTitleDisplayMode(.inline)
|
||||
.toolbar { toolbar }
|
||||
}
|
||||
|
||||
@ViewBuilder
|
||||
var rooms: some View {
|
||||
ForEach(context.viewState.rooms, id: \.id) { spaceRoomProxy in
|
||||
SpaceRoomCell(spaceRoomProxy: spaceRoomProxy,
|
||||
isSelected: false,
|
||||
isSelected: spaceRoomProxy.id == context.viewState.selectedSpaceRoomID,
|
||||
mediaProvider: context.mediaProvider) { action in
|
||||
context.send(viewAction: .spaceAction(action))
|
||||
}
|
||||
@@ -39,6 +40,16 @@ struct SpaceScreen: View {
|
||||
.padding()
|
||||
}
|
||||
}
|
||||
|
||||
var toolbar: some ToolbarContent {
|
||||
// Use the same trick as the RoomScreen for a leading title view that
|
||||
// also hides the navigation title.
|
||||
ToolbarItem(placement: .principal) {
|
||||
RoomHeaderView(roomName: context.viewState.spaceName,
|
||||
roomAvatar: context.viewState.space.avatar,
|
||||
mediaProvider: context.mediaProvider)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// MARK: - Previews
|
||||
@@ -66,6 +77,7 @@ struct SpaceScreen_Previews: PreviewProvider, TestablePreview {
|
||||
|
||||
let viewModel = SpaceScreenViewModel(spaceRoomListProxy: spaceRoomListProxy,
|
||||
spaceServiceProxy: SpaceServiceProxyMock(.init()),
|
||||
selectedSpaceRoomPublisher: .init(nil),
|
||||
mediaProvider: MediaProviderMock(configuration: .init()),
|
||||
userIndicatorController: UserIndicatorControllerMock())
|
||||
return viewModel
|
||||
|
||||
Reference in New Issue
Block a user