remove already selected participants from the list

Signed-off-by: sowjanyakch <sowjanya.kch@gmail.com>
This commit is contained in:
sowjanyakch 2025-05-26 19:42:53 +02:00 committed by Marcel Hibbe
parent 652dd5033a
commit 4f8584bc75
No known key found for this signature in database
GPG Key ID: C793F8B59F43CE7B

View File

@ -114,6 +114,10 @@ class ContactsViewModel @Inject constructor(
if (hideAlreadyAddedParticipants && !_clickAddButton.value) { if (hideAlreadyAddedParticipants && !_clickAddButton.value) {
contactsList?.removeAll(selectedParticipants.value) contactsList?.removeAll(selectedParticipants.value)
} }
if (_clickAddButton.value) {
contactsList?.removeAll(selectedParticipants.value)
contactsList?.addAll(_selectedContacts.value)
}
_contactsViewState.value = ContactsUiState.Success(contactsList) _contactsViewState.value = ContactsUiState.Success(contactsList)
} catch (exception: Exception) { } catch (exception: Exception) {
_contactsViewState.value = ContactsUiState.Error(exception.message ?: "") _contactsViewState.value = ContactsUiState.Error(exception.message ?: "")