android: trusted networks - inline location explainer card
This commit is contained in:
1 parent
59a31d6a1d
commit
8deafeae8e
4 files changed
+35
-15
No files matched your search
+29
-15
@@ -62,6 +62,10 @@ import androidx.core.content.ContextCompat
|
||||
import androidx.lifecycle.Lifecycle
|
||||
import androidx.lifecycle.LifecycleEventObserver
|
||||
import androidx.lifecycle.compose.LocalLifecycleOwner
|
||||
import androidx.compose.material3.Button
|
||||
import androidx.compose.ui.semantics.heading
|
||||
import androidx.compose.ui.semantics.semantics
|
||||
import androidx.compose.foundation.layout.Arrangement
|
||||
import org.strongswan.android.R
|
||||
import org.strongswan.android.ui.compose.components.ShxSection
|
||||
import org.strongswan.android.ui.compose.components.ShxSectionDivider
|
||||
@@ -170,10 +174,8 @@ fun TrustedNetworksScreen(
|
||||
subtitle = stringResource(R.string.auto_connect_summary),
|
||||
checked = enabled,
|
||||
onCheckedChange = { checked ->
|
||||
if (checked)
|
||||
{
|
||||
requestSsidPermissions()
|
||||
}
|
||||
/* the permission is requested from the explainer card below, not
|
||||
* straight from the toggle */
|
||||
update { it.copy(enabled = checked) }
|
||||
},
|
||||
)
|
||||
@@ -193,27 +195,39 @@ fun TrustedNetworksScreen(
|
||||
Spacer(Modifier.size(ShxSpacing.md))
|
||||
Surface(
|
||||
shape = MaterialTheme.shapes.large,
|
||||
color = MaterialTheme.colorScheme.errorContainer,
|
||||
color = MaterialTheme.colorScheme.primaryContainer,
|
||||
contentColor = MaterialTheme.colorScheme.onPrimaryContainer,
|
||||
modifier = Modifier
|
||||
.fillMaxWidth()
|
||||
.padding(horizontal = ShxSpacing.lg)
|
||||
.clickable { requestSsidPermissions() },
|
||||
.padding(horizontal = ShxSpacing.lg),
|
||||
)
|
||||
{
|
||||
Row(
|
||||
verticalAlignment = Alignment.CenterVertically,
|
||||
modifier = Modifier.padding(horizontal = ShxSpacing.lg, vertical = ShxSpacing.md),
|
||||
Column(
|
||||
modifier = Modifier.padding(ShxSpacing.lg),
|
||||
verticalArrangement = Arrangement.spacedBy(ShxSpacing.sm),
|
||||
)
|
||||
{
|
||||
Row(verticalAlignment = Alignment.CenterVertically, horizontalArrangement = Arrangement.spacedBy(ShxSpacing.md))
|
||||
{
|
||||
Icon(Icons.Rounded.Wifi, contentDescription = null)
|
||||
Text(
|
||||
text = stringResource(R.string.auto_connect_location_title),
|
||||
style = MaterialTheme.typography.titleSmall,
|
||||
modifier = Modifier.semantics { heading() },
|
||||
)
|
||||
}
|
||||
Text(
|
||||
text = stringResource(R.string.auto_connect_location_why),
|
||||
style = MaterialTheme.typography.bodyMedium,
|
||||
)
|
||||
Text(
|
||||
text = stringResource(R.string.auto_connect_location_banner),
|
||||
style = MaterialTheme.typography.bodySmall,
|
||||
color = MaterialTheme.colorScheme.onErrorContainer,
|
||||
modifier = Modifier.weight(1f),
|
||||
)
|
||||
TextButton(onClick = { requestSsidPermissions() }) {
|
||||
Text(stringResource(R.string.auto_connect_location_grant))
|
||||
}
|
||||
Button(
|
||||
onClick = { requestSsidPermissions() },
|
||||
modifier = Modifier.align(Alignment.End),
|
||||
) { Text(stringResource(R.string.auto_connect_location_grant)) }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -510,4 +510,6 @@
|
||||
<string name="log_filter_warn">Warnungen</string>
|
||||
<string name="log_filter_error">Fehler</string>
|
||||
<string name="apps_show_system">Systemapps anzeigen</string>
|
||||
<string name="auto_connect_location_title">Standortzugriff erforderlich</string>
|
||||
<string name="auto_connect_location_why">Android gibt den WLAN-Namen nur an Apps mit Standortzugriff weiter. Er dient ausschließlich dem Erkennen Ihrer vertrauenswürdigen Netzwerke; der Standort selbst wird nie gelesen oder gesendet.</string>
|
||||
</resources>
|
||||
@@ -507,4 +507,6 @@
|
||||
<string name="log_filter_warn">Предупреждения</string>
|
||||
<string name="log_filter_error">Ошибки</string>
|
||||
<string name="apps_show_system">Показывать системные приложения</string>
|
||||
<string name="auto_connect_location_title">Нужен доступ к геолокации</string>
|
||||
<string name="auto_connect_location_why">Android сообщает имя Wi-Fi сети только приложениям с доступом к геолокации. Оно нужно лишь для распознавания доверенных сетей; сама геолокация не читается и не передаётся.</string>
|
||||
</resources>
|
||||
@@ -512,4 +512,6 @@
|
||||
<string name="log_filter_warn">Warnings</string>
|
||||
<string name="log_filter_error">Errors</string>
|
||||
<string name="apps_show_system">Show system apps</string>
|
||||
<string name="auto_connect_location_title">Location access needed</string>
|
||||
<string name="auto_connect_location_why">Android only reveals the Wi-Fi network name to apps with location access. The app uses it solely to recognize your trusted networks; the location itself is never read or sent.</string>
|
||||
</resources>
|
||||
Reference in new issue
Block a user