From 610555c1bca4b567865354f477899250beb353ea Mon Sep 17 00:00:00 2001 From: spaced4ndy <8711996+spaced4ndy@users.noreply.github.com> Date: Thu, 2 May 2024 13:02:32 +0400 Subject: [PATCH] filter button right of search --- .../ios/Shared/Views/ChatList/ChatsView.swift | 36 +++++++------------ 1 file changed, 13 insertions(+), 23 deletions(-) diff --git a/apps/ios/Shared/Views/ChatList/ChatsView.swift b/apps/ios/Shared/Views/ChatList/ChatsView.swift index 79abe4ec3e..0049a09df0 100644 --- a/apps/ios/Shared/Views/ChatList/ChatsView.swift +++ b/apps/ios/Shared/Views/ChatList/ChatsView.swift @@ -65,29 +65,6 @@ struct ChatsView: View { )) } .listStyle(.plain) - .navigationBarTitleDisplayMode(.inline) - .navigationBarHidden(searchMode) - .toolbar { - ToolbarItem(placement: .principal) { - HStack(spacing: 4) { - Text("Chats") - .font(.headline) - if chatModel.chats.count > 0 { - toggleFilterButton() - } - } - .frame(maxWidth: .infinity, alignment: .center) - } - } - } - - private func toggleFilterButton() -> some View { - Button { - showUnreadAndFavorites = !showUnreadAndFavorites - } label: { - Image(systemName: "line.3.horizontal.decrease.circle" + (showUnreadAndFavorites ? ".fill" : "")) - .foregroundColor(.accentColor) - } } @ViewBuilder private var chatList: some View { @@ -236,6 +213,7 @@ struct ChatsSearchBar: View { @State private var showScanCodeSheet = false @State private var alert: PlanAndConnectAlert? @State private var sheet: PlanAndConnectActionSheet? + @AppStorage(DEFAULT_SHOW_UNREAD_AND_FAVORITES) private var showUnreadAndFavorites = false var body: some View { VStack(spacing: 12) { @@ -286,6 +264,8 @@ struct ChatsSearchBar: View { searchText = "" searchFocussed = false } + } else if m.chats.count > 0 { + toggleFilterButton() } } Divider() @@ -327,6 +307,16 @@ struct ChatsSearchBar: View { } } + private func toggleFilterButton() -> some View { + Image(systemName: "line.3.horizontal.decrease.circle" + (showUnreadAndFavorites ? ".fill" : "")) + .resizable() + .foregroundColor(.accentColor) + .frame(width: 20, height: 20) + .onTapGesture { + showUnreadAndFavorites = !showUnreadAndFavorites + } + } + private func connect(_ link: String) { planAndConnect( link,