Debug message sending

This commit is contained in:
nielsandriesse 2020-08-11 09:59:07 +10:00
parent 8e14c7abb6
commit 80bbeee7ce
2 changed files with 13 additions and 4 deletions

View File

@ -124,7 +124,8 @@ class CreateClosedGroupActivity : PassphraseRequiredActionBarActivity(), MemberC
if (selectedMembers.count() > 49) { // Minus one because we're going to include self later 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() 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) val userPublicKey = TextSecurePreferences.getLocalNumber(this)
ClosedGroupsProtocol.createClosedGroup(this, name.toString(), selectedMembers + setOf( userPublicKey ))
} }
private fun createLegacyClosedGroup() { private fun createLegacyClosedGroup() {

View File

@ -6,7 +6,9 @@ import nl.komponents.kovenant.Promise
import org.thoughtcrime.securesms.ApplicationContext import org.thoughtcrime.securesms.ApplicationContext
import org.thoughtcrime.securesms.database.Address import org.thoughtcrime.securesms.database.Address
import org.thoughtcrime.securesms.database.DatabaseFactory import org.thoughtcrime.securesms.database.DatabaseFactory
import org.thoughtcrime.securesms.database.ThreadDatabase
import org.thoughtcrime.securesms.loki.utilities.recipient import org.thoughtcrime.securesms.loki.utilities.recipient
import org.thoughtcrime.securesms.mms.OutgoingMediaMessage
import org.thoughtcrime.securesms.recipients.Recipient import org.thoughtcrime.securesms.recipients.Recipient
import org.thoughtcrime.securesms.sms.MessageSender import org.thoughtcrime.securesms.sms.MessageSender
import org.thoughtcrime.securesms.util.GroupUtil import org.thoughtcrime.securesms.util.GroupUtil
@ -57,7 +59,9 @@ object ClosedGroupsProtocol {
// Add the group to the user's set of public keys to poll for // Add the group to the user's set of public keys to poll for
DatabaseFactory.getSSKDatabase(context).setClosedGroupPrivateKey(groupPublicKey, groupKeyPair.hexEncodedPrivateKey) DatabaseFactory.getSSKDatabase(context).setClosedGroupPrivateKey(groupPublicKey, groupKeyPair.hexEncodedPrivateKey)
// Notify the user // Notify the user
// TODO: Implement val infoMessage = OutgoingMediaMessage(Recipient.from(context, Address.fromSerialized(groupID), false), "Test", listOf(), System.currentTimeMillis(),
0, 0, ThreadDatabase.DistributionTypes.CONVERSATION, null, listOf(), listOf(), listOf(), listOf())
MessageSender.send(context, infoMessage, -1, false, null)
// Return // Return
return Promise.of(Unit) return Promise.of(Unit)
} }
@ -349,8 +353,12 @@ object ClosedGroupsProtocol {
if (GroupUtil.isOpenGroup(groupID)) { if (GroupUtil.isOpenGroup(groupID)) {
return listOf( Address.fromSerialized(groupID) ) return listOf( Address.fromSerialized(groupID) )
} else { } else {
// TODO: Shared sender keys val groupPublicKey = GroupUtil.getDecodedId(groupID).toHexString()
if (DatabaseFactory.getSSKDatabase(context).isSSKBasedClosedGroup(groupPublicKey)) {
return listOf( Address.fromSerialized(groupPublicKey) )
} else {
return DatabaseFactory.getGroupDatabase(context).getGroupMembers(groupID, false).map { it.address } return DatabaseFactory.getGroupDatabase(context).getGroupMembers(groupID, false).map { it.address }
}
/* /*
return FileServerAPI.shared.getDeviceLinks(members.map { it.address.serialize() }.toSet()).map { return FileServerAPI.shared.getDeviceLinks(members.map { it.address.serialize() }.toSet()).map {
val result = members.flatMap { member -> val result = members.flatMap { member ->