From 74dac8479678265323d608c8c70fc7ab02182e84 Mon Sep 17 00:00:00 2001 From: nielsandriesse Date: Tue, 18 Aug 2020 09:34:22 +1000 Subject: [PATCH] Implement remaining feedback --- ...agment_closed_group_edit_bottom_sheet.xml} | 0 .../conversation/ConversationActivity.java | 2 +- .../activities/CreateClosedGroupActivity.kt | 2 +- .../activities/EditClosedGroupActivity.kt | 220 ++++++++---------- .../loki/activities/EditClosedGroupLoader.kt | 6 +- .../EditClosedGroupMembersAdapter.kt | 15 +- .../loki/activities/SelectContactsActivity.kt | 24 +- .../loki/activities/SelectContactsAdapter.kt | 17 +- ...> ClosedGroupEditingOptionsBottomSheet.kt} | 8 +- .../loki/protocol/ClosedGroupsProtocol.kt | 1 + 10 files changed, 133 insertions(+), 162 deletions(-) rename res/layout/{fragment_group_edit_bottom_sheet.xml => fragment_closed_group_edit_bottom_sheet.xml} (100%) rename src/org/thoughtcrime/securesms/loki/dialogs/{GroupEditingOptionsBottomSheet.kt => ClosedGroupEditingOptionsBottomSheet.kt} (63%) diff --git a/res/layout/fragment_group_edit_bottom_sheet.xml b/res/layout/fragment_closed_group_edit_bottom_sheet.xml similarity index 100% rename from res/layout/fragment_group_edit_bottom_sheet.xml rename to res/layout/fragment_closed_group_edit_bottom_sheet.xml diff --git a/src/org/thoughtcrime/securesms/conversation/ConversationActivity.java b/src/org/thoughtcrime/securesms/conversation/ConversationActivity.java index 1ae9015448..8d71df078d 100644 --- a/src/org/thoughtcrime/securesms/conversation/ConversationActivity.java +++ b/src/org/thoughtcrime/securesms/conversation/ConversationActivity.java @@ -1199,7 +1199,7 @@ public class ConversationActivity extends PassphraseRequiredActionBarActivity private void handleEditPushGroup() { Intent intent = new Intent(this, EditClosedGroupActivity.class); String groupID = this.recipient.getAddress().toGroupString(); - intent.putExtra(EditClosedGroupActivityKt.EXTRA_GROUP_ID, groupID); + intent.putExtra(EditClosedGroupActivity.Companion.getGroupIDKey(), groupID); startActivity(intent); } diff --git a/src/org/thoughtcrime/securesms/loki/activities/CreateClosedGroupActivity.kt b/src/org/thoughtcrime/securesms/loki/activities/CreateClosedGroupActivity.kt index 3108f5f699..2add7f3e56 100644 --- a/src/org/thoughtcrime/securesms/loki/activities/CreateClosedGroupActivity.kt +++ b/src/org/thoughtcrime/securesms/loki/activities/CreateClosedGroupActivity.kt @@ -118,7 +118,7 @@ class CreateClosedGroupActivity : PassphraseRequiredActionBarActivity(), LoaderM if (selectedMembers.count() < 2) { return Toast.makeText(this, R.string.activity_create_closed_group_not_enough_group_members_error, Toast.LENGTH_LONG).show() } - if (selectedMembers.count() > 49) { // Minus one because we're going to include self later + if (selectedMembers.count() > ClosedGroupsProtocol.groupSizeLimit) { // Minus one because we're going to include self later return Toast.makeText(this, R.string.activity_create_closed_group_too_many_group_members_error, Toast.LENGTH_LONG).show() } val userPublicKey = TextSecurePreferences.getLocalNumber(this) diff --git a/src/org/thoughtcrime/securesms/loki/activities/EditClosedGroupActivity.kt b/src/org/thoughtcrime/securesms/loki/activities/EditClosedGroupActivity.kt index dfa13e8003..75f6f2a18d 100644 --- a/src/org/thoughtcrime/securesms/loki/activities/EditClosedGroupActivity.kt +++ b/src/org/thoughtcrime/securesms/loki/activities/EditClosedGroupActivity.kt @@ -21,7 +21,7 @@ import org.thoughtcrime.securesms.PassphraseRequiredActionBarActivity import org.thoughtcrime.securesms.database.Address import org.thoughtcrime.securesms.database.DatabaseFactory import org.thoughtcrime.securesms.groups.GroupManager -import org.thoughtcrime.securesms.loki.dialogs.GroupEditingOptionsBottomSheet +import org.thoughtcrime.securesms.loki.dialogs.ClosedGroupEditingOptionsBottomSheet import org.thoughtcrime.securesms.loki.protocol.ClosedGroupsProtocol import org.thoughtcrime.securesms.mms.GlideApp import org.thoughtcrime.securesms.recipients.Recipient @@ -30,71 +30,66 @@ import org.thoughtcrime.securesms.util.TextSecurePreferences import org.whispersystems.signalservice.loki.utilities.toHexString import java.io.IOException -const val EXTRA_GROUP_ID = "GROUP_ID" -const val REQ_CODE_ADD_USERS = 124 -const val LOADER_ID_MEMBERS = 0 - -const val MAX_GROUP_MEMBERS_LEGACY = 10 -const val MAX_GROUP_MEMBERS_SSK = 50 - class EditClosedGroupActivity : PassphraseRequiredActionBarActivity() { - - private lateinit var memberListAdapter: EditClosedGroupMembersAdapter private val originalMembers = HashSet() private val members = HashSet() -// private var adminMembers = HashSet() + private var hasNameChanged = false private lateinit var groupID: String private lateinit var originalName: String - private lateinit var newGroupDisplayName: String + private lateinit var name: String - private var nameHasChanged = false - - private var isEditingGroupName = false + private var isEditingName = false set(value) { if (field == value) return field = value - handleIsEditingDisplayNameChanged() + handleIsEditingNameChanged() } + private val memberListAdapter by lazy { + EditClosedGroupMembersAdapter(this, GlideApp.with(this), this::onMemberClick) + } + + companion object { + @JvmStatic val groupIDKey = "groupIDKey" + private val loaderID = 0 + val addUsersRequestCode = 124 + val legacyGroupSizeLimit = 10 + } + // region Lifecycle override fun onCreate(savedInstanceState: Bundle?, isReady: Boolean) { super.onCreate(savedInstanceState, isReady) + setContentView(R.layout.activity_edit_closed_group) - - this.groupID = intent.getStringExtra(EXTRA_GROUP_ID) - this.originalName = DatabaseFactory.getGroupDatabase(this).getGroup(groupID).get().title - this.newGroupDisplayName = this.originalName - supportActionBar!!.title = resources.getString(R.string.activity_edit_closed_group_title) + groupID = intent.getStringExtra(Companion.groupIDKey) + originalName = DatabaseFactory.getGroupDatabase(this).getGroup(groupID).get().title + name = originalName + addMembersClosedGroupButton.setOnClickListener { onAddMembersClick() } - this.memberListAdapter = EditClosedGroupMembersAdapter( - this, - GlideApp.with(this), - this::onMemberClick - ) - recyclerView.adapter = this.memberListAdapter + recyclerView.adapter = memberListAdapter recyclerView.layoutManager = LinearLayoutManager(this) - lblGroupNameDisplay.text = this.originalName - cntGroupNameDisplay.setOnClickListener { isEditingGroupName = true } - btnCancelGroupNameEdit.setOnClickListener { isEditingGroupName = false } - btnSaveGroupNameEdit.setOnClickListener { saveDisplayName() } + lblGroupNameDisplay.text = originalName + cntGroupNameDisplay.setOnClickListener { isEditingName = true } + btnCancelGroupNameEdit.setOnClickListener { isEditingName = false } + btnSaveGroupNameEdit.setOnClickListener { saveName() } edtGroupName.setImeActionLabel(getString(R.string.save), EditorInfo.IME_ACTION_DONE) edtGroupName.setOnEditorActionListener { _, actionId, _ -> when (actionId) { EditorInfo.IME_ACTION_DONE -> { - saveDisplayName() + saveName() return@setOnEditorActionListener true } else -> return@setOnEditorActionListener false } } - // Setup member list loader. - LoaderManager.getInstance(this).initLoader(LOADER_ID_MEMBERS, null, object : LoaderManager.LoaderCallbacks> { + LoaderManager.getInstance(this).initLoader(Companion.loaderID, null, object : LoaderManager.LoaderCallbacks> { + override fun onCreateLoader(id: Int, bundle: Bundle?): Loader> { return EditClosedGroupLoader(this@EditClosedGroupActivity, groupID) } @@ -102,7 +97,7 @@ class EditClosedGroupActivity : PassphraseRequiredActionBarActivity() { override fun onLoadFinished(loader: Loader>, members: List) { // We no longer need any subsequent loading events // (they will occur on every activity resume). - LoaderManager.getInstance(this@EditClosedGroupActivity).destroyLoader(LOADER_ID_MEMBERS) + LoaderManager.getInstance(this@EditClosedGroupActivity).destroyLoader(Companion.loaderID) originalMembers.clear() originalMembers.addAll(members.toHashSet()) @@ -122,66 +117,26 @@ class EditClosedGroupActivity : PassphraseRequiredActionBarActivity() { // endregion // region Updating - private fun updateMembers(members: Set) { - this.members.clear() - this.members.addAll(members) - this.memberListAdapter.setMembers(members) - - val localUserPublicKey = TextSecurePreferences.getLocalNumber(this) - this.memberListAdapter.setLockedMembers(arrayListOf(localUserPublicKey)) - - mainContentContainer.visibility = if (members.isEmpty()) View.GONE else View.VISIBLE - emptyStateContainer.visibility = if (members.isEmpty()) View.VISIBLE else View.GONE - invalidateOptionsMenu() - } - // endregion - - // region Interaction - override fun onOptionsItemSelected(item: MenuItem): Boolean { - when(item.itemId) { - R.id.applyButton -> commitClosedGroupChanges() - } - return super.onOptionsItemSelected(item) - } - - private fun onMemberClick(member: String) { - val bottomSheet = GroupEditingOptionsBottomSheet() - bottomSheet.onRemoveTapped = { - val changedMembers = members - member - updateMembers(changedMembers) - bottomSheet.dismiss() - } - // bottomSheet.onAdminTapped = { - // bottomSheet.dismiss() - // } - bottomSheet.show(supportFragmentManager, "MEMBER_BOTTOM_SHEET") - } - - private fun onAddMembersClick() { - val intent = Intent(this@EditClosedGroupActivity, SelectContactsActivity::class.java) - startActivityForResult(intent, REQ_CODE_ADD_USERS) - } - override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) { super.onActivityResult(requestCode, resultCode, data) when (requestCode) { - REQ_CODE_ADD_USERS -> { + Companion.addUsersRequestCode -> { if (resultCode != RESULT_OK) return - if (data == null || data.extras == null || !data.hasExtra(EXTRA_RESULT_SELECTED_CONTACTS)) return + if (data == null || data.extras == null || !data.hasExtra(SelectContactsActivity.selectedContactsKey)) return - val selectedContacts = data.extras!!.getStringArray(EXTRA_RESULT_SELECTED_CONTACTS)!!.toSet() + val selectedContacts = data.extras!!.getStringArray(SelectContactsActivity.selectedContactsKey)!!.toSet() val changedMembers = members + selectedContacts updateMembers(changedMembers) } } } - private fun handleIsEditingDisplayNameChanged() { - cntGroupNameEdit.visibility = if (isEditingGroupName) View.VISIBLE else View.INVISIBLE - cntGroupNameDisplay.visibility = if (isEditingGroupName) View.INVISIBLE else View.VISIBLE + private fun handleIsEditingNameChanged() { + cntGroupNameEdit.visibility = if (isEditingName) View.VISIBLE else View.INVISIBLE + cntGroupNameDisplay.visibility = if (isEditingName) View.INVISIBLE else View.VISIBLE val inputMethodManager = getSystemService(Context.INPUT_METHOD_SERVICE) as InputMethodManager - if (isEditingGroupName) { - edtGroupName.setText(newGroupDisplayName) + if (isEditingName) { + edtGroupName.setText(name) edtGroupName.selectAll() edtGroupName.requestFocus() inputMethodManager.showSoftInput(edtGroupName, 0) @@ -190,67 +145,98 @@ class EditClosedGroupActivity : PassphraseRequiredActionBarActivity() { } } - private fun saveDisplayName() { - val groupDisplayName = edtGroupName.text.toString().trim() - if (groupDisplayName.isEmpty()) { - return Toast.makeText(this, R.string.activity_edit_closed_group_group_name_missing_error, Toast.LENGTH_SHORT).show() + private fun updateMembers(members: Set) { + this.members.clear() + this.members.addAll(members) + memberListAdapter.setMembers(members) + + val userPublicKey = TextSecurePreferences.getLocalNumber(this) + memberListAdapter.setLockedMembers(arrayListOf(userPublicKey)) + + mainContentContainer.visibility = if (members.isEmpty()) View.GONE else View.VISIBLE + emptyStateContainer.visibility = if (members.isEmpty()) View.VISIBLE else View.GONE + + invalidateOptionsMenu() + } + // endregion + + // region Interaction + override fun onOptionsItemSelected(item: MenuItem): Boolean { + when(item.itemId) { + R.id.applyButton -> commitChanges() } -// if (groupDisplayName.toByteArray().size > ProfileCipher.NAME_PADDED_LENGTH) { - if (groupDisplayName.length >= 64) { - return Toast.makeText(this, R.string.activity_edit_closed_group_group_name_too_long_error, Toast.LENGTH_SHORT).show() - } -// if (!groupDisplayName.matches(Regex("[a-zA-Z0-9_]+"))) { -// return Toast.makeText(this, R.string.activity_settings_invalid_display_name_error, Toast.LENGTH_SHORT).show() -// } - newGroupDisplayName = groupDisplayName - lblGroupNameDisplay.text = groupDisplayName - nameHasChanged = true - isEditingGroupName = false + return super.onOptionsItemSelected(item) } - private fun commitClosedGroupChanges() { - val membersHaveChanged = members.size != originalMembers.size || !members.containsAll(originalMembers) + private fun onMemberClick(member: String) { + val bottomSheet = ClosedGroupEditingOptionsBottomSheet() + bottomSheet.onRemoveTapped = { + val changedMembers = members - member + updateMembers(changedMembers) + bottomSheet.dismiss() + } + bottomSheet.show(supportFragmentManager, "GroupEditingOptionsBottomSheet") + } - if (!nameHasChanged && !membersHaveChanged) { - finish() - return + private fun onAddMembersClick() { + val intent = Intent(this@EditClosedGroupActivity, SelectContactsActivity::class.java) + startActivityForResult(intent, Companion.addUsersRequestCode) + } + + private fun saveName() { + val name = edtGroupName.text.toString().trim() + if (name.isEmpty()) { + return Toast.makeText(this, R.string.activity_edit_closed_group_group_name_missing_error, Toast.LENGTH_SHORT).show() + } + if (name.length >= 64) { + return Toast.makeText(this, R.string.activity_edit_closed_group_group_name_too_long_error, Toast.LENGTH_SHORT).show() + } + this.name = name + lblGroupNameDisplay.text = name + hasNameChanged = true + isEditingName = false + } + + private fun commitChanges() { + val hasMemberListChanges = members != originalMembers + + if (!hasNameChanged && !hasMemberListChanges) { + return finish() } - val groupDisplayName = if (nameHasChanged) newGroupDisplayName else originalName + val name = if (hasNameChanged) this.name else originalName - val finalGroupMembers = members.map { + val members = this.members.map { Recipient.from(this, Address.fromSerialized(it), false) }.toSet() -// val finalGroupAdmins = adminMembers.map { -// Recipient.from(this, Address.fromSerialized(it), false) -// }.toSet() - val finalGroupAdmins = finalGroupMembers.toSet() //TODO For now, consider all the users are admins. + val admins = members.toSet() //TODO For now, consider all the users to be admins. var isSSKBasedClosedGroup: Boolean var groupPublicKey: String? try { - groupPublicKey = GroupUtil.getDecodedId(groupID).toHexString() + groupPublicKey = ClosedGroupsProtocol.doubleDecodeGroupID(groupID).toHexString() isSSKBasedClosedGroup = DatabaseFactory.getSSKDatabase(this).isSSKBasedClosedGroup(groupPublicKey) } catch (e: IOException) { groupPublicKey = null isSSKBasedClosedGroup = false } - if (finalGroupMembers.size < 2) { + if (members.size < 2) { return Toast.makeText(this, R.string.activity_edit_closed_group_not_enough_group_members_error, Toast.LENGTH_LONG).show() } - val maxGroupMembers = if (isSSKBasedClosedGroup) MAX_GROUP_MEMBERS_SSK else MAX_GROUP_MEMBERS_LEGACY - if (finalGroupMembers.size > maxGroupMembers) { + + val maxGroupMembers = if (isSSKBasedClosedGroup) ClosedGroupsProtocol.groupSizeLimit else Companion.legacyGroupSizeLimit + if (members.size > maxGroupMembers) { + // TODO: Update copy for SSK based closed groups return Toast.makeText(this, R.string.activity_edit_closed_group_too_many_group_members_error, Toast.LENGTH_LONG).show() } if (isSSKBasedClosedGroup) { - //TODO AC: Should it use "groupPublicKey" or "groupID"? - ClosedGroupsProtocol.update(this, groupPublicKey!!, finalGroupMembers.map { it.address.serialize() }, - groupDisplayName, finalGroupAdmins.map { it.address.serialize() }) + ClosedGroupsProtocol.update(this, groupPublicKey!!, members.map { it.address.serialize() }, + name, admins.map { it.address.serialize() }) } else { - GroupManager.updateGroup(this, groupID, finalGroupMembers, null, groupDisplayName, finalGroupAdmins) + GroupManager.updateGroup(this, groupID, members, null, name, admins) } finish() } diff --git a/src/org/thoughtcrime/securesms/loki/activities/EditClosedGroupLoader.kt b/src/org/thoughtcrime/securesms/loki/activities/EditClosedGroupLoader.kt index 32a7d32e44..07d86f4a4e 100644 --- a/src/org/thoughtcrime/securesms/loki/activities/EditClosedGroupLoader.kt +++ b/src/org/thoughtcrime/securesms/loki/activities/EditClosedGroupLoader.kt @@ -5,16 +5,12 @@ import org.thoughtcrime.securesms.database.DatabaseFactory import org.thoughtcrime.securesms.loki.utilities.ContactUtilities import org.thoughtcrime.securesms.util.AsyncLoader -class EditClosedGroupLoader( - context: Context, - val groupID: String -) : AsyncLoader>(context) { +class EditClosedGroupLoader(context: Context, val groupID: String) : AsyncLoader>(context) { override fun loadInBackground(): List { val members = DatabaseFactory.getGroupDatabase(context).getGroupMembers(groupID, true) return members.map { it.address.toPhoneString() } - /* TODO:Load admins in the process here */ } } \ No newline at end of file diff --git a/src/org/thoughtcrime/securesms/loki/activities/EditClosedGroupMembersAdapter.kt b/src/org/thoughtcrime/securesms/loki/activities/EditClosedGroupMembersAdapter.kt index c0b1840262..2ea2a4b56a 100644 --- a/src/org/thoughtcrime/securesms/loki/activities/EditClosedGroupMembersAdapter.kt +++ b/src/org/thoughtcrime/securesms/loki/activities/EditClosedGroupMembersAdapter.kt @@ -9,11 +9,10 @@ import org.thoughtcrime.securesms.mms.GlideRequests import org.thoughtcrime.securesms.recipients.Recipient class EditClosedGroupMembersAdapter( - private val context: Context, - private val glide: GlideRequests, - private val memberClickListener: ((String) -> Unit)? = null + private val context: Context, + private val glide: GlideRequests, + private val memberClickListener: ((String) -> Unit)? = null ) : RecyclerView.Adapter() { - private val members = ArrayList() private val lockedMembers = HashSet() @@ -42,10 +41,10 @@ class EditClosedGroupMembersAdapter( val lockedMember = lockedMembers.contains(member) viewHolder.view.bind(Recipient.from( - context, - Address.fromSerialized(member), false), - glide, - (if (lockedMember) UserView.ActionIndicator.None else UserView.ActionIndicator.Menu)) + context, + Address.fromSerialized(member), false), + glide, + if (lockedMember) UserView.ActionIndicator.None else UserView.ActionIndicator.Menu) if (!lockedMember) { viewHolder.view.setOnClickListener { this.memberClickListener?.invoke(member) } diff --git a/src/org/thoughtcrime/securesms/loki/activities/SelectContactsActivity.kt b/src/org/thoughtcrime/securesms/loki/activities/SelectContactsActivity.kt index e71554fb20..5f2c3942da 100644 --- a/src/org/thoughtcrime/securesms/loki/activities/SelectContactsActivity.kt +++ b/src/org/thoughtcrime/securesms/loki/activities/SelectContactsActivity.kt @@ -15,27 +15,28 @@ import network.loki.messenger.R import org.thoughtcrime.securesms.PassphraseRequiredActionBarActivity import org.thoughtcrime.securesms.mms.GlideApp -const val EXTRA_RESULT_SELECTED_CONTACTS = "RESULT_SELECTED_CONTACTS" -//const val RESULT_CREATE_PRIVATE_CHAT = 100; - class SelectContactsActivity : PassphraseRequiredActionBarActivity(), LoaderManager.LoaderCallbacks> { private var members = listOf() set(value) { field = value; selectContactsAdapter.members = value } - private lateinit var selectContactsAdapter: SelectContactsAdapter + private val selectContactsAdapter by lazy { + SelectContactsAdapter(this, GlideApp.with(this)) + } + + companion object { + val selectedContactsKey = "selectedContactsKey" + } // region Lifecycle override fun onCreate(savedInstanceState: Bundle?, isReady: Boolean) { super.onCreate(savedInstanceState, isReady) + setContentView(R.layout.activity_select_contacts) supportActionBar!!.title = resources.getString(R.string.activity_select_contacts_title) - this.selectContactsAdapter = SelectContactsAdapter(this, GlideApp.with(this)) recyclerView.adapter = selectContactsAdapter recyclerView.layoutManager = LinearLayoutManager(this) -// btnCreateNewPrivateChat.setOnClickListener { closeAndCreatePrivateChat() } - LoaderManager.getInstance(this).initLoader(0, null, this) } @@ -74,16 +75,11 @@ class SelectContactsActivity : PassphraseRequiredActionBarActivity(), LoaderMana return super.onOptionsItemSelected(item) } -// private fun closeAndCreatePrivateChat() { -// setResult(RESULT_CREATE_PRIVATE_CHAT) -// finish() -// } - private fun closeAndReturnSelected() { - val selectedMembers = this.selectContactsAdapter.selectedMembers + val selectedMembers = selectContactsAdapter.selectedMembers val selectedContacts = selectedMembers.toTypedArray() val intent = Intent() - intent.putExtra(EXTRA_RESULT_SELECTED_CONTACTS, selectedContacts) + intent.putExtra(selectedContactsKey, selectedContacts) setResult(Activity.RESULT_OK, intent) finish() } diff --git a/src/org/thoughtcrime/securesms/loki/activities/SelectContactsAdapter.kt b/src/org/thoughtcrime/securesms/loki/activities/SelectContactsAdapter.kt index 10e13f23c9..abe2849165 100644 --- a/src/org/thoughtcrime/securesms/loki/activities/SelectContactsAdapter.kt +++ b/src/org/thoughtcrime/securesms/loki/activities/SelectContactsAdapter.kt @@ -8,13 +8,8 @@ import org.thoughtcrime.securesms.loki.views.UserView import org.thoughtcrime.securesms.mms.GlideRequests import org.thoughtcrime.securesms.recipients.Recipient -class SelectContactsAdapter( - private val context: Context, - private val glide: GlideRequests) - : RecyclerView.Adapter() { - +class SelectContactsAdapter(private val context: Context, private val glide: GlideRequests) : RecyclerView.Adapter() { val selectedMembers = mutableSetOf() - var members = listOf() set(value) { field = value; notifyDataSetChanged() } @@ -34,11 +29,11 @@ class SelectContactsAdapter( viewHolder.view.setOnClickListener { onMemberClick(member) } val isSelected = selectedMembers.contains(member) viewHolder.view.bind(Recipient.from( - context, - Address.fromSerialized(member), false), - glide, - UserView.ActionIndicator.Tick, - isSelected) + context, + Address.fromSerialized(member), false), + glide, + UserView.ActionIndicator.Tick, + isSelected) } private fun onMemberClick(member: String) { diff --git a/src/org/thoughtcrime/securesms/loki/dialogs/GroupEditingOptionsBottomSheet.kt b/src/org/thoughtcrime/securesms/loki/dialogs/ClosedGroupEditingOptionsBottomSheet.kt similarity index 63% rename from src/org/thoughtcrime/securesms/loki/dialogs/GroupEditingOptionsBottomSheet.kt rename to src/org/thoughtcrime/securesms/loki/dialogs/ClosedGroupEditingOptionsBottomSheet.kt index fe967ef652..092b37bc75 100644 --- a/src/org/thoughtcrime/securesms/loki/dialogs/GroupEditingOptionsBottomSheet.kt +++ b/src/org/thoughtcrime/securesms/loki/dialogs/ClosedGroupEditingOptionsBottomSheet.kt @@ -5,20 +5,18 @@ import android.support.design.widget.BottomSheetDialogFragment import android.view.LayoutInflater import android.view.View import android.view.ViewGroup -import kotlinx.android.synthetic.main.fragment_group_edit_bottom_sheet.* +import kotlinx.android.synthetic.main.fragment_closed_group_edit_bottom_sheet.* import network.loki.messenger.R -public class GroupEditingOptionsBottomSheet : BottomSheetDialogFragment() { +public class ClosedGroupEditingOptionsBottomSheet : BottomSheetDialogFragment() { var onRemoveTapped: (() -> Unit)? = null -// var onAdminTapped: (() -> Unit)? = null override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View? { - return inflater.inflate(R.layout.fragment_group_edit_bottom_sheet, container, false) + return inflater.inflate(R.layout.fragment_closed_group_edit_bottom_sheet, container, false) } override fun onViewCreated(view: View, savedInstanceState: Bundle?) { super.onViewCreated(view, savedInstanceState) removeFromGroup.setOnClickListener { onRemoveTapped?.invoke() } -// makeAdministrator.setOnClickListener { onAdminTapped?.invoke() } } } \ No newline at end of file diff --git a/src/org/thoughtcrime/securesms/loki/protocol/ClosedGroupsProtocol.kt b/src/org/thoughtcrime/securesms/loki/protocol/ClosedGroupsProtocol.kt index 9ec9fe5563..80b3f98496 100644 --- a/src/org/thoughtcrime/securesms/loki/protocol/ClosedGroupsProtocol.kt +++ b/src/org/thoughtcrime/securesms/loki/protocol/ClosedGroupsProtocol.kt @@ -33,6 +33,7 @@ import java.util.* object ClosedGroupsProtocol { val isSharedSenderKeysEnabled = false + val groupSizeLimit = 10 public fun createClosedGroup(context: Context, name: String, members: Collection): String { // Prepare