New Room button has been moved to the top (#1604)

* completed

* removed old toolbar visibility stuff
This commit is contained in:
Mauro
2023-08-31 17:03:27 +02:00
committed by GitHub
parent 8886f0f9d3
commit 432975f413
2 changed files with 3 additions and 15 deletions
@@ -23,17 +23,8 @@ struct HomeScreen: View {
@ObservedObject var context: HomeScreenViewModel.Context
@State private var scrollViewAdapter = ScrollViewAdapter()
@State private var lastScrollDirection: ScrollViewAdapter.ScrollDirection = .up
@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 {
GeometryReader { geometry in
ScrollView {
@@ -78,9 +69,6 @@ struct HomeScreen: View {
.onChange(of: context.searchQuery) { _ in
updateVisibleRange()
}
.onReceive(scrollViewAdapter.scrollDirection) { direction in
withAnimation(.elementDefault) { lastScrollDirection = direction }
}
.onChange(of: context.viewState.visibleRooms) { _ in
updateVisibleRange()
}
@@ -96,7 +84,6 @@ struct HomeScreen: View {
actions: leaveRoomAlertActions,
message: leaveRoomAlertMessage)
.navigationTitle(L10n.screenRoomlistMainSpaceTitle)
.toolbar(bottomBarVisibility, for: .bottomBar)
.toolbar { toolbar }
.background(Color.compound.bgCanvasDefault.ignoresSafeArea())
.track(screen: .home)
@@ -163,8 +150,7 @@ struct HomeScreen: View {
HomeScreenUserMenuButton(context: context)
}
ToolbarItemGroup(placement: .bottomBar) {
Spacer()
ToolbarItemGroup(placement: .primaryAction) {
newRoomButton
}
}
@@ -174,6 +160,7 @@ struct HomeScreen: View {
context.send(viewAction: .startChat)
} label: {
Image(systemName: "square.and.pencil")
.fontWeight(.semibold)
}
.accessibilityIdentifier(A11yIdentifiers.homeScreen.startChat)
}
+1
View File
@@ -0,0 +1 @@
New room button has been moved to the top.