mirror of
https://github.com/vitorpamplona/amethyst.git
synced 2025-11-10 05:07:15 +01:00
Moves SettingsCategory to take integers instead of Strings
This commit is contained in:
@@ -70,8 +70,8 @@ fun AllMediaBody(
|
|||||||
) {
|
) {
|
||||||
item {
|
item {
|
||||||
SettingsCategory(
|
SettingsCategory(
|
||||||
stringRes(R.string.media_servers_blossom_section),
|
R.string.media_servers_blossom_section,
|
||||||
stringRes(R.string.media_servers_blossom_explainer),
|
R.string.media_servers_blossom_explainer,
|
||||||
SettingsCategoryFirstModifier,
|
SettingsCategoryFirstModifier,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
@@ -91,8 +91,8 @@ fun AllMediaBody(
|
|||||||
|
|
||||||
item {
|
item {
|
||||||
SettingsCategory(
|
SettingsCategory(
|
||||||
stringRes(R.string.media_servers_nip96_section),
|
R.string.media_servers_nip96_section,
|
||||||
stringRes(R.string.media_servers_nip96_explainer),
|
R.string.media_servers_nip96_explainer,
|
||||||
SettingsCategorySpacingModifier,
|
SettingsCategorySpacingModifier,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
@@ -113,8 +113,8 @@ fun AllMediaBody(
|
|||||||
DEFAULT_MEDIA_SERVERS.let {
|
DEFAULT_MEDIA_SERVERS.let {
|
||||||
item {
|
item {
|
||||||
SettingsCategoryWithButton(
|
SettingsCategoryWithButton(
|
||||||
title = stringRes(id = R.string.built_in_media_servers_title),
|
title = R.string.built_in_media_servers_title,
|
||||||
description = stringRes(id = R.string.built_in_servers_description),
|
description = R.string.built_in_servers_description,
|
||||||
modifier = SettingsCategorySpacingModifier,
|
modifier = SettingsCategorySpacingModifier,
|
||||||
) {
|
) {
|
||||||
OutlinedButton(
|
OutlinedButton(
|
||||||
|
|||||||
@@ -123,8 +123,8 @@ private fun ChannelMetadataScaffold(
|
|||||||
) {
|
) {
|
||||||
item {
|
item {
|
||||||
SettingsCategory(
|
SettingsCategory(
|
||||||
stringRes(R.string.relay_chat_title),
|
R.string.relay_chat_title,
|
||||||
stringRes(R.string.relay_chat_explainer),
|
R.string.relay_chat_explainer,
|
||||||
SettingsCategoryFirstModifier,
|
SettingsCategoryFirstModifier,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
@@ -185,8 +185,8 @@ private fun ChannelMetadataScaffold(
|
|||||||
) {
|
) {
|
||||||
item {
|
item {
|
||||||
SettingsCategory(
|
SettingsCategory(
|
||||||
stringRes(R.string.public_chat_title),
|
R.string.public_chat_title,
|
||||||
stringRes(R.string.public_chat_explainer),
|
R.string.public_chat_explainer,
|
||||||
SettingsCategoryFirstModifier,
|
SettingsCategoryFirstModifier,
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -201,8 +201,8 @@ private fun ChannelMetadataScaffold(
|
|||||||
Description(postViewModel)
|
Description(postViewModel)
|
||||||
|
|
||||||
SettingsCategory(
|
SettingsCategory(
|
||||||
stringRes(R.string.public_chat_relays_title),
|
R.string.public_chat_relays_title,
|
||||||
stringRes(R.string.public_chat_relays_explainer),
|
R.string.public_chat_relays_explainer,
|
||||||
SettingsCategorySpacingModifier,
|
SettingsCategorySpacingModifier,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -41,7 +41,6 @@ import com.vitorpamplona.amethyst.ui.navigation.routes.Route
|
|||||||
import com.vitorpamplona.amethyst.ui.note.RelayCompose
|
import com.vitorpamplona.amethyst.ui.note.RelayCompose
|
||||||
import com.vitorpamplona.amethyst.ui.screen.loggedIn.AccountViewModel
|
import com.vitorpamplona.amethyst.ui.screen.loggedIn.AccountViewModel
|
||||||
import com.vitorpamplona.amethyst.ui.screen.loggedIn.relays.SettingsCategory
|
import com.vitorpamplona.amethyst.ui.screen.loggedIn.relays.SettingsCategory
|
||||||
import com.vitorpamplona.amethyst.ui.stringRes
|
|
||||||
import com.vitorpamplona.amethyst.ui.theme.DividerThickness
|
import com.vitorpamplona.amethyst.ui.theme.DividerThickness
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
@@ -64,8 +63,8 @@ fun RelayFeedView(
|
|||||||
) {
|
) {
|
||||||
item {
|
item {
|
||||||
SettingsCategory(
|
SettingsCategory(
|
||||||
stringRes(R.string.public_home_section),
|
R.string.public_home_section,
|
||||||
stringRes(R.string.public_home_section_explainer_profile),
|
R.string.public_home_section_explainer_profile,
|
||||||
Modifier.padding(top = 10.dp, bottom = 8.dp, start = 10.dp, end = 10.dp),
|
Modifier.padding(top = 10.dp, bottom = 8.dp, start = 10.dp, end = 10.dp),
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
@@ -74,8 +73,8 @@ fun RelayFeedView(
|
|||||||
}
|
}
|
||||||
item {
|
item {
|
||||||
SettingsCategory(
|
SettingsCategory(
|
||||||
stringRes(R.string.public_notif_section),
|
R.string.public_notif_section,
|
||||||
stringRes(R.string.public_notif_section_explainer_profile),
|
R.string.public_notif_section_explainer_profile,
|
||||||
Modifier.padding(top = 24.dp, bottom = 8.dp, start = 10.dp, end = 10.dp),
|
Modifier.padding(top = 24.dp, bottom = 8.dp, start = 10.dp, end = 10.dp),
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
@@ -84,8 +83,8 @@ fun RelayFeedView(
|
|||||||
}
|
}
|
||||||
item {
|
item {
|
||||||
SettingsCategory(
|
SettingsCategory(
|
||||||
stringRes(R.string.private_inbox_section),
|
R.string.private_inbox_section,
|
||||||
stringRes(R.string.private_inbox_section_explainer_profile),
|
R.string.private_inbox_section_explainer_profile,
|
||||||
Modifier.padding(top = 24.dp, bottom = 8.dp, start = 10.dp, end = 10.dp),
|
Modifier.padding(top = 24.dp, bottom = 8.dp, start = 10.dp, end = 10.dp),
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -215,8 +215,8 @@ fun MappedAllRelayListView(
|
|||||||
) {
|
) {
|
||||||
item {
|
item {
|
||||||
SettingsCategory(
|
SettingsCategory(
|
||||||
stringRes(R.string.public_home_section),
|
R.string.public_home_section,
|
||||||
stringRes(R.string.public_home_section_explainer),
|
R.string.public_home_section_explainer,
|
||||||
SettingsCategoryFirstModifier,
|
SettingsCategoryFirstModifier,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
@@ -224,8 +224,8 @@ fun MappedAllRelayListView(
|
|||||||
|
|
||||||
item {
|
item {
|
||||||
SettingsCategory(
|
SettingsCategory(
|
||||||
stringRes(R.string.public_notif_section),
|
R.string.public_notif_section,
|
||||||
stringRes(R.string.public_notif_section_explainer),
|
R.string.public_notif_section_explainer,
|
||||||
SettingsCategorySpacingModifier,
|
SettingsCategorySpacingModifier,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
@@ -233,8 +233,8 @@ fun MappedAllRelayListView(
|
|||||||
|
|
||||||
item {
|
item {
|
||||||
SettingsCategoryWithButton(
|
SettingsCategoryWithButton(
|
||||||
stringRes(R.string.private_inbox_section),
|
R.string.private_inbox_section,
|
||||||
stringRes(R.string.private_inbox_section_explainer),
|
R.string.private_inbox_section_explainer,
|
||||||
SettingsCategorySpacingModifier,
|
SettingsCategorySpacingModifier,
|
||||||
action = {
|
action = {
|
||||||
ResetDMRelays(dmViewModel)
|
ResetDMRelays(dmViewModel)
|
||||||
@@ -245,8 +245,8 @@ fun MappedAllRelayListView(
|
|||||||
|
|
||||||
item {
|
item {
|
||||||
SettingsCategory(
|
SettingsCategory(
|
||||||
stringRes(R.string.private_outbox_section),
|
R.string.private_outbox_section,
|
||||||
stringRes(R.string.private_outbox_section_explainer),
|
R.string.private_outbox_section_explainer,
|
||||||
SettingsCategorySpacingModifier,
|
SettingsCategorySpacingModifier,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
@@ -254,8 +254,8 @@ fun MappedAllRelayListView(
|
|||||||
|
|
||||||
item {
|
item {
|
||||||
SettingsCategory(
|
SettingsCategory(
|
||||||
stringRes(R.string.proxy_section),
|
R.string.proxy_section,
|
||||||
stringRes(R.string.proxy_section_explainer),
|
R.string.proxy_section_explainer,
|
||||||
SettingsCategorySpacingModifier,
|
SettingsCategorySpacingModifier,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
@@ -263,8 +263,8 @@ fun MappedAllRelayListView(
|
|||||||
|
|
||||||
item {
|
item {
|
||||||
SettingsCategory(
|
SettingsCategory(
|
||||||
stringRes(R.string.broadcast_section),
|
R.string.broadcast_section,
|
||||||
stringRes(R.string.broadcast_section_explainer),
|
R.string.broadcast_section_explainer,
|
||||||
SettingsCategorySpacingModifier,
|
SettingsCategorySpacingModifier,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
@@ -272,8 +272,8 @@ fun MappedAllRelayListView(
|
|||||||
|
|
||||||
item {
|
item {
|
||||||
SettingsCategoryWithButton(
|
SettingsCategoryWithButton(
|
||||||
stringRes(R.string.indexer_section),
|
R.string.indexer_section,
|
||||||
stringRes(R.string.indexer_section_explainer),
|
R.string.indexer_section_explainer,
|
||||||
SettingsCategorySpacingModifier,
|
SettingsCategorySpacingModifier,
|
||||||
) {
|
) {
|
||||||
ResetIndexerRelays(indexerViewModel)
|
ResetIndexerRelays(indexerViewModel)
|
||||||
@@ -283,8 +283,8 @@ fun MappedAllRelayListView(
|
|||||||
|
|
||||||
item {
|
item {
|
||||||
SettingsCategoryWithButton(
|
SettingsCategoryWithButton(
|
||||||
stringRes(R.string.search_section),
|
R.string.search_section,
|
||||||
stringRes(R.string.search_section_explainer),
|
R.string.search_section_explainer,
|
||||||
SettingsCategorySpacingModifier,
|
SettingsCategorySpacingModifier,
|
||||||
) {
|
) {
|
||||||
ResetSearchRelays(searchViewModel)
|
ResetSearchRelays(searchViewModel)
|
||||||
@@ -294,8 +294,8 @@ fun MappedAllRelayListView(
|
|||||||
|
|
||||||
item {
|
item {
|
||||||
SettingsCategory(
|
SettingsCategory(
|
||||||
stringRes(R.string.local_section),
|
R.string.local_section,
|
||||||
stringRes(R.string.local_section_explainer),
|
R.string.local_section_explainer,
|
||||||
SettingsCategorySpacingModifier,
|
SettingsCategorySpacingModifier,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
@@ -303,8 +303,8 @@ fun MappedAllRelayListView(
|
|||||||
|
|
||||||
item {
|
item {
|
||||||
SettingsCategory(
|
SettingsCategory(
|
||||||
stringRes(R.string.trusted_section),
|
R.string.trusted_section,
|
||||||
stringRes(R.string.trusted_section_explainer),
|
R.string.trusted_section_explainer,
|
||||||
SettingsCategorySpacingModifier,
|
SettingsCategorySpacingModifier,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
@@ -312,8 +312,8 @@ fun MappedAllRelayListView(
|
|||||||
|
|
||||||
item {
|
item {
|
||||||
SettingsCategory(
|
SettingsCategory(
|
||||||
stringRes(R.string.blocked_section),
|
R.string.blocked_section,
|
||||||
stringRes(R.string.blocked_section_explainer),
|
R.string.blocked_section_explainer,
|
||||||
SettingsCategorySpacingModifier,
|
SettingsCategorySpacingModifier,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
@@ -321,8 +321,8 @@ fun MappedAllRelayListView(
|
|||||||
|
|
||||||
item {
|
item {
|
||||||
SettingsCategory(
|
SettingsCategory(
|
||||||
stringRes(R.string.connected_section),
|
R.string.connected_section,
|
||||||
stringRes(R.string.connected_section_description),
|
R.string.connected_section_description,
|
||||||
SettingsCategorySpacingModifier,
|
SettingsCategorySpacingModifier,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
@@ -382,19 +382,19 @@ fun ResetDMRelays(postViewModel: DMRelayListViewModel) {
|
|||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
fun SettingsCategory(
|
fun SettingsCategory(
|
||||||
title: String,
|
title: Int,
|
||||||
description: String? = null,
|
description: Int? = null,
|
||||||
modifier: Modifier,
|
modifier: Modifier,
|
||||||
) {
|
) {
|
||||||
Column(modifier) {
|
Column(modifier) {
|
||||||
Text(
|
Text(
|
||||||
text = title,
|
text = stringRes(title),
|
||||||
color = MaterialTheme.colorScheme.primary,
|
color = MaterialTheme.colorScheme.primary,
|
||||||
style = MaterialTheme.typography.titleSmall,
|
style = MaterialTheme.typography.titleSmall,
|
||||||
)
|
)
|
||||||
if (description != null) {
|
if (description != null) {
|
||||||
Text(
|
Text(
|
||||||
description,
|
text = stringRes(description),
|
||||||
style = MaterialTheme.typography.bodyMedium,
|
style = MaterialTheme.typography.bodyMedium,
|
||||||
color = MaterialTheme.colorScheme.grayText,
|
color = MaterialTheme.colorScheme.grayText,
|
||||||
)
|
)
|
||||||
@@ -404,21 +404,21 @@ fun SettingsCategory(
|
|||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
fun SettingsCategoryWithButton(
|
fun SettingsCategoryWithButton(
|
||||||
title: String,
|
title: Int,
|
||||||
description: String? = null,
|
description: Int? = null,
|
||||||
modifier: Modifier,
|
modifier: Modifier,
|
||||||
action: @Composable () -> Unit,
|
action: @Composable () -> Unit,
|
||||||
) {
|
) {
|
||||||
Row(modifier, horizontalArrangement = RowColSpacing) {
|
Row(modifier, horizontalArrangement = RowColSpacing) {
|
||||||
Column(modifier = Modifier.weight(1f)) {
|
Column(modifier = Modifier.weight(1f)) {
|
||||||
Text(
|
Text(
|
||||||
text = title,
|
text = stringRes(title),
|
||||||
color = MaterialTheme.colorScheme.primary,
|
color = MaterialTheme.colorScheme.primary,
|
||||||
style = MaterialTheme.typography.titleSmall,
|
style = MaterialTheme.typography.titleSmall,
|
||||||
)
|
)
|
||||||
if (description != null) {
|
if (description != null) {
|
||||||
Text(
|
Text(
|
||||||
text = description,
|
text = stringRes(description),
|
||||||
style = MaterialTheme.typography.bodyMedium,
|
style = MaterialTheme.typography.bodyMedium,
|
||||||
color = MaterialTheme.colorScheme.grayText,
|
color = MaterialTheme.colorScheme.grayText,
|
||||||
)
|
)
|
||||||
|
|||||||
Reference in New Issue
Block a user