avoid adding the same contact multiple times

This commit is contained in:
tibbi 2020-04-06 10:07:02 +02:00
parent e7340d80ea
commit 775c4da791
1 changed files with 6 additions and 1 deletions

View File

@ -72,10 +72,15 @@ class NewMessageActivity : SimpleActivity() {
} }
private fun addSelectedContact(contact: Contact) { private fun addSelectedContact(contact: Contact) {
new_message_to.setText("")
if (selectedContacts.map { it.contactId }.contains(contact.contactId)) {
return
}
selectedContacts.add(contact) selectedContacts.add(contact)
selected_contacts.beVisible() selected_contacts.beVisible()
message_divider_one.beVisible() message_divider_one.beVisible()
new_message_to.setText("")
val views = ArrayList<View>() val views = ArrayList<View>()
selectedContacts.forEach { selectedContacts.forEach {