mirror of
https://github.com/simplex-chat/simplex-chat.git
synced 2026-10-22 10:32:27 +00:00
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
This commit is contained in:
1 parent
f6f38a4122
commit
0939975778
1 file changed
+19
-19
@@ -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)
|
||||
|
||||
Reference in new issue
Block a user