Improve performance of first send to large group.

This commit is contained in:
Cody Henthorne
2026-02-03 15:26:27 -05:00
committed by GitHub
parent 9369cafd38
commit 8353ad4962
3 changed files with 110 additions and 5 deletions

View File

@@ -296,6 +296,18 @@ class InternalConversationSettingsFragment : ComposeFragment(), InternalConversa
SignalDatabase.senderKeyShared.deleteAllFor(group.distributionId)
}
override fun clearSenderKeyAndArchiveSessions(recipientId: RecipientId) {
clearSenderKey(recipientId)
val group = SignalDatabase.groups.getGroup(recipientId).orNull()
if (group == null) {
Log.w(TAG, "Couldn't find group for recipientId: $recipientId")
return
}
group.members.forEach { archiveSessions(it) }
}
class InternalViewModel(
val recipientId: RecipientId
) : ViewModel(), RecipientForeverObserver {

View File

@@ -33,6 +33,7 @@ private enum class Dialog {
NONE,
DISABLE_PROFILE_SHARING,
CLEAR_SENDER_KEY,
CLEAR_SENDER_KEY_AND_ARCHIVE_SESSIONS,
DELETE_SESSIONS,
ARCHIVE_SESSIONS,
DELETE_AVATAR,
@@ -207,6 +208,16 @@ fun InternalConversationSettingsScreen(
}
)
}
item {
Rows.TextRow(
text = "Clear sender key and archive sessions",
label = "Resets any sender key state and archives all sessions for group members, will force creating new sessions and re-distributing sender key material.",
onClick = {
dialog = Dialog.CLEAR_SENDER_KEY_AND_ARCHIVE_SESSIONS
}
)
}
} else {
item {
Rows.TextRow(
@@ -375,6 +386,9 @@ private fun rememberOnConfirm(
Dialog.CLEAR_SENDER_KEY -> {
{ callbacks.clearSenderKey(state.recipientId) }
}
Dialog.CLEAR_SENDER_KEY_AND_ARCHIVE_SESSIONS -> {
{ callbacks.clearSenderKeyAndArchiveSessions(state.recipientId) }
}
}
}
}
@@ -473,6 +487,7 @@ interface InternalConversationSettingsScreenCallbacks {
fun splitAndCreateThreads(recipientId: RecipientId) = Unit
fun splitWithoutCreatingThreads(recipientId: RecipientId) = Unit
fun clearSenderKey(recipientId: RecipientId) = Unit
fun clearSenderKeyAndArchiveSessions(recipientId: RecipientId) = Unit
object Empty : InternalConversationSettingsScreenCallbacks
}