conversations-classic-ios/ConversationsClassic/View/Screens/Attachments/AttachmentContactsPickerView.swift

55 lines
1.6 KiB
Swift
Raw Normal View History

2024-07-02 09:56:27 +00:00
import SwiftUI
struct AttachmentContactsPickerView: View {
var body: some View {
2024-07-08 07:41:35 +00:00
VStack(spacing: 0) {
// Contacts list
let rosters = store.state.rostersState.rosters.filter { !$0.locallyDeleted }
if !rosters.isEmpty {
List {
ForEach(rosters) { roster in
ContactRow(roster: roster)
}
}
.listStyle(.plain)
.background(Color.Material.Background.light)
} else {
Spacer()
}
}
}
}
private struct ContactRow: View {
var roster: Roster
var body: some View {
VStack(spacing: 0) {
HStack(spacing: 8) {
ZStack {
Circle()
.frame(width: 44, height: 44)
.foregroundColor(.red)
Text(roster.name?.firstLetter ?? roster.contactBareJid.firstLetter)
.foregroundColor(.white)
.font(.body1)
}
Text(roster.contactBareJid)
.foregroundColor(Color.Material.Text.main)
.font(.body2)
Spacer()
}
.padding(.horizontal, 16)
.padding(.vertical, 4)
Rectangle()
.frame(maxWidth: .infinity)
.frame(height: 1)
.foregroundColor(.Material.Background.dark)
}
.sharedListRow()
.onTapGesture {
print(roster.contactBareJid)
}
2024-07-02 09:56:27 +00:00
}
}