diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/service/namecoin/NamecoinSettings.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/service/namecoin/NamecoinSettings.kt index c453622ee..4855b493f 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/service/namecoin/NamecoinSettings.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/service/namecoin/NamecoinSettings.kt @@ -20,6 +20,7 @@ */ package com.vitorpamplona.amethyst.service.namecoin +import androidx.compose.runtime.Stable import com.vitorpamplona.quartz.nip05DnsIdentifiers.namecoin.ElectrumxServer import kotlinx.serialization.Serializable @@ -31,6 +32,7 @@ import kotlinx.serialization.Serializable * control over which ElectrumX servers observe their name lookups. */ @Serializable +@Stable data class NamecoinSettings( /** Whether Namecoin resolution is enabled at all. */ val enabled: Boolean = true, diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/settings/NamecoinSettingsScreen.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/settings/NamecoinSettingsScreen.kt index 3bd232550..870570194 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/settings/NamecoinSettingsScreen.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/settings/NamecoinSettingsScreen.kt @@ -21,9 +21,7 @@ package com.vitorpamplona.amethyst.ui.screen.loggedIn.settings import androidx.compose.foundation.layout.Column -import androidx.compose.foundation.layout.Spacer import androidx.compose.foundation.layout.fillMaxSize -import androidx.compose.foundation.layout.height import androidx.compose.foundation.layout.padding import androidx.compose.foundation.rememberScrollState import androidx.compose.foundation.verticalScroll @@ -63,8 +61,6 @@ fun NamecoinSettingsScreen( .verticalScroll(rememberScrollState()) .padding(horizontal = 10.dp), ) { - Spacer(Modifier.height(16.dp)) - NamecoinSettingsSection( settings = namecoinSettings, onToggleEnabled = { enabled -> @@ -80,8 +76,6 @@ fun NamecoinSettingsScreen( scope.launch { namecoinPrefs.reset() } }, ) - - Spacer(Modifier.height(16.dp)) } } } diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/settings/NamecoinSettingsSection.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/settings/NamecoinSettingsSection.kt index 9838b9fcd..db747e138 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/settings/NamecoinSettingsSection.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/settings/NamecoinSettingsSection.kt @@ -41,8 +41,6 @@ import androidx.compose.material.icons.filled.Add import androidx.compose.material.icons.filled.Close import androidx.compose.material.icons.filled.Lock import androidx.compose.material.icons.filled.Refresh -import androidx.compose.material3.Card -import androidx.compose.material3.CardDefaults import androidx.compose.material3.HorizontalDivider import androidx.compose.material3.Icon import androidx.compose.material3.IconButton @@ -91,77 +89,64 @@ fun NamecoinSettingsSection( onReset: () -> Unit, modifier: Modifier = Modifier, ) { - Card( - modifier = - modifier - .fillMaxWidth() - .padding(horizontal = 16.dp, vertical = 8.dp), - shape = RoundedCornerShape(12.dp), - elevation = CardDefaults.cardElevation(defaultElevation = 1.dp), - colors = - CardDefaults.cardColors( - containerColor = MaterialTheme.colorScheme.surfaceVariant.copy(alpha = 0.3f), - ), - ) { - Column(modifier = Modifier.padding(16.dp)) { - // ── Section header ───────────────────────────────────────── - SectionHeader(enabled = settings.enabled, onToggle = onToggleEnabled) + Column(modifier = modifier.padding(16.dp)) { + // ── Section header ───────────────────────────────────────── + SectionHeader(enabled = settings.enabled, onToggle = onToggleEnabled) - AnimatedVisibility( - visible = settings.enabled, - enter = expandVertically(), - exit = shrinkVertically(), - ) { - Column { - Spacer(Modifier.height(12.dp)) + AnimatedVisibility( + visible = settings.enabled, + enter = expandVertically(), + exit = shrinkVertically(), + ) { + Column { + Spacer(Modifier.height(12.dp)) - // ── Explanation ───────────────────────────────────── - Text( - "Namecoin names (.bit, d/, id/) are resolved via ElectrumX servers. " + - "By default, public community servers are used. " + - "For maximum privacy, add your own server below — when custom " + - "servers are set, the defaults are completely ignored.", - style = MaterialTheme.typography.bodySmall, - color = MaterialTheme.colorScheme.onSurfaceVariant, - ) + // ── Explanation ───────────────────────────────────── + Text( + "Namecoin names (.bit, d/, id/) are resolved via ElectrumX servers. " + + "By default, public community servers are used. " + + "For maximum privacy, add your own server below — when custom " + + "servers are set, the defaults are completely ignored.", + style = MaterialTheme.typography.bodySmall, + color = MaterialTheme.colorScheme.onSurfaceVariant, + ) - Spacer(Modifier.height(16.dp)) + Spacer(Modifier.height(16.dp)) - // ── Active servers display ───────────────────────── - ActiveServersDisplay(settings = settings) + // ── Active servers display ───────────────────────── + ActiveServersDisplay(settings = settings) - Spacer(Modifier.height(12.dp)) - HorizontalDivider( - color = MaterialTheme.colorScheme.outlineVariant.copy(alpha = 0.5f), - ) - Spacer(Modifier.height(12.dp)) + Spacer(Modifier.height(12.dp)) + HorizontalDivider( + color = MaterialTheme.colorScheme.outlineVariant.copy(alpha = 0.5f), + ) + Spacer(Modifier.height(12.dp)) - // ── Custom servers list ──────────────────────────── - CustomServersList( - servers = settings.customServers, - onRemove = onRemoveServer, - ) + // ── Custom servers list ──────────────────────────── + CustomServersList( + servers = settings.customServers, + onRemove = onRemoveServer, + ) - // ── Add server input ─────────────────────────────── - AddServerInput(onAdd = onAddServer) + // ── Add server input ─────────────────────────────── + AddServerInput(onAdd = onAddServer) - Spacer(Modifier.height(8.dp)) + Spacer(Modifier.height(8.dp)) - // ── Reset button ─────────────────────────────────── - if (settings.hasCustomServers) { - Row( - modifier = Modifier.fillMaxWidth(), - horizontalArrangement = Arrangement.End, - ) { - TextButton(onClick = onReset) { - Icon( - Icons.Default.Refresh, - contentDescription = null, - modifier = Modifier.size(16.dp), - ) - Spacer(Modifier.width(4.dp)) - Text("Reset to defaults") - } + // ── Reset button ─────────────────────────────────── + if (settings.hasCustomServers) { + Row( + modifier = Modifier.fillMaxWidth(), + horizontalArrangement = Arrangement.End, + ) { + TextButton(onClick = onReset) { + Icon( + Icons.Default.Refresh, + contentDescription = null, + modifier = Modifier.size(16.dp), + ) + Spacer(Modifier.width(4.dp)) + Text("Reset to defaults") } } }