mirror of
https://github.com/Novaloop-AG/element-x-ios.git
synced 2026-11-06 20:38:41 +00:00
This commit is contained in:
@@ -31,7 +31,7 @@ enum RoomScreenComposerMode: Equatable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
enum RoomScreenViewAction {
|
enum RoomScreenViewAction {
|
||||||
case headerTapped
|
case displayRoomDetails
|
||||||
case displayEmojiPicker(itemId: String)
|
case displayEmojiPicker(itemId: String)
|
||||||
case paginateBackwards
|
case paginateBackwards
|
||||||
case itemAppeared(id: String)
|
case itemAppeared(id: String)
|
||||||
|
|||||||
@@ -94,7 +94,7 @@ class RoomScreenViewModel: RoomScreenViewModelType, RoomScreenViewModelProtocol
|
|||||||
// swiftlint:disable:next cyclomatic_complexity
|
// swiftlint:disable:next cyclomatic_complexity
|
||||||
override func process(viewAction: RoomScreenViewAction) async {
|
override func process(viewAction: RoomScreenViewAction) async {
|
||||||
switch viewAction {
|
switch viewAction {
|
||||||
case .headerTapped:
|
case .displayRoomDetails:
|
||||||
callback?(.displayRoomDetails)
|
callback?(.displayRoomDetails)
|
||||||
case .paginateBackwards:
|
case .paginateBackwards:
|
||||||
await paginateBackwards()
|
await paginateBackwards()
|
||||||
|
|||||||
@@ -24,16 +24,16 @@ struct RoomHeaderView: View {
|
|||||||
@ObservedObject var context: RoomScreenViewModel.Context
|
@ObservedObject var context: RoomScreenViewModel.Context
|
||||||
|
|
||||||
var body: some View {
|
var body: some View {
|
||||||
Button {
|
HStack(spacing: 8) {
|
||||||
context.send(viewAction: .headerTapped)
|
roomAvatar
|
||||||
} label: {
|
.accessibilityHidden(true)
|
||||||
HStack(spacing: 8) {
|
Text(context.viewState.roomTitle)
|
||||||
roomAvatar
|
.font(.element.headline)
|
||||||
.accessibilityHidden(true)
|
.accessibilityIdentifier("roomNameLabel")
|
||||||
Text(context.viewState.roomTitle)
|
}
|
||||||
.font(.element.headline)
|
// Using a button stops is from getting truncated in the navigation bar
|
||||||
.accessibilityIdentifier("roomNameLabel")
|
.onTapGesture {
|
||||||
}
|
context.send(viewAction: .displayRoomDetails)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -75,10 +75,21 @@ struct RoomScreen: View {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ToolbarContentBuilder
|
||||||
var toolbar: some ToolbarContent {
|
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)
|
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() {
|
private func sendMessage() {
|
||||||
|
|||||||
@@ -0,0 +1 @@
|
|||||||
|
Prevent long room names from breaking the room navigation bar layout
|
||||||
Reference in New Issue
Block a user