mirror of
https://github.com/oxen-io/session-android.git
synced 2023-12-14 02:53:01 +01:00
feat: use new explicit groups
This commit is contained in:
parent
05fef11889
commit
6a8e0ae195
3 changed files with 17 additions and 19 deletions
|
@ -1109,7 +1109,7 @@ public class ConversationActivity extends PassphraseRequiredActionBarActivity
|
|||
}
|
||||
try {
|
||||
if (isSSKBasedClosedGroup) {
|
||||
ClosedGroupsProtocolV2.leave(this, groupPublicKey);
|
||||
ClosedGroupsProtocolV2.explicitLeave(this, groupPublicKey);
|
||||
initializeEnabledCheck();
|
||||
} else if (ClosedGroupsProtocol.leaveLegacyGroup(this, groupRecipient)) {
|
||||
initializeEnabledCheck();
|
||||
|
|
|
@ -277,24 +277,22 @@ class EditClosedGroupActivity : PassphraseRequiredActionBarActivity() {
|
|||
isLoading = true
|
||||
loaderContainer.fadeIn()
|
||||
val promise: Promise<Any, Exception> = if (!members.contains(Recipient.from(this, Address.fromSerialized(userPublicKey), false))) {
|
||||
ClosedGroupsProtocolV2.leave(this, groupPublicKey!!)
|
||||
ClosedGroupsProtocolV2.explicitLeave(this, groupPublicKey!!)
|
||||
} else {
|
||||
// TODO: uncomment when we switch to sending new explicit updates after clients update
|
||||
// task {
|
||||
// val name =
|
||||
// if (hasNameChanged) ClosedGroupsProtocolV2.explicitNameChange(this@EditClosedGroupActivity,groupPublicKey!!,name)
|
||||
// else Promise.of(Unit)
|
||||
// name.get()
|
||||
// members.filterNot { it in originalMembers }.let { adds ->
|
||||
// if (adds.isNotEmpty()) ClosedGroupsProtocolV2.explicitAddMembers(this@EditClosedGroupActivity, groupPublicKey!!, adds.map { it.address.serialize() })
|
||||
// else Promise.of(Unit)
|
||||
// }.get()
|
||||
// originalMembers.filterNot { it in members }.let { removes ->
|
||||
// if (removes.isNotEmpty()) ClosedGroupsProtocolV2.explicitRemoveMembers(this@EditClosedGroupActivity, groupPublicKey!!, removes.map { it.address.serialize() })
|
||||
// else Promise.of(Unit)
|
||||
// }.get()
|
||||
// }
|
||||
ClosedGroupsProtocolV2.update(this, groupPublicKey!!, members.map { it.address.serialize() }, name)
|
||||
task {
|
||||
val name =
|
||||
if (hasNameChanged) ClosedGroupsProtocolV2.explicitNameChange(this@EditClosedGroupActivity,groupPublicKey!!,name)
|
||||
else Promise.of(Unit)
|
||||
name.get()
|
||||
members.filterNot { it in originalMembers }.let { adds ->
|
||||
if (adds.isNotEmpty()) ClosedGroupsProtocolV2.explicitAddMembers(this@EditClosedGroupActivity, groupPublicKey!!, adds.map { it.address.serialize() })
|
||||
else Promise.of(Unit)
|
||||
}.get()
|
||||
originalMembers.filterNot { it in members }.let { removes ->
|
||||
if (removes.isNotEmpty()) ClosedGroupsProtocolV2.explicitRemoveMembers(this@EditClosedGroupActivity, groupPublicKey!!, removes.map { it.address.serialize() })
|
||||
else Promise.of(Unit)
|
||||
}.get()
|
||||
}
|
||||
}
|
||||
promise.successUi {
|
||||
loaderContainer.fadeOut()
|
||||
|
|
|
@ -358,7 +358,7 @@ class HomeActivity : PassphraseRequiredActionBarActivity, ConversationClickListe
|
|||
isSSKBasedClosedGroup = false
|
||||
}
|
||||
if (isSSKBasedClosedGroup) {
|
||||
ClosedGroupsProtocolV2.leave(context, groupPublicKey!!)
|
||||
ClosedGroupsProtocolV2.explicitLeave(context, groupPublicKey!!)
|
||||
} else if (!ClosedGroupsProtocol.leaveLegacyGroup(context, recipient)) {
|
||||
Toast.makeText(context, R.string.activity_home_leaving_group_failed_message, Toast.LENGTH_LONG).show()
|
||||
return@launch
|
||||
|
|
Loading…
Reference in a new issue