Fill in stub

This commit is contained in:
nielsandriesse 2020-08-18 09:01:55 +10:00
parent 5b641f4415
commit fdec8eae4b
2 changed files with 19 additions and 10 deletions

View File

@ -247,7 +247,8 @@ class EditClosedGroupActivity : PassphraseRequiredActionBarActivity() {
if (isSSKBasedClosedGroup) { if (isSSKBasedClosedGroup) {
//TODO AC: Should it use "groupPublicKey" or "groupID"? //TODO AC: Should it use "groupPublicKey" or "groupID"?
ClosedGroupsProtocol.updateGroup(this, groupPublicKey!!, finalGroupMembers, null, groupDisplayName, finalGroupAdmins) ClosedGroupsProtocol.update(this, groupPublicKey!!, finalGroupMembers.map { it.address.serialize() },
groupDisplayName, finalGroupAdmins.map { it.address.serialize() })
} else { } else {
GroupManager.updateGroup(this, groupID, finalGroupMembers, null, groupDisplayName, finalGroupAdmins) GroupManager.updateGroup(this, groupID, finalGroupMembers, null, groupDisplayName, finalGroupAdmins)
} }

View File

@ -184,15 +184,23 @@ object ClosedGroupsProtocol {
insertOutgoingInfoMessage(context, groupID, GroupContext.Type.QUIT, name, members, admins, threadID) insertOutgoingInfoMessage(context, groupID, GroupContext.Type.QUIT, name, members, admins, threadID)
} }
//TODO AC: This is a reflection of GroupManager's update API. public fun update(context: Context, groupPublicKey: String, members: Collection<String>, name: String, admins: Collection<String>) {
// It needs a valid implementation and probably the signature should be refactored a bit. val groupDB = DatabaseFactory.getGroupDatabase(context)
public fun updateGroup(context: Context, val groupID = doubleEncodeGroupID(groupPublicKey)
groupPublicKey: String, if (groupDB.getGroup(groupID).orNull() == null) {
members: Collection<Recipient>, Log.d("Loki", "Can't update nonexistent closed group.")
avatar: Bitmap?, return
name: String, }
admins: Collection<Recipient>) { // Send the update to the group
// STUB val closedGroupUpdateKind = ClosedGroupUpdateMessageSendJob.Kind.Info(Hex.fromStringCondensed(groupPublicKey),
name, setOf(), members.map { Hex.fromStringCondensed(it) }, admins.map { Hex.fromStringCondensed(it) })
val job = ClosedGroupUpdateMessageSendJob(groupPublicKey, closedGroupUpdateKind)
ApplicationContext.getInstance(context).jobManager.add(job)
// Update the group
groupDB.updateMembers(groupID, members.map { Address.fromSerialized(it) })
// Notify the user
val threadID = DatabaseFactory.getThreadDatabase(context).getThreadIdFor(Recipient.from(context, Address.fromSerialized(groupID), false))
insertOutgoingInfoMessage(context, groupID, GroupContext.Type.UPDATE, name, members, admins, threadID)
} }
@JvmStatic @JvmStatic