From c86f76b23e82683cb9fd9c8a93440e287aea7fcc Mon Sep 17 00:00:00 2001 From: Claude Date: Fri, 14 Aug 2026 23:24:05 +0000 Subject: [PATCH] feat: default new accounts to always AUTH with relays New logins started on RelayAuthPolicy.CUSTOM, which auto-authenticates only for own relays/venues and follows and prompts for everything else. Start them on ALWAYS instead, so a fresh account answers every relay that asks (still gated by the first-party check and the blocked-relay list). Only the AccountSettings constructor default moves, so this applies to accounts created from here on. Existing accounts keep their saved policy, and prefs written before the key existed still fall back to CUSTOM. --- .../main/java/com/vitorpamplona/amethyst/LocalPreferences.kt | 2 ++ .../java/com/vitorpamplona/amethyst/model/AccountSettings.kt | 4 +++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/LocalPreferences.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/LocalPreferences.kt index 6cd193236c..e321c6b259 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/LocalPreferences.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/LocalPreferences.kt @@ -1254,6 +1254,8 @@ private class InboxPrefs( private fun SharedPreferences.readInboxPrefs() = InboxPrefs( + // Missing key = an account saved before this setting existed. Those keep CUSTOM; only + // brand-new logins get the ALWAYS default from AccountSettings' constructor. defaultRelayAuthPolicy = getString(PrefKeys.DEFAULT_RELAY_AUTH_POLICY, null) ?.let { runCatching { RelayAuthPolicy.valueOf(it) }.getOrNull() } diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/model/AccountSettings.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/model/AccountSettings.kt index 9802633ddf..523d86f594 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/model/AccountSettings.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/model/AccountSettings.kt @@ -338,7 +338,9 @@ class AccountSettings( var callVideoResolution: CallVideoResolution = CallVideoResolution.HD_720, var callMaxBitrateBps: Int = 1_500_000, val callsEnabled: MutableStateFlow = MutableStateFlow(true), - val defaultRelayAuthPolicy: MutableStateFlow = MutableStateFlow(RelayAuthPolicy.CUSTOM), + // New accounts authenticate with every relay that asks. Existing accounts keep whatever they + // had saved (LocalPreferences falls back to CUSTOM for prefs written before this key existed). + val defaultRelayAuthPolicy: MutableStateFlow = MutableStateFlow(RelayAuthPolicy.ALWAYS), val relayGroupViewMode: MutableStateFlow = MutableStateFlow(RelayGroupViewMode.DEFAULT), val concordViewMode: MutableStateFlow = MutableStateFlow(ConcordViewMode.DEFAULT), // Which conversation protocols the Messages inbox loads and shows. A disabled type is both hidden