diff --git a/ConversationsClassic/Resources/Strings/Localizable.strings b/ConversationsClassic/Resources/Strings/Localizable.strings index 718bf02..eb99b2d 100644 --- a/ConversationsClassic/Resources/Strings/Localizable.strings +++ b/ConversationsClassic/Resources/Strings/Localizable.strings @@ -67,4 +67,5 @@ "Attachment.Tab.contacts" = "Contacts"; "Attachment.Send.media" = "Send media"; "Attachment.Send.location" = "Send location"; +"Attachment.Send.contact" = "Send contact"; diff --git a/ConversationsClassic/View/Screens/Attachments/AttachmentContactsPickerView.swift b/ConversationsClassic/View/Screens/Attachments/AttachmentContactsPickerView.swift index e01297a..63791e9 100644 --- a/ConversationsClassic/View/Screens/Attachments/AttachmentContactsPickerView.swift +++ b/ConversationsClassic/View/Screens/Attachments/AttachmentContactsPickerView.swift @@ -1,6 +1,8 @@ import SwiftUI struct AttachmentContactsPickerView: View { + @State private var selectedContact: Roster? + var body: some View { VStack(spacing: 0) { // Contacts list @@ -8,7 +10,7 @@ struct AttachmentContactsPickerView: View { if !rosters.isEmpty { List { ForEach(rosters) { roster in - ContactRow(roster: roster) + ContactRow(roster: roster, selectedContact: $selectedContact) } } .listStyle(.plain) @@ -16,12 +18,36 @@ struct AttachmentContactsPickerView: View { } else { Spacer() } + + // Send panel + Rectangle() + .foregroundColor(.Material.Shape.black) + .frame(maxWidth: .infinity) + .frame(height: selectedContact == nil ? 0 : 50) + .overlay { + HStack { + Text(L10n.Attachment.Send.contact) + .foregroundColor(.Material.Text.white) + .font(.body1) + Image(systemName: "arrow.up.circle") + .foregroundColor(.Material.Text.white) + .font(.body1) + .padding(.leading, 8) + } + .padding() + } + .clipped() + .onTapGesture { + // TODO: Send selected media + print("Send location") + } } } } private struct ContactRow: View { var roster: Roster + @Binding var selectedContact: Roster? var body: some View { VStack(spacing: 0) { @@ -38,6 +64,12 @@ private struct ContactRow: View { .foregroundColor(Color.Material.Text.main) .font(.body2) Spacer() + if selectedContact == roster { + Image(systemName: "checkmark") + .foregroundColor(.Material.Text.main) + .font(.body1) + .padding(.trailing, 8) + } } .padding(.horizontal, 16) .padding(.vertical, 4) @@ -48,7 +80,7 @@ private struct ContactRow: View { } .sharedListRow() .onTapGesture { - print(roster.contactBareJid) + selectedContact = roster } } }