* 'main' of https://github.com/vitorpamplona/amethyst:
  feat: consolidate drawer settings into a single Settings hub screen
  New Crowdin translations by GitHub Action
This commit is contained in:
Vitor Pamplona
2026-02-26 20:11:11 -05:00
8 changed files with 178 additions and 48 deletions
@@ -104,6 +104,7 @@ import com.vitorpamplona.amethyst.ui.screen.loggedIn.redirect.LoadRedirectScreen
import com.vitorpamplona.amethyst.ui.screen.loggedIn.relays.AllRelayListScreen
import com.vitorpamplona.amethyst.ui.screen.loggedIn.relays.RelayInformationScreen
import com.vitorpamplona.amethyst.ui.screen.loggedIn.search.SearchScreen
import com.vitorpamplona.amethyst.ui.screen.loggedIn.settings.AllSettingsScreen
import com.vitorpamplona.amethyst.ui.screen.loggedIn.settings.NIP47SetupScreen
import com.vitorpamplona.amethyst.ui.screen.loggedIn.settings.SecurityFiltersScreen
import com.vitorpamplona.amethyst.ui.screen.loggedIn.settings.SettingsScreen
@@ -162,6 +163,7 @@ fun AppNavigation(
composableFromBottomArgs<Route.EditProfile> { NewUserMetadataScreen(nav, accountViewModel) }
composable<Route.Search> { SearchScreen(accountViewModel, nav) }
composableFromEnd<Route.AllSettings> { AllSettingsScreen(nav) }
composableFromEnd<Route.SecurityFilters> { SecurityFiltersScreen(accountViewModel, nav) }
composableFromEnd<Route.PrivacyOptions> { PrivacyOptionsScreen(Amethyst.instance.torPrefs.value, nav) }
composableFromEnd<Route.Bookmarks> { BookmarkListScreen(accountViewModel, nav) }
@@ -46,14 +46,11 @@ import androidx.compose.material.icons.Icons
import androidx.compose.material.icons.automirrored.filled.Send
import androidx.compose.material.icons.filled.AccountCircle
import androidx.compose.material.icons.filled.Delete
import androidx.compose.material.icons.outlined.CloudUpload
import androidx.compose.material.icons.outlined.CollectionsBookmark
import androidx.compose.material.icons.outlined.Drafts
import androidx.compose.material.icons.outlined.GroupAdd
import androidx.compose.material.icons.outlined.Key
import androidx.compose.material.icons.outlined.Security
import androidx.compose.material.icons.outlined.Settings
import androidx.compose.material.icons.outlined.Translate
import androidx.compose.material3.HorizontalDivider
import androidx.compose.material3.Icon
import androidx.compose.material3.IconButton
@@ -480,41 +477,6 @@ fun ListContent(
route = Route.Chess,
)
IconRowRelays(
accountViewModel = accountViewModel,
onClick = {
nav.closeDrawer()
nav.nav(Route.EditRelays)
},
)
IconRow(
title = R.string.media_servers,
icon = Icons.Outlined.CloudUpload,
tint = MaterialTheme.colorScheme.onBackground,
onClick = {
nav.closeDrawer()
nav.nav(Route.EditMediaServers)
},
)
NavigationRow(
title = R.string.security_filters,
icon = Icons.Outlined.Security,
tint = MaterialTheme.colorScheme.onBackground,
nav = nav,
route = Route.SecurityFilters,
)
NavigationRow(
title = R.string.privacy_options,
icon = R.drawable.ic_tor,
iconReference = 1,
tint = MaterialTheme.colorScheme.onBackground,
nav = nav,
route = Route.PrivacyOptions,
)
accountViewModel.account.settings.keyPair.privKey?.let {
IconRow(
title = R.string.backup_keys,
@@ -528,19 +490,11 @@ fun ListContent(
}
NavigationRow(
title = R.string.preferences,
title = R.string.settings,
icon = Icons.Outlined.Settings,
tint = MaterialTheme.colorScheme.onBackground,
nav = nav,
route = Route.Settings,
)
NavigationRow(
title = R.string.user_preferences,
icon = Icons.Outlined.Translate,
tint = MaterialTheme.colorScheme.onBackground,
nav = nav,
route = Route.UserSettings,
route = Route.AllSettings,
)
Spacer(modifier = Modifier.weight(1f))
@@ -79,6 +79,8 @@ sealed class Route {
@Serializable object Drafts : Route()
@Serializable object AllSettings : Route()
@Serializable object Settings : Route()
@Serializable object UserSettings : Route()
@@ -325,6 +327,7 @@ fun getRouteWithArguments(navController: NavHostController): Route? {
dest.hasRoute<Route.Bookmarks>() -> entry.toRoute<Route.Bookmarks>()
dest.hasRoute<Route.ContentDiscovery>() -> entry.toRoute<Route.ContentDiscovery>()
dest.hasRoute<Route.Drafts>() -> entry.toRoute<Route.Drafts>()
dest.hasRoute<Route.AllSettings>() -> entry.toRoute<Route.AllSettings>()
dest.hasRoute<Route.Settings>() -> entry.toRoute<Route.Settings>()
dest.hasRoute<Route.EditProfile>() -> entry.toRoute<Route.EditProfile>()
dest.hasRoute<Route.Profile>() -> entry.toRoute<Route.Profile>()
@@ -0,0 +1,167 @@
/*
* Copyright (c) 2025 Vitor Pamplona
*
* Permission is hereby granted, free of charge, to any person obtaining a copy of
* this software and associated documentation files (the "Software"), to deal in
* the Software without restriction, including without limitation the rights to use,
* copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the
* Software, and to permit persons to whom the Software is furnished to do so,
* subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
* FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
* AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
package com.vitorpamplona.amethyst.ui.screen.loggedIn.settings
import androidx.compose.foundation.clickable
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.Row
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.layout.size
import androidx.compose.material.icons.Icons
import androidx.compose.material.icons.outlined.CloudUpload
import androidx.compose.material.icons.outlined.Security
import androidx.compose.material.icons.outlined.Settings
import androidx.compose.material.icons.outlined.Translate
import androidx.compose.material3.HorizontalDivider
import androidx.compose.material3.Icon
import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.Scaffold
import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.graphics.vector.ImageVector
import androidx.compose.ui.unit.dp
import androidx.compose.ui.unit.sp
import com.vitorpamplona.amethyst.R
import com.vitorpamplona.amethyst.ui.navigation.navs.INav
import com.vitorpamplona.amethyst.ui.navigation.routes.Route
import com.vitorpamplona.amethyst.ui.navigation.topbars.TopBarWithBackButton
import com.vitorpamplona.amethyst.ui.painterRes
import com.vitorpamplona.amethyst.ui.stringRes
@Composable
fun AllSettingsScreen(nav: INav) {
val tint = MaterialTheme.colorScheme.onBackground
Scaffold(
topBar = {
TopBarWithBackButton(stringRes(id = R.string.settings), nav::popBack)
},
) { padding ->
Column(Modifier.padding(padding)) {
SettingsNavigationRow(
title = R.string.relay_setup,
iconPainter = R.drawable.relays,
iconPainterRef = 4,
tint = tint,
onClick = { nav.nav(Route.EditRelays) },
)
HorizontalDivider()
SettingsNavigationRow(
title = R.string.media_servers,
icon = Icons.Outlined.CloudUpload,
tint = tint,
onClick = { nav.nav(Route.EditMediaServers) },
)
HorizontalDivider()
SettingsNavigationRow(
title = R.string.security_filters,
icon = Icons.Outlined.Security,
tint = tint,
onClick = { nav.nav(Route.SecurityFilters) },
)
HorizontalDivider()
SettingsNavigationRow(
title = R.string.privacy_options,
iconPainter = R.drawable.ic_tor,
iconPainterRef = 1,
tint = tint,
onClick = { nav.nav(Route.PrivacyOptions) },
)
HorizontalDivider()
SettingsNavigationRow(
title = R.string.preferences,
icon = Icons.Outlined.Settings,
tint = tint,
onClick = { nav.nav(Route.Settings) },
)
HorizontalDivider()
SettingsNavigationRow(
title = R.string.user_preferences,
icon = Icons.Outlined.Translate,
tint = tint,
onClick = { nav.nav(Route.UserSettings) },
)
}
}
}
@Composable
private fun SettingsNavigationRow(
title: Int,
icon: ImageVector,
tint: Color,
onClick: () -> Unit,
) {
Row(
modifier =
Modifier
.fillMaxWidth()
.clickable(onClick = onClick)
.padding(vertical = 16.dp, horizontal = 24.dp),
verticalAlignment = Alignment.CenterVertically,
) {
Icon(
imageVector = icon,
contentDescription = stringRes(title),
modifier = Modifier.size(24.dp),
tint = tint,
)
Text(
text = stringRes(title),
fontSize = 18.sp,
modifier = Modifier.padding(start = 16.dp),
)
}
}
@Composable
private fun SettingsNavigationRow(
title: Int,
iconPainter: Int,
iconPainterRef: Int,
tint: Color,
onClick: () -> Unit,
) {
Row(
modifier =
Modifier
.fillMaxWidth()
.clickable(onClick = onClick)
.padding(vertical = 16.dp, horizontal = 24.dp),
verticalAlignment = Alignment.CenterVertically,
) {
Icon(
painter = painterRes(iconPainter, iconPainterRef),
contentDescription = stringRes(title),
modifier = Modifier.size(24.dp),
tint = tint,
)
Text(
text = stringRes(title),
fontSize = 18.sp,
modifier = Modifier.padding(start = 16.dp),
)
}
}
@@ -477,6 +477,7 @@
<string name="set_preferred_media_servers">Nastavte preferované servery pro nahrávání médií.</string>
<string name="no_nip96_server_message">Nemáte nastaveny žádné servery NIP-96. Můžete použít Amethystův seznam nebo přidat některý níže ↓</string>
<string name="no_blossom_server_message">Nemáte nastaveny žádné Blossom servery. Můžete použít Amethystův seznam, nebo přidat některý níže ↓</string>
<string name="recommended_media_servers">Doporučené média servery</string>
<string name="built_in_media_servers_title">Integrované mediální servery</string>
<string name="built_in_servers_description">Výchozí seznam Amethysty. Můžete je přidat jednotlivě nebo přidat seznam.</string>
<string name="use_default_servers">Použít výchozí seznam</string>
@@ -483,6 +483,7 @@ anz der Bedingungen ist erforderlich</string>
<string name="set_preferred_media_servers">Legen Sie Ihre bevorzugten Medienupload Server fest.</string>
<string name="no_nip96_server_message">Du hast keine NIP-96-Server gesetzt. Du kannst die Amethyst-Liste verwenden oder unten einen hinzufügen ↓</string>
<string name="no_blossom_server_message">Du hast keine Blossom Server gesetzt. Du kannst die Amethyst-Liste verwenden oder unten einen hinzufügen ↓</string>
<string name="recommended_media_servers">Empfohlene Medienserver</string>
<string name="built_in_media_servers_title">Integrierte Medienserver</string>
<string name="built_in_servers_description">Amethysts Standardliste. Sie können sie einzeln hinzufügen oder die Liste hinzufügen.</string>
<string name="use_default_servers">Standardliste verwenden</string>
@@ -477,6 +477,7 @@
<string name="set_preferred_media_servers">Defina seus servidores de upload de mídia preferidos.</string>
<string name="no_nip96_server_message">Você não tem nenhum servidor NIP-96. Você pode usar a lista de Amethyst, ou adicionar um abaixo ↓</string>
<string name="no_blossom_server_message">Você não tem nenhum servidor de Blossom configurado. Você pode usar a lista de Amethyst, ou adicionar um abaixo ↓</string>
<string name="recommended_media_servers">Servidores de Mídia Recomendados</string>
<string name="built_in_media_servers_title">Servidores de Mídia Integrados</string>
<string name="built_in_servers_description">Lista padrão do Amethyst. Você pode adicioná-los individualmente ou adicionar a lista.</string>
<string name="use_default_servers">Usar Lista Padrão</string>
@@ -477,6 +477,7 @@
<string name="set_preferred_media_servers">Ställ in dina önskade mediauppladdningsservrar.</string>
<string name="no_nip96_server_message">Du har inga NIP-96 servrar. Du kan använda Amethyst\'s lista, eller lägga till en nedan ↓</string>
<string name="no_blossom_server_message">Du har inga Blossom servrar satta. Du kan använda Amethyst\'s lista, eller lägga till en nedan ↓</string>
<string name="recommended_media_servers">Rekommenderade Mediaservrar</string>
<string name="built_in_media_servers_title">Inbyggda mediaservrar</string>
<string name="built_in_servers_description">Amethysts standardlista. Du kan lägga till dem individuellt eller lägga till listan.</string>
<string name="use_default_servers">Använd standardlistan</string>