another.im-ios/ConversationsClassic/View/Screens/Attachments/AttachmentContactsPickerView.swift
2024-07-08 10:51:47 +02:00

55 lines
1.6 KiB
Swift

import SwiftUI
struct AttachmentContactsPickerView: View {
var body: some View {
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)
}
}
}