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