Inline deleteSync and SSREv2 capabilities.

This commit is contained in:
Greyson Parrelli
2025-08-15 12:23:02 -04:00
committed by Jeffrey Starke
parent 8df8cdf28d
commit 1c7f6a68e4
12 changed files with 33 additions and 84 deletions

View File

@@ -29,7 +29,6 @@ import androidx.compose.runtime.Composable
import androidx.compose.runtime.LaunchedEffect
import androidx.compose.runtime.getValue
import androidx.compose.runtime.mutableIntStateOf
import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.remember
import androidx.compose.runtime.setValue
import androidx.compose.ui.Alignment
@@ -74,20 +73,14 @@ class InternalStorageServicePlaygroundFragment : ComposeFragment() {
val storageRecords by viewModel.storageRecords
val storageInsights by viewModel.storageInsights
val oneOffEvent by viewModel.oneOffEvents
var forceSsreToggled by remember { mutableStateOf(SignalStore.internal.forceSsre2Capability) }
Screen(
onBackPressed = { findNavController().popBackStack() },
manifest = manifest,
storageRecords = storageRecords,
storageInsights = storageInsights,
oneOffEvent = oneOffEvent,
forceSsreCapability = forceSsreToggled,
onForceSsreToggled = { checked ->
SignalStore.internal.forceSsre2Capability = checked
forceSsreToggled = checked
},
onViewTabSelected = { viewModel.onViewTabSelected() }
onViewTabSelected = { viewModel.onViewTabSelected() },
onBackPressed = { findNavController().popBackStack() }
)
}
}
@@ -98,9 +91,7 @@ fun Screen(
manifest: SignalStorageManifest,
storageRecords: List<SignalStorageRecord>,
storageInsights: StorageInsights,
forceSsreCapability: Boolean,
oneOffEvent: OneOffEvent,
onForceSsreToggled: (Boolean) -> Unit = {},
onViewTabSelected: () -> Unit = {},
onBackPressed: () -> Unit = {}
) {
@@ -141,10 +132,7 @@ fun Screen(
) { contentPadding ->
Surface(modifier = Modifier.padding(contentPadding)) {
when (tabIndex) {
0 -> ToolScreen(
forceSsreCapability = forceSsreCapability,
onForceSsreToggled = onForceSsreToggled
)
0 -> ToolScreen()
1 -> ViewScreen(
manifest = manifest,
storageRecords = storageRecords,
@@ -157,10 +145,7 @@ fun Screen(
}
@Composable
fun ToolScreen(
forceSsreCapability: Boolean,
onForceSsreToggled: (Boolean) -> Unit = {}
) {
fun ToolScreen() {
Column(
horizontalAlignment = Alignment.CenterHorizontally,
modifier = Modifier.fillMaxWidth()
@@ -184,12 +169,6 @@ fun ToolScreen(
ActionRow("Clear initial master key", "Sets it to null.") {
SignalStore.svr.masterKeyForInitialDataRestore = null
}
Rows.ToggleRow(
text = "Force SSRE2 Capability",
checked = forceSsreCapability,
onCheckChanged = onForceSsreToggled
)
}
}
@@ -381,7 +360,6 @@ private fun RunButton(onClick: () -> Unit) {
fun ScreenPreview() {
Previews.Preview {
Screen(
forceSsreCapability = true,
manifest = SignalStorageManifest.EMPTY,
storageRecords = emptyList(),
storageInsights = StorageInsights(),

View File

@@ -7,12 +7,7 @@ package org.thoughtcrime.securesms.components.settings.conversation
import androidx.annotation.WorkerThread
import androidx.compose.runtime.Immutable
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.text.AnnotatedString
import androidx.compose.ui.text.SpanStyle
import androidx.compose.ui.text.buildAnnotatedString
import androidx.compose.ui.text.font.FontStyle
import androidx.compose.ui.text.withStyle
import org.signal.core.util.Base64
import org.signal.core.util.Hex
import org.thoughtcrime.securesms.components.settings.app.subscription.InAppPaymentsRepository
@@ -102,17 +97,19 @@ data class InternalConversationSettingsState(
} else {
val capabilities: RecipientRecord.Capabilities? = SignalDatabase.recipients.getCapabilities(recipient.id)
if (capabilities != null) {
val style: SpanStyle = when (capabilities.storageServiceEncryptionV2) {
Recipient.Capability.SUPPORTED -> SpanStyle(color = Color(0, 150, 0))
Recipient.Capability.NOT_SUPPORTED -> SpanStyle(color = Color.Red)
Recipient.Capability.UNKNOWN -> SpanStyle(fontStyle = FontStyle.Italic)
}
buildAnnotatedString {
withStyle(style = style) {
append("SSREv2")
}
}
AnnotatedString("No capabilities right now.")
// Left as an example in case we add one in the future
// val style: SpanStyle = when (capabilities.storageServiceEncryptionV2) {
// Recipient.Capability.SUPPORTED -> SpanStyle(color = Color(0, 150, 0))
// Recipient.Capability.NOT_SUPPORTED -> SpanStyle(color = Color.Red)
// Recipient.Capability.UNKNOWN -> SpanStyle(fontStyle = FontStyle.Italic)
// }
//
// buildAnnotatedString {
// withStyle(style = style) {
// append("SSREv2")
// }
// }
} else {
AnnotatedString("Recipient not found!")
}