From 76c22be17ccfecb70797d9c41718d08e7d4fc3b2 Mon Sep 17 00:00:00 2001 From: spaced4ndy <8711996+spaced4ndy@users.noreply.github.com> Date: Mon, 6 May 2024 12:32:41 +0400 Subject: [PATCH] remove search buttons, rework filter button --- .../ios/Shared/Views/ChatList/ChatsView.swift | 48 +++++-------------- apps/ios/Shared/Views/Home/HomeView.swift | 1 + 2 files changed, 12 insertions(+), 37 deletions(-) diff --git a/apps/ios/Shared/Views/ChatList/ChatsView.swift b/apps/ios/Shared/Views/ChatList/ChatsView.swift index 3a6b4fa4a0..e15fec587c 100644 --- a/apps/ios/Shared/Views/ChatList/ChatsView.swift +++ b/apps/ios/Shared/Views/ChatList/ChatsView.swift @@ -202,7 +202,6 @@ struct ChatsSearchBar: View { @Binding var searchShowingSimplexLink: Bool @Binding var searchChatFilteredBySimplexLink: String? @State private var ignoreSearchTextChange = false - @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 @@ -222,26 +221,6 @@ struct ChatsSearchBar: View { .onTapGesture { searchText = "" } - } else if !searchFocussed { - HStack(spacing: 24) { - if m.pasteboardHasStrings { - Image(systemName: "doc") - .onTapGesture { - if let str = UIPasteboard.general.string { - searchText = str - } - } - } - - Image(systemName: "qrcode") - .resizable() - .scaledToFit() - .frame(width: 20, height: 20) - .onTapGesture { - showScanCodeSheet = true - } - } - .padding(.trailing, 2) } } .padding(EdgeInsets(top: 7, leading: 7, bottom: 7, trailing: 7)) @@ -261,10 +240,6 @@ struct ChatsSearchBar: View { } } } - .sheet(isPresented: $showScanCodeSheet) { - NewChatView(selection: .connect, showQRCodeScanner: true) - .environment(\EnvironmentValues.refresh as! WritableKeyPath, nil) // fixes .refreshable in ChatsView affecting nested view - } .onChange(of: searchFocussed) { sf in withAnimation { searchMode = sf } } @@ -299,18 +274,17 @@ struct ChatsSearchBar: View { } private func toggleFilterButton() -> some View { - Button { - showUnreadAndFavorites = !showUnreadAndFavorites - } label: { - ZStack { - Color.clear - .frame(width: 30, height: 30) - Image(systemName: "line.3.horizontal.decrease.circle" + (showUnreadAndFavorites ? ".fill" : "")) - .resizable() - .scaledToFit() - .frame(width: 18, height: 18) - .foregroundColor(.accentColor) - } + ZStack { + Color.clear + .frame(width: 20, height: 20) + Image(systemName: showUnreadAndFavorites ? "line.3.horizontal.decrease.circle.fill" : "line.3.horizontal.decrease") + .resizable() + .scaledToFit() + .foregroundColor(showUnreadAndFavorites ? .accentColor : .secondary) + .frame(width: showUnreadAndFavorites ? 20 : 16, height: showUnreadAndFavorites ? 20 : 16) + .onTapGesture { + showUnreadAndFavorites = !showUnreadAndFavorites + } } } diff --git a/apps/ios/Shared/Views/Home/HomeView.swift b/apps/ios/Shared/Views/Home/HomeView.swift index 67b6c2f253..4c263ee4dd 100644 --- a/apps/ios/Shared/Views/Home/HomeView.swift +++ b/apps/ios/Shared/Views/Home/HomeView.swift @@ -203,6 +203,7 @@ struct HomeView: View { case .newGroup: AddGroupView() } } +// NewChatView(selection: .connect, showQRCodeScanner: true) } private func iconLabel(_ image: String, _ title: LocalizedStringKey) -> some View {