From eb47e0e38574457ad1ea54e0583ebfe8c84a2b95 Mon Sep 17 00:00:00 2001 From: Evgeny Poberezkin <2769109+epoberezkin@users.noreply.github.com> Date: Mon, 4 Dec 2023 17:52:43 +0000 Subject: [PATCH] simplify --- .../Shared/Views/ChatList/ChatListView.swift | 23 ++++--------------- 1 file changed, 5 insertions(+), 18 deletions(-) diff --git a/apps/ios/Shared/Views/ChatList/ChatListView.swift b/apps/ios/Shared/Views/ChatList/ChatListView.swift index 1cabf038e3..85650f53a6 100644 --- a/apps/ios/Shared/Views/ChatList/ChatListView.swift +++ b/apps/ios/Shared/Views/ChatList/ChatListView.swift @@ -290,17 +290,11 @@ struct ChatListSearchBar: View { HStack(spacing: 12) { HStack(spacing: 4) { Image(systemName: "magnifyingglass") - let v = TextField("Search or paste SimpleX link", text: $searchText) + TextField("Search or paste SimpleX link", text: $searchText) .disabled(searchShowingSimplexLink) .focused($searchFocussed) - .foregroundColor(searchShowingSimplexLink ? Color(uiColor: uiLinkColor) : .primary) .frame(maxWidth: .infinity) - if #available(iOS 16, *) { - v.underline(searchShowingSimplexLink) - } else { - v - } - if searchMode || searchShowingSimplexLink { + if searchFocussed || searchShowingSimplexLink { Image(systemName: "xmark.circle.fill") .opacity(searchText == "" ? 0 : 1) .onTapGesture { @@ -333,14 +327,13 @@ struct ChatListSearchBar: View { .background(Color(.tertiarySystemFill)) .cornerRadius(10.0) - if searchMode { + if searchFocussed { Text("Cancel") - .foregroundColor(cancelVisible ? .accentColor : .clear) + .foregroundColor(.accentColor) .onTapGesture { searchText = "" searchFocussed = false } - .transition(.move(edge: .trailing).combined(with: .opacity)) } } Divider() @@ -352,14 +345,8 @@ struct ChatListSearchBar: View { .onChange(of: searchFocussed) { sf in if sf { withAnimation { searchMode = true } - DispatchQueue.main.asyncAfter(deadline: .now() + 0.2) { - withAnimation { cancelVisible = true } - } } else { - withAnimation { - searchMode = false - cancelVisible = false - } + withAnimation { searchMode = false } } } .onChange(of: searchText) { t in