@@ -49,35 +49,59 @@ fun DnsSettingsSheet(onDismiss: () -> Unit, viewModel: SettingsViewModel = hiltV
4949 containerColor = MaterialTheme .colorScheme.surface,
5050 contentColor = MaterialTheme .colorScheme.onSurface,
5151 ) {
52- Column (Modifier .padding(20 .dp).verticalScroll(rememberScrollState()), verticalArrangement = Arrangement .spacedBy(12 .dp)) {
52+ Column (
53+ Modifier .padding(20 .dp).verticalScroll(rememberScrollState()),
54+ verticalArrangement = Arrangement .spacedBy(12 .dp),
55+ ) {
5356 Text (stringResource(R .string.dnsText))
54- Text (state.runtimePlan.sectionSummaries.values.joinToString(" \n " ).ifBlank { stringResource(R .string.dns_runtime_default) })
57+ Text (
58+ state.runtimePlan.sectionSummaries.values.joinToString(" \n " ).ifBlank {
59+ stringResource(R .string.dns_runtime_default)
60+ }
61+ )
5562 state.refreshMessage?.let { Text (it) }
5663 state.warnings.forEach { Text (stringResource(R .string.dns_warning_format, it)) }
5764 Button (enabled = ! state.isRefreshing, onClick = viewModel::refreshDnsCatalog) {
58- Text (if (state.isRefreshing) stringResource(R .string.refreshing) else stringResource(R .string.refresh_dns_catalog))
65+ Text (
66+ if (state.isRefreshing) stringResource(R .string.refreshing)
67+ else stringResource(R .string.refresh_dns_catalog)
68+ )
5969 }
60- DnsSectionBlock (DnsSection .GLOBAL , viewModel, onProvider = { providerSection = it }, onManual = { section, input ->
61- manualSection = section
62- manualText = input
63- })
64- USER_CONFIGURABLE_DNS_SECTIONS .forEach { section ->
65- DnsSectionBlock (section, viewModel, onProvider = { providerSection = it }, onManual = { sec, input ->
66- manualSection = sec
70+ DnsSectionBlock (
71+ DnsSection .GLOBAL ,
72+ viewModel,
73+ onProvider = { providerSection = it },
74+ onManual = { section, input ->
75+ manualSection = section
6776 manualText = input
68- })
77+ },
78+ )
79+ USER_CONFIGURABLE_DNS_SECTIONS .forEach { section ->
80+ DnsSectionBlock (
81+ section,
82+ viewModel,
83+ onProvider = { providerSection = it },
84+ onManual = { sec, input ->
85+ manualSection = sec
86+ manualText = input
87+ },
88+ )
6989 }
7090 }
7191 }
7292
7393 providerSection?.let { section ->
7494 val options =
75- state.filteredProviders(DnsUiCatalogFilters (region = DnsCatalogRegionFilter .ALL ))
95+ state
96+ .filteredProviders(DnsUiCatalogFilters (region = DnsCatalogRegionFilter .ALL ))
7697 .filter { section in it.supportsInLayers }
7798 .flatMap { provider ->
78- provider.transports.filterNot { it == DnsTransport .SYSTEM }.sortedBy { it.name }.map {
79- Triple (provider.providerId, provider.label, it)
80- }
99+ provider.transports
100+ .filterNot { it == DnsTransport .SYSTEM }
101+ .sortedBy { it.name }
102+ .map {
103+ Triple (provider.providerId, provider.label, it)
104+ }
81105 }
82106 OptionDialog (
83107 title = section.displayName(),
@@ -95,15 +119,25 @@ fun DnsSettingsSheet(onDismiss: () -> Unit, viewModel: SettingsViewModel = hiltV
95119 AlertDialog (
96120 onDismissRequest = { manualSection = null },
97121 title = { Text (section.displayName()) },
98- text = { OutlinedTextField (value = manualText, onValueChange = { manualText = it }, modifier = Modifier .fillMaxWidth()) },
122+ text = {
123+ OutlinedTextField (
124+ value = manualText,
125+ onValueChange = { manualText = it },
126+ modifier = Modifier .fillMaxWidth(),
127+ )
128+ },
99129 confirmButton = {
100- TextButton (onClick = {
101- if (viewModel.setDnsManual(section, manualText) == null ) manualSection = null
102- }) {
130+ TextButton (
131+ onClick = {
132+ if (viewModel.setDnsManual(section, manualText) == null ) manualSection = null
133+ }
134+ ) {
103135 Text (stringResource(R .string.update))
104136 }
105137 },
106- dismissButton = { TextButton (onClick = { manualSection = null }) { Text (stringResource(R .string.cancel)) } },
138+ dismissButton = {
139+ TextButton (onClick = { manualSection = null }) { Text (stringResource(R .string.cancel)) }
140+ },
107141 )
108142 }
109143}
0 commit comments