mirror of
https://github.com/Novaloop-AG/element-x-ios.git
synced 2026-11-04 19:44:05 +00:00
New Room button has been moved to the top (#1604)
* completed * removed old toolbar visibility stuff
This commit is contained in:
@@ -23,17 +23,8 @@ struct HomeScreen: View {
|
|||||||
@ObservedObject var context: HomeScreenViewModel.Context
|
@ObservedObject var context: HomeScreenViewModel.Context
|
||||||
|
|
||||||
@State private var scrollViewAdapter = ScrollViewAdapter()
|
@State private var scrollViewAdapter = ScrollViewAdapter()
|
||||||
@State private var lastScrollDirection: ScrollViewAdapter.ScrollDirection = .up
|
|
||||||
@State private var isSearching = false
|
@State private var isSearching = false
|
||||||
|
|
||||||
var bottomBarVisibility: Visibility {
|
|
||||||
switch context.viewState.roomListMode {
|
|
||||||
case .skeletons: return .hidden
|
|
||||||
case .empty: return .visible
|
|
||||||
case .rooms: return lastScrollDirection == .up ? .automatic : .hidden
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
var body: some View {
|
var body: some View {
|
||||||
GeometryReader { geometry in
|
GeometryReader { geometry in
|
||||||
ScrollView {
|
ScrollView {
|
||||||
@@ -78,9 +69,6 @@ struct HomeScreen: View {
|
|||||||
.onChange(of: context.searchQuery) { _ in
|
.onChange(of: context.searchQuery) { _ in
|
||||||
updateVisibleRange()
|
updateVisibleRange()
|
||||||
}
|
}
|
||||||
.onReceive(scrollViewAdapter.scrollDirection) { direction in
|
|
||||||
withAnimation(.elementDefault) { lastScrollDirection = direction }
|
|
||||||
}
|
|
||||||
.onChange(of: context.viewState.visibleRooms) { _ in
|
.onChange(of: context.viewState.visibleRooms) { _ in
|
||||||
updateVisibleRange()
|
updateVisibleRange()
|
||||||
}
|
}
|
||||||
@@ -96,7 +84,6 @@ struct HomeScreen: View {
|
|||||||
actions: leaveRoomAlertActions,
|
actions: leaveRoomAlertActions,
|
||||||
message: leaveRoomAlertMessage)
|
message: leaveRoomAlertMessage)
|
||||||
.navigationTitle(L10n.screenRoomlistMainSpaceTitle)
|
.navigationTitle(L10n.screenRoomlistMainSpaceTitle)
|
||||||
.toolbar(bottomBarVisibility, for: .bottomBar)
|
|
||||||
.toolbar { toolbar }
|
.toolbar { toolbar }
|
||||||
.background(Color.compound.bgCanvasDefault.ignoresSafeArea())
|
.background(Color.compound.bgCanvasDefault.ignoresSafeArea())
|
||||||
.track(screen: .home)
|
.track(screen: .home)
|
||||||
@@ -163,8 +150,7 @@ struct HomeScreen: View {
|
|||||||
HomeScreenUserMenuButton(context: context)
|
HomeScreenUserMenuButton(context: context)
|
||||||
}
|
}
|
||||||
|
|
||||||
ToolbarItemGroup(placement: .bottomBar) {
|
ToolbarItemGroup(placement: .primaryAction) {
|
||||||
Spacer()
|
|
||||||
newRoomButton
|
newRoomButton
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -174,6 +160,7 @@ struct HomeScreen: View {
|
|||||||
context.send(viewAction: .startChat)
|
context.send(viewAction: .startChat)
|
||||||
} label: {
|
} label: {
|
||||||
Image(systemName: "square.and.pencil")
|
Image(systemName: "square.and.pencil")
|
||||||
|
.fontWeight(.semibold)
|
||||||
}
|
}
|
||||||
.accessibilityIdentifier(A11yIdentifiers.homeScreen.startChat)
|
.accessibilityIdentifier(A11yIdentifiers.homeScreen.startChat)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1 @@
|
|||||||
|
New room button has been moved to the top.
|
||||||
Reference in New Issue
Block a user