diff --git a/src/org/thoughtcrime/securesms/loki/activities/EditClosedGroupActivity.kt b/src/org/thoughtcrime/securesms/loki/activities/EditClosedGroupActivity.kt index d10b8d00cb..5ab1d17964 100644 --- a/src/org/thoughtcrime/securesms/loki/activities/EditClosedGroupActivity.kt +++ b/src/org/thoughtcrime/securesms/loki/activities/EditClosedGroupActivity.kt @@ -32,9 +32,9 @@ class EditClosedGroupActivity : PassphraseRequiredActionBarActivity(), MemberCli private var members = listOf() set(value) { field = value; editClosedGroupAdapter.members = value } private lateinit var groupID: String - private var membersToRemove = setOf() - private var membersToAdd = setOf() - private var admins = setOf() + private var membersToRemove = listOf() + private var membersToAdd = listOf() + private var admins = listOf() private val originalName by lazy { DatabaseFactory.getGroupDatabase(this).getGroup(groupID).get().title } private var nameHasChanged = false private lateinit var newGroupDisplayName: String @@ -136,9 +136,11 @@ class EditClosedGroupActivity : PassphraseRequiredActionBarActivity(), MemberCli if (resultCode == RESULT_OK) { if (data != null && data.hasExtra("Selected Contacts Result")) { val returnedContacts = data.extras.getStringArray("Selected Contacts Result") - var selectedContacts = returnedContacts.toSet() + val selectedContacts = returnedContacts.toList() membersToAdd = selectedContacts + membersToAdd members = members + membersToAdd + Toast.makeText(this.applicationContext, membersToAdd.toString(), Toast.LENGTH_LONG).show() + //TODO:this works for users that were already in the group but were removed in the same edit activity, but not users that were never in the chat. WHy? } } } @@ -158,8 +160,7 @@ class EditClosedGroupActivity : PassphraseRequiredActionBarActivity(), MemberCli } private fun saveDisplayName() { - var groupDisplayName = displayNameEditText.text.toString().trim() - // something about the implementation of displayNameEdit text makes it null insead of whatever the user inputs, causes a crash + var groupDisplayName = groupNameEditText.text.toString().trim() if (groupDisplayName.isEmpty()) { return Toast.makeText(this, R.string.activity_settings_display_name_missing_error, Toast.LENGTH_SHORT).show() } @@ -169,10 +170,11 @@ class EditClosedGroupActivity : PassphraseRequiredActionBarActivity(), MemberCli if (groupDisplayName.toByteArray().size > ProfileCipher.NAME_PADDED_LENGTH) { return Toast.makeText(this, R.string.activity_settings_display_name_too_long_error, Toast.LENGTH_SHORT).show() } - isEditingGroupName = false - nameHasChanged = true newGroupDisplayName = groupDisplayName - + displayNameTextView.text = groupDisplayName + nameHasChanged = true + isEditingGroupName = false + return Toast.makeText(this, "Name Changed", Toast.LENGTH_SHORT).show() } private fun modifyClosedGroup() { diff --git a/src/org/thoughtcrime/securesms/loki/activities/EditClosedGroupLoader.kt b/src/org/thoughtcrime/securesms/loki/activities/EditClosedGroupLoader.kt index 59ef979994..467423ac90 100644 --- a/src/org/thoughtcrime/securesms/loki/activities/EditClosedGroupLoader.kt +++ b/src/org/thoughtcrime/securesms/loki/activities/EditClosedGroupLoader.kt @@ -8,10 +8,10 @@ import org.thoughtcrime.securesms.util.AsyncLoader class EditClosedGroupLoader(val groupID: String, context: Context) : AsyncLoader>(context) { override fun loadInBackground(): List { - val members = DatabaseFactory.getGroupDatabase(context).getGroupMembers(groupID, false) + val members = DatabaseFactory.getGroupDatabase(context).getGroupMembers(groupID, true) return members.map { it.address.toPhoneString() } - /* To do: Load admins in the process here */ + /* TODO:Load admins in the process here */ } } \ No newline at end of file