mirror of
https://github.com/oxen-io/session-android.git
synced 2024-11-27 12:05:22 +00:00
Closed group protocol stub update method.
This commit is contained in:
parent
3e05a616ce
commit
64f3bfd41d
@ -22,9 +22,13 @@ import org.thoughtcrime.securesms.database.Address
|
|||||||
import org.thoughtcrime.securesms.database.DatabaseFactory
|
import org.thoughtcrime.securesms.database.DatabaseFactory
|
||||||
import org.thoughtcrime.securesms.groups.GroupManager
|
import org.thoughtcrime.securesms.groups.GroupManager
|
||||||
import org.thoughtcrime.securesms.loki.dialogs.GroupEditingOptionsBottomSheet
|
import org.thoughtcrime.securesms.loki.dialogs.GroupEditingOptionsBottomSheet
|
||||||
|
import org.thoughtcrime.securesms.loki.protocol.ClosedGroupsProtocol
|
||||||
import org.thoughtcrime.securesms.mms.GlideApp
|
import org.thoughtcrime.securesms.mms.GlideApp
|
||||||
import org.thoughtcrime.securesms.recipients.Recipient
|
import org.thoughtcrime.securesms.recipients.Recipient
|
||||||
|
import org.thoughtcrime.securesms.util.GroupUtil
|
||||||
import org.whispersystems.signalservice.api.crypto.ProfileCipher
|
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 EXTRA_GROUP_ID = "GROUP_ID"
|
||||||
const val REQ_CODE_ADD_USERS = 124
|
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()
|
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()
|
finish()
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -1,6 +1,7 @@
|
|||||||
package org.thoughtcrime.securesms.loki.protocol
|
package org.thoughtcrime.securesms.loki.protocol
|
||||||
|
|
||||||
import android.content.Context
|
import android.content.Context
|
||||||
|
import android.graphics.Bitmap
|
||||||
import android.util.Log
|
import android.util.Log
|
||||||
import com.google.protobuf.ByteString
|
import com.google.protobuf.ByteString
|
||||||
import org.thoughtcrime.securesms.ApplicationContext
|
import org.thoughtcrime.securesms.ApplicationContext
|
||||||
@ -182,6 +183,17 @@ 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.
|
||||||
|
// 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
|
@JvmStatic
|
||||||
public fun requestSenderKey(context: Context, groupPublicKey: String, senderPublicKey: String) {
|
public fun requestSenderKey(context: Context, groupPublicKey: String, senderPublicKey: String) {
|
||||||
// Establish session if needed
|
// Establish session if needed
|
||||||
|
Loading…
Reference in New Issue
Block a user