mirror of
https://github.com/oxen-io/session-android.git
synced 2025-04-16 05:01:26 +00:00
fix: only one wrapper and proper encoding now
This commit is contained in:
parent
766266d54d
commit
7f95f0f2d6
@ -204,7 +204,7 @@ class ClosedGroupUpdateMessageSendJobV2 private constructor(parameters: Paramete
|
|||||||
closedGroupUpdate.type = SignalServiceProtos.ClosedGroupUpdateV2.Type.ENCRYPTION_KEY_PAIR
|
closedGroupUpdate.type = SignalServiceProtos.ClosedGroupUpdateV2.Type.ENCRYPTION_KEY_PAIR
|
||||||
closedGroupUpdate.addAllWrappers(kind.wrappers.map { it.toProto() })
|
closedGroupUpdate.addAllWrappers(kind.wrappers.map { it.toProto() })
|
||||||
if (kind.targetUser != null) {
|
if (kind.targetUser != null) {
|
||||||
closedGroupUpdate.publicKey = ByteString.copyFrom(destination.toByteArray())
|
closedGroupUpdate.publicKey = ByteString.copyFrom(Hex.fromStringCondensed(destination))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Kind.Leave -> {
|
Kind.Leave -> {
|
||||||
|
@ -103,6 +103,9 @@ object ClosedGroupsProtocolV2 {
|
|||||||
val groupDB = DatabaseFactory.getGroupDatabase(context)
|
val groupDB = DatabaseFactory.getGroupDatabase(context)
|
||||||
val groupID = doubleEncodeGroupID(groupPublicKey)
|
val groupID = doubleEncodeGroupID(groupPublicKey)
|
||||||
val group = groupDB.getGroup(groupID).orNull()
|
val group = groupDB.getGroup(groupID).orNull()
|
||||||
|
val updatedMembers = group.members.map { it.serialize() }.toSet() - userPublicKey
|
||||||
|
val admins = group.admins.map { it.serialize() }
|
||||||
|
val name = group.title
|
||||||
val sentTime = System.currentTimeMillis()
|
val sentTime = System.currentTimeMillis()
|
||||||
if (group == null) {
|
if (group == null) {
|
||||||
Log.d("Loki", "Can't leave nonexistent closed group.")
|
Log.d("Loki", "Can't leave nonexistent closed group.")
|
||||||
@ -114,6 +117,9 @@ object ClosedGroupsProtocolV2 {
|
|||||||
job.setContext(context)
|
job.setContext(context)
|
||||||
job.onRun() // Run the job immediately
|
job.onRun() // Run the job immediately
|
||||||
// Notify the user
|
// Notify the user
|
||||||
|
val infoType = GroupContext.Type.QUIT
|
||||||
|
val threadID = DatabaseFactory.getThreadDatabase(context).getOrCreateThreadIdFor(Recipient.from(context, Address.fromSerialized(groupID), false))
|
||||||
|
insertOutgoingInfoMessage(context, groupID, infoType, name, updatedMembers, admins, threadID, sentTime)
|
||||||
// Remove the group private key and unsubscribe from PNs
|
// Remove the group private key and unsubscribe from PNs
|
||||||
disableLocalGroupAndUnsubscribe(context, apiDB, groupPublicKey, groupDB, groupID, userPublicKey)
|
disableLocalGroupAndUnsubscribe(context, apiDB, groupPublicKey, groupDB, groupID, userPublicKey)
|
||||||
deferred.resolve(Unit)
|
deferred.resolve(Unit)
|
||||||
@ -453,7 +459,7 @@ object ClosedGroupsProtocolV2 {
|
|||||||
Log.d("Loki", "Couldn't get encryption key pair for closed group.")
|
Log.d("Loki", "Couldn't get encryption key pair for closed group.")
|
||||||
} else {
|
} else {
|
||||||
for (user in updateMembers) {
|
for (user in updateMembers) {
|
||||||
sendEncryptionKeyPair(context, groupPublicKey, encryptionKeyPair, newMembers, targetUser = user, force = false)
|
sendEncryptionKeyPair(context, groupPublicKey, encryptionKeyPair, setOf(user), targetUser = user, force = false)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -619,7 +625,7 @@ object ClosedGroupsProtocolV2 {
|
|||||||
val groupDB = DatabaseFactory.getGroupDatabase(context)
|
val groupDB = DatabaseFactory.getGroupDatabase(context)
|
||||||
val groupID = when {
|
val groupID = when {
|
||||||
groupPublicKey.isNotEmpty() -> groupPublicKey
|
groupPublicKey.isNotEmpty() -> groupPublicKey
|
||||||
!closedGroupUpdate.publicKey.isEmpty -> closedGroupUpdate.publicKey.toStringUtf8()
|
!closedGroupUpdate.publicKey.isEmpty -> closedGroupUpdate.publicKey.toByteArray().toHexString()
|
||||||
else -> ""
|
else -> ""
|
||||||
}.let {
|
}.let {
|
||||||
doubleEncodeGroupID(it)
|
doubleEncodeGroupID(it)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user