From 09399757789fe035fd7c22caf0877dc7a691f3f2 Mon Sep 17 00:00:00 2001 From: spacedandy-agents-simplex <342056592+spacedandy-agents-simplex@users.noreply.github.com> Date: Mon, 19 Oct 2026 09:00:39 +0000 Subject: [PATCH] ios: draw the chat list's chat rows with one function The Directory part will draw known chats with the chat list's own row, so its two modifier chains (iOS 16+, iOS 15) move unchanged into chatListNavLink(_:), and the list's two ForEach branches become one. The iOS 16 offset moves from the ForEach to each row, which SwiftUI applies the same way. Run: 008-dirsearch-known-chats, slice 1 --- .../Shared/Views/ChatList/ChatListView.swift | 38 +++++++++---------- 1 file changed, 19 insertions(+), 19 deletions(-) diff --git a/apps/ios/Shared/Views/ChatList/ChatListView.swift b/apps/ios/Shared/Views/ChatList/ChatListView.swift index 1d23cc3f3d..05b6923168 100644 --- a/apps/ios/Shared/Views/ChatList/ChatListView.swift +++ b/apps/ios/Shared/Views/ChatList/ChatListView.swift @@ -630,25 +630,7 @@ struct ChatListView: View { .zIndex(1) .onAppear { chatModel.chatListBanner = .getStake } } - if #available(iOS 16.0, *) { - ForEach(cs, id: \.viewId) { chat in - ChatListNavLink(chat: chat, parentSheet: $sheet) - .scaleEffect(x: 1, y: oneHandUI ? -1 : 1, anchor: .center) - .padding(.trailing, -16) - .disabled(chatModel.chatRunning != true || chatModel.deletedChats.contains(chat.chatInfo.id)) - .listRowBackground(Color.clear) - } - .offset(x: -8) - } else { - ForEach(cs, id: \.viewId) { chat in - ChatListNavLink(chat: chat, parentSheet: $sheet) - .scaleEffect(x: 1, y: oneHandUI ? -1 : 1, anchor: .center) - .listRowSeparator(.hidden) - .listRowInsets(EdgeInsets()) - .background { theme.colors.background } // Hides default list selection colour - .disabled(chatModel.chatRunning != true || chatModel.deletedChats.contains(chat.chatInfo.id)) - } - } + ForEach(cs, id: \.viewId) { chat in chatListNavLink(chat) } nameRows(rows.names) directoryRows(rows) if showsCards && !addressCreationCardShown && hasConversations { @@ -686,6 +668,24 @@ struct ChatListView: View { } } + @ViewBuilder private func chatListNavLink(_ chat: Chat) -> some View { + if #available(iOS 16.0, *) { + ChatListNavLink(chat: chat, parentSheet: $sheet) + .scaleEffect(x: 1, y: oneHandUI ? -1 : 1, anchor: .center) + .padding(.trailing, -16) + .disabled(chatModel.chatRunning != true || chatModel.deletedChats.contains(chat.chatInfo.id)) + .listRowBackground(Color.clear) + .offset(x: -8) + } else { + ChatListNavLink(chat: chat, parentSheet: $sheet) + .scaleEffect(x: 1, y: oneHandUI ? -1 : 1, anchor: .center) + .listRowSeparator(.hidden) + .listRowInsets(EdgeInsets()) + .background { theme.colors.background } // Hides default list selection colour + .disabled(chatModel.chatRunning != true || chatModel.deletedChats.contains(chat.chatInfo.id)) + } + } + @ViewBuilder private func directoryShowMoreRow() -> some View { DirectoryShowMoreRow(onlineSearch: onlineSearch) .scaleEffect(x: 1, y: oneHandUI ? -1 : 1, anchor: .center)