From c22545a3b82bd3e69f4b26de92ab978ea5001f2a Mon Sep 17 00:00:00 2001 From: cheykrym Date: Sat, 13 Dec 2025 00:18:16 +0300 Subject: [PATCH] chat fix --- yobble/Views/Tab/ChatsTab.swift | 19 +++++++------------ 1 file changed, 7 insertions(+), 12 deletions(-) diff --git a/yobble/Views/Tab/ChatsTab.swift b/yobble/Views/Tab/ChatsTab.swift index 5b81f97..866cbb9 100644 --- a/yobble/Views/Tab/ChatsTab.swift +++ b/yobble/Views/Tab/ChatsTab.swift @@ -18,7 +18,6 @@ struct ChatsTab: View { private let chatService = ChatService() @AppStorage("chatRowMessageLineLimit") private var messageLineLimitSetting: Int = 2 @StateObject private var viewModel = PrivateChatsViewModel() - @State private var selectedChatId: String? @State private var searchDragStartProgress: CGFloat = 0 @State private var isSearchGestureActive: Bool = false @State private var globalSearchResults: [UserSearchResult] = [] @@ -447,7 +446,7 @@ struct ChatsTab: View { @ViewBuilder private func chatRowItem(for chat: PrivateChatListItem) -> some View { Button { - selectedChatId = chat.chatId + openChat(chat) } label: { ChatRowView( chat: chat, @@ -470,16 +469,6 @@ struct ChatsTab: View { Label(NSLocalizedString("Удалить чат (скоро)", comment: ""), systemImage: "trash") } } - .background( - NavigationLink( - destination: PrivateChatView(chat: chat, currentUserId: currentUserId), - tag: chat.chatId, - selection: $selectedChatId - ) { - EmptyView() - } - .hidden() - ) .listRowInsets(EdgeInsets(top: 4, leading: 16, bottom: 4, trailing: 16)) // .listRowSeparator(.hidden) .onAppear { @@ -488,6 +477,12 @@ struct ChatsTab: View { } } + + private func openChat(_ chat: PrivateChatListItem) { + pendingChatItem = chat + isPendingChatActive = true + } + private var globalSearchLoadingRow: some View { HStack { ProgressView()