mirror of
https://github.com/Novaloop-AG/element-x-ios.git
synced 2026-11-03 06:55:59 +00:00
This commit is contained in:
@@ -31,7 +31,7 @@ enum RoomScreenComposerMode: Equatable {
|
||||
}
|
||||
|
||||
enum RoomScreenViewAction {
|
||||
case headerTapped
|
||||
case displayRoomDetails
|
||||
case displayEmojiPicker(itemId: String)
|
||||
case paginateBackwards
|
||||
case itemAppeared(id: String)
|
||||
|
||||
@@ -94,7 +94,7 @@ class RoomScreenViewModel: RoomScreenViewModelType, RoomScreenViewModelProtocol
|
||||
// swiftlint:disable:next cyclomatic_complexity
|
||||
override func process(viewAction: RoomScreenViewAction) async {
|
||||
switch viewAction {
|
||||
case .headerTapped:
|
||||
case .displayRoomDetails:
|
||||
callback?(.displayRoomDetails)
|
||||
case .paginateBackwards:
|
||||
await paginateBackwards()
|
||||
|
||||
@@ -24,16 +24,16 @@ struct RoomHeaderView: View {
|
||||
@ObservedObject var context: RoomScreenViewModel.Context
|
||||
|
||||
var body: some View {
|
||||
Button {
|
||||
context.send(viewAction: .headerTapped)
|
||||
} label: {
|
||||
HStack(spacing: 8) {
|
||||
roomAvatar
|
||||
.accessibilityHidden(true)
|
||||
Text(context.viewState.roomTitle)
|
||||
.font(.element.headline)
|
||||
.accessibilityIdentifier("roomNameLabel")
|
||||
}
|
||||
HStack(spacing: 8) {
|
||||
roomAvatar
|
||||
.accessibilityHidden(true)
|
||||
Text(context.viewState.roomTitle)
|
||||
.font(.element.headline)
|
||||
.accessibilityIdentifier("roomNameLabel")
|
||||
}
|
||||
// Using a button stops is from getting truncated in the navigation bar
|
||||
.onTapGesture {
|
||||
context.send(viewAction: .displayRoomDetails)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -75,10 +75,21 @@ struct RoomScreen: View {
|
||||
}
|
||||
}
|
||||
|
||||
@ToolbarContentBuilder
|
||||
var toolbar: some ToolbarContent {
|
||||
ToolbarItem(placement: .navigationBarLeading) {
|
||||
// .principal + .primaryAction works better than .navigation leading + trailing
|
||||
// as the latter disables interaction in the action button for rooms with long names
|
||||
ToolbarItem(placement: .principal) {
|
||||
RoomHeaderView(context: context)
|
||||
}
|
||||
|
||||
ToolbarItem(id: "RoomDetailsAction", placement: .secondaryAction, showsByDefault: false) {
|
||||
Button {
|
||||
context.send(viewAction: .displayRoomDetails)
|
||||
} label: {
|
||||
Label("Room Details", systemImage: "info.circle")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private func sendMessage() {
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
Prevent long room names from breaking the room navigation bar layout
|
||||
Reference in New Issue
Block a user