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.Lifecycle
|
||||||
import androidx.lifecycle.LifecycleEventObserver
|
import androidx.lifecycle.LifecycleEventObserver
|
||||||
import androidx.lifecycle.compose.LocalLifecycleOwner
|
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.R
|
||||||
import org.strongswan.android.ui.compose.components.ShxSection
|
import org.strongswan.android.ui.compose.components.ShxSection
|
||||||
import org.strongswan.android.ui.compose.components.ShxSectionDivider
|
import org.strongswan.android.ui.compose.components.ShxSectionDivider
|
||||||
@@ -170,10 +174,8 @@ fun TrustedNetworksScreen(
|
|||||||
subtitle = stringResource(R.string.auto_connect_summary),
|
subtitle = stringResource(R.string.auto_connect_summary),
|
||||||
checked = enabled,
|
checked = enabled,
|
||||||
onCheckedChange = { checked ->
|
onCheckedChange = { checked ->
|
||||||
if (checked)
|
/* the permission is requested from the explainer card below, not
|
||||||
{
|
* straight from the toggle */
|
||||||
requestSsidPermissions()
|
|
||||||
}
|
|
||||||
update { it.copy(enabled = checked) }
|
update { it.copy(enabled = checked) }
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
@@ -193,27 +195,39 @@ fun TrustedNetworksScreen(
|
|||||||
Spacer(Modifier.size(ShxSpacing.md))
|
Spacer(Modifier.size(ShxSpacing.md))
|
||||||
Surface(
|
Surface(
|
||||||
shape = MaterialTheme.shapes.large,
|
shape = MaterialTheme.shapes.large,
|
||||||
color = MaterialTheme.colorScheme.errorContainer,
|
color = MaterialTheme.colorScheme.primaryContainer,
|
||||||
|
contentColor = MaterialTheme.colorScheme.onPrimaryContainer,
|
||||||
modifier = Modifier
|
modifier = Modifier
|
||||||
.fillMaxWidth()
|
.fillMaxWidth()
|
||||||
.padding(horizontal = ShxSpacing.lg)
|
.padding(horizontal = ShxSpacing.lg),
|
||||||
.clickable { requestSsidPermissions() },
|
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
Row(
|
Column(
|
||||||
verticalAlignment = Alignment.CenterVertically,
|
modifier = Modifier.padding(ShxSpacing.lg),
|
||||||
modifier = Modifier.padding(horizontal = ShxSpacing.lg, vertical = ShxSpacing.md),
|
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(
|
||||||
text = stringResource(R.string.auto_connect_location_banner),
|
text = stringResource(R.string.auto_connect_location_banner),
|
||||||
style = MaterialTheme.typography.bodySmall,
|
style = MaterialTheme.typography.bodySmall,
|
||||||
color = MaterialTheme.colorScheme.onErrorContainer,
|
|
||||||
modifier = Modifier.weight(1f),
|
|
||||||
)
|
)
|
||||||
TextButton(onClick = { requestSsidPermissions() }) {
|
Button(
|
||||||
Text(stringResource(R.string.auto_connect_location_grant))
|
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_warn">Warnungen</string>
|
||||||
<string name="log_filter_error">Fehler</string>
|
<string name="log_filter_error">Fehler</string>
|
||||||
<string name="apps_show_system">Systemapps anzeigen</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>
|
</resources>
|
||||||
@@ -507,4 +507,6 @@
|
|||||||
<string name="log_filter_warn">Предупреждения</string>
|
<string name="log_filter_warn">Предупреждения</string>
|
||||||
<string name="log_filter_error">Ошибки</string>
|
<string name="log_filter_error">Ошибки</string>
|
||||||
<string name="apps_show_system">Показывать системные приложения</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>
|
</resources>
|
||||||
@@ -512,4 +512,6 @@
|
|||||||
<string name="log_filter_warn">Warnings</string>
|
<string name="log_filter_warn">Warnings</string>
|
||||||
<string name="log_filter_error">Errors</string>
|
<string name="log_filter_error">Errors</string>
|
||||||
<string name="apps_show_system">Show system apps</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>
|
</resources>
|
||||||
Reference in new issue
Block a user