mirror of
https://github.com/vitorpamplona/amethyst.git
synced 2026-08-08 23:54:39 +00:00
feat(desktop): wire NamecoinSettingsSection into Settings screen
The desktop client already ships DesktopNamecoinPreferences, the DesktopNamecoinNameService that consumes them, and the NamecoinSettingsSection composable that's a port of the Android UI. The section just wasn't surfaced in the desktop Settings screen. This wires NamecoinSettingsSection into RelaySettingsScreen, between the Tor section and the Developer / Relay sections. Preferences come from the namecoinPreferences parameter that the deck container already passes in, and fall back to LocalNamecoinPreferences when called from another caller. User-visible behaviour: the .bit / d/ / id/ ElectrumX server settings (master toggle, custom servers, defaults indicator, add/remove, reset) are now reachable from desktop Settings and persist via java.util.prefs.Preferences.
This commit is contained in:
@@ -118,6 +118,7 @@ import com.vitorpamplona.amethyst.desktop.ui.profile.ProfileInfoCard
|
||||
import com.vitorpamplona.amethyst.desktop.ui.relay.LocalRelayCategories
|
||||
import com.vitorpamplona.amethyst.desktop.ui.relay.RelayStatusCard
|
||||
import com.vitorpamplona.amethyst.desktop.ui.settings.MediaServerSettings
|
||||
import com.vitorpamplona.amethyst.desktop.ui.settings.NamecoinSettingsSection
|
||||
import com.vitorpamplona.quartz.nip01Core.relay.client.reqs.SubscriptionListener
|
||||
import com.vitorpamplona.quartz.nip01Core.relay.filters.Filter
|
||||
import com.vitorpamplona.quartz.nip01Core.relay.normalizer.NormalizedRelayUrl
|
||||
@@ -1624,6 +1625,31 @@ fun RelaySettingsScreen(
|
||||
HorizontalDivider()
|
||||
Spacer(Modifier.height(24.dp))
|
||||
|
||||
// Namecoin Settings (ElectrumX servers for .bit / d/ / id/ resolution)
|
||||
val namecoinPrefsHere = namecoinPreferences ?: LocalNamecoinPreferences.current
|
||||
if (namecoinPrefsHere != null) {
|
||||
val namecoinScope = rememberCoroutineScope()
|
||||
val namecoinSettings by namecoinPrefsHere.settings.collectAsState()
|
||||
NamecoinSettingsSection(
|
||||
settings = namecoinSettings,
|
||||
onToggleEnabled = { enabled ->
|
||||
namecoinScope.launch { namecoinPrefsHere.setEnabled(enabled) }
|
||||
},
|
||||
onAddServer = { server ->
|
||||
namecoinScope.launch { namecoinPrefsHere.addServer(server) }
|
||||
},
|
||||
onRemoveServer = { server ->
|
||||
namecoinScope.launch { namecoinPrefsHere.removeServer(server) }
|
||||
},
|
||||
onReset = {
|
||||
namecoinScope.launch { namecoinPrefsHere.reset() }
|
||||
},
|
||||
)
|
||||
Spacer(Modifier.height(24.dp))
|
||||
HorizontalDivider()
|
||||
Spacer(Modifier.height(24.dp))
|
||||
}
|
||||
|
||||
// Developer Settings Section (only in debug mode)
|
||||
if (DebugConfig.isDebugMode) {
|
||||
com.vitorpamplona.amethyst.desktop.ui
|
||||
|
||||
Reference in New Issue
Block a user