Closed group protocol stub update method.

This commit is contained in:
Anton Chekulaev 2020-08-17 10:53:02 +10:00
parent 3e05a616ce
commit 64f3bfd41d
2 changed files with 32 additions and 1 deletions

View File

@ -22,9 +22,13 @@ 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.protocol.ClosedGroupsProtocol
import org.thoughtcrime.securesms.mms.GlideApp
import org.thoughtcrime.securesms.recipients.Recipient
import org.thoughtcrime.securesms.util.GroupUtil
import org.whispersystems.signalservice.api.crypto.ProfileCipher
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
@ -226,7 +230,22 @@ class EditClosedGroupActivity : PassphraseRequiredActionBarActivity() {
return Toast.makeText(this, R.string.activity_edit_closed_group_too_many_group_members_error, Toast.LENGTH_LONG).show()
}
GroupManager.updateGroup(this, groupID, finalGroupMembers, null, groupDisplayName, finalGroupAdmins)
var isSSKBasedClosedGroup: Boolean
var groupPublicKey: String?
try {
groupPublicKey = GroupUtil.getDecodedId(groupID).toHexString()
isSSKBasedClosedGroup = DatabaseFactory.getSSKDatabase(this).isSSKBasedClosedGroup(groupPublicKey)
} catch (e: IOException) {
groupPublicKey = null
isSSKBasedClosedGroup = false
}
if (isSSKBasedClosedGroup) {
//TODO AC: Should it use "groupPublicKey" or "groupID"?
ClosedGroupsProtocol.updateGroup(this, groupPublicKey!!, finalGroupMembers, null, groupDisplayName, finalGroupAdmins)
} else {
GroupManager.updateGroup(this, groupID, finalGroupMembers, null, groupDisplayName, finalGroupAdmins)
}
finish()
}
}

View File

@ -1,6 +1,7 @@
package org.thoughtcrime.securesms.loki.protocol
import android.content.Context
import android.graphics.Bitmap
import android.util.Log
import com.google.protobuf.ByteString
import org.thoughtcrime.securesms.ApplicationContext
@ -182,6 +183,17 @@ object ClosedGroupsProtocol {
insertOutgoingInfoMessage(context, groupID, GroupContext.Type.QUIT, name, members, admins, threadID)
}
//TODO AC: This is a reflection of GroupManager's update API.
// It needs a valid implementation and probably the signature should be refactored a bit.
public fun updateGroup(context: Context,
groupPublicKey: String,
members: Collection<Recipient>,
avatar: Bitmap?,
name: String,
admins: Collection<Recipient>) {
// STUB
}
@JvmStatic
public fun requestSenderKey(context: Context, groupPublicKey: String, senderPublicKey: String) {
// Establish session if needed