avoid displaying self in the contacts list

This commit is contained in:
Brice-W 2021-04-20 09:39:51 +10:00
parent be2692fec6
commit 10554011f8

View File

@ -32,6 +32,10 @@ class CreateClosedGroupActivity : PassphraseRequiredActionBarActivity(), LoaderM
set(newValue) { field = newValue; invalidateOptionsMenu() } set(newValue) { field = newValue; invalidateOptionsMenu() }
private var members = listOf<String>() private var members = listOf<String>()
set(value) { field = value; selectContactsAdapter.members = value } set(value) { field = value; selectContactsAdapter.members = value }
private val publicKey: String
get() {
return TextSecurePreferences.getLocalNumber(this)!!
}
private val selectContactsAdapter by lazy { private val selectContactsAdapter by lazy {
SelectContactsAdapter(this, GlideApp.with(this)) SelectContactsAdapter(this, GlideApp.with(this))
@ -72,7 +76,7 @@ class CreateClosedGroupActivity : PassphraseRequiredActionBarActivity(), LoaderM
} }
private fun update(members: List<String>) { private fun update(members: List<String>) {
this.members = members this.members = members.minus(publicKey)
mainContentContainer.visibility = if (members.isEmpty()) View.GONE else View.VISIBLE mainContentContainer.visibility = if (members.isEmpty()) View.GONE else View.VISIBLE
emptyStateContainer.visibility = if (members.isEmpty()) View.VISIBLE else View.GONE emptyStateContainer.visibility = if (members.isEmpty()) View.VISIBLE else View.GONE
invalidateOptionsMenu() invalidateOptionsMenu()