mirror of
https://github.com/oxen-io/session-android.git
synced 2024-11-27 12:05:22 +00:00
Switch new closed group activity over to SSKs
This commit is contained in:
parent
97b35d769a
commit
61050444f9
@ -19,6 +19,7 @@ import org.thoughtcrime.securesms.conversation.ConversationActivity
|
||||
import org.thoughtcrime.securesms.database.Address
|
||||
import org.thoughtcrime.securesms.database.ThreadDatabase
|
||||
import org.thoughtcrime.securesms.groups.GroupManager
|
||||
import org.thoughtcrime.securesms.loki.protocol.ClosedGroupsProtocol
|
||||
import org.thoughtcrime.securesms.mms.GlideApp
|
||||
import org.thoughtcrime.securesms.recipients.Recipient
|
||||
import org.thoughtcrime.securesms.util.TextSecurePreferences
|
||||
@ -101,6 +102,32 @@ class CreateClosedGroupActivity : PassphraseRequiredActionBarActivity(), MemberC
|
||||
}
|
||||
|
||||
private fun createClosedGroup() {
|
||||
if (ClosedGroupsProtocol.isSharedSenderKeysEnabled) {
|
||||
createSSKBasedClosedGroup()
|
||||
} else {
|
||||
createLegacyClosedGroup()
|
||||
}
|
||||
}
|
||||
|
||||
private fun createSSKBasedClosedGroup() {
|
||||
val name = nameEditText.text.trim()
|
||||
if (name.isEmpty()) {
|
||||
return Toast.makeText(this, R.string.activity_create_closed_group_group_name_missing_error, Toast.LENGTH_LONG).show()
|
||||
}
|
||||
if (name.length >= 64) {
|
||||
return Toast.makeText(this, R.string.activity_create_closed_group_group_name_too_long_error, Toast.LENGTH_LONG).show()
|
||||
}
|
||||
val selectedMembers = this.selectedMembers
|
||||
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
|
||||
return Toast.makeText(this, R.string.activity_create_closed_group_too_many_group_members_error, Toast.LENGTH_LONG).show()
|
||||
}
|
||||
ClosedGroupsProtocol.createClosedGroup(this, name.toString(), selectedMembers)
|
||||
}
|
||||
|
||||
private fun createLegacyClosedGroup() {
|
||||
val name = nameEditText.text.trim()
|
||||
if (name.isEmpty()) {
|
||||
return Toast.makeText(this, R.string.activity_create_closed_group_group_name_missing_error, Toast.LENGTH_LONG).show()
|
||||
|
@ -23,6 +23,7 @@ import org.whispersystems.signalservice.loki.utilities.toHexString
|
||||
import java.util.*
|
||||
|
||||
object ClosedGroupsProtocol {
|
||||
val isSharedSenderKeysEnabled = true
|
||||
|
||||
public fun createClosedGroup(context: Context, name: String, members: Collection<String>): Promise<Unit, Exception> {
|
||||
// Prepare
|
||||
|
Loading…
Reference in New Issue
Block a user