fix(ui): routing-scope line reflects the per-app whitelist too, so it no longer overstates scope as device-wide
This commit is contained in:
parent
91014a8420
commit
54b635f779
3 changed files with 42 additions and 17 deletions
|
|
@ -310,24 +310,36 @@ private fun ConnToggle(
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Subtle line under the server card stating what the proxy actually carries — so the
|
* Subtle line under the server card stating what the tunnel actually carries — across BOTH
|
||||||
* "Сайты" split is never invisible (an empty list is now a full tunnel; a non-empty list
|
* filters, so neither is invisible: the per-app scope ("N приложений", only when the Apps
|
||||||
* shows how much is proxied vs direct).
|
* whitelist is active — otherwise it's all apps) and the destination split from "Сайты"
|
||||||
|
* (empty list = full tunnel; a non-empty list shows how much is proxied vs direct).
|
||||||
*/
|
*/
|
||||||
@Composable
|
@Composable
|
||||||
private fun RoutingScopeLine(settings: AppSettings, modifier: Modifier = Modifier) {
|
private fun RoutingScopeLine(settings: AppSettings, modifier: Modifier = Modifier) {
|
||||||
val n = settings.routedSites.size
|
val sites = settings.routedSites.size
|
||||||
val text = when {
|
val dest = when {
|
||||||
n == 0 -> stringResource(R.string.route_scope_all)
|
sites == 0 -> stringResource(R.string.route_scope_all)
|
||||||
settings.routingMode == RoutingMode.DIRECT_ALL ->
|
settings.routingMode == RoutingMode.DIRECT_ALL ->
|
||||||
stringResource(R.string.route_scope_only, pluralStringResource(R.plurals.route_rules, n, n))
|
stringResource(R.string.route_scope_only, pluralStringResource(R.plurals.route_rules, sites, sites))
|
||||||
else ->
|
else ->
|
||||||
stringResource(R.string.route_scope_except, pluralStringResource(R.plurals.route_rules, n, n))
|
stringResource(R.string.route_scope_except, pluralStringResource(R.plurals.route_rules, sites, sites))
|
||||||
|
}
|
||||||
|
// A non-empty per-app whitelist confines the whole tunnel to those apps, so "всё" is only
|
||||||
|
// ever device-wide when the list is empty — qualify it with the app count when it isn't.
|
||||||
|
val apps = settings.allowedApps.size
|
||||||
|
val text = if (apps > 0) {
|
||||||
|
pluralStringResource(R.plurals.route_apps, apps, apps) + " · " + dest
|
||||||
|
} else {
|
||||||
|
dest
|
||||||
}
|
}
|
||||||
Row(modifier, verticalAlignment = Alignment.CenterVertically) {
|
Row(modifier, verticalAlignment = Alignment.CenterVertically) {
|
||||||
Box(Modifier.size(5.dp).clip(CircleShape).background(Vojo.fleetSoft.copy(alpha = 0.55f)))
|
Box(Modifier.size(5.dp).clip(CircleShape).background(Vojo.fleetSoft.copy(alpha = 0.55f)))
|
||||||
Spacer(Modifier.width(8.dp))
|
Spacer(Modifier.width(8.dp))
|
||||||
Text(text, color = Vojo.muted, fontSize = 12.5.sp, maxLines = 1, overflow = TextOverflow.Ellipsis)
|
Text(
|
||||||
|
text.replaceFirstChar { it.uppercase() },
|
||||||
|
color = Vojo.muted, fontSize = 12.5.sp, maxLines = 1, overflow = TextOverflow.Ellipsis,
|
||||||
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -47,10 +47,11 @@
|
||||||
<string name="stat_peak">Пик</string>
|
<string name="stat_peak">Пик</string>
|
||||||
<!-- Per-second suffix appended to a byte rate, e.g. "1.2 МБ/с" -->
|
<!-- Per-second suffix appended to a byte rate, e.g. "1.2 МБ/с" -->
|
||||||
<string name="rate_per_second">/с</string>
|
<string name="rate_per_second">/с</string>
|
||||||
<!-- Routing scope shown on the Tunnel tab; %1$s is a route_rules count -->
|
<!-- Routing scope shown on the Tunnel tab; %1$s is a route_rules count. Lower-case: the
|
||||||
<string name="route_scope_all">Весь трафик через прокси</string>
|
first letter is capitalised in code so an optional app-count clause can prefix it. -->
|
||||||
<string name="route_scope_only">Через прокси: %1$s</string>
|
<string name="route_scope_all">всё через прокси</string>
|
||||||
<string name="route_scope_except">Через прокси, кроме %1$s</string>
|
<string name="route_scope_only">через прокси: %1$s</string>
|
||||||
|
<string name="route_scope_except">через прокси, кроме %1$s</string>
|
||||||
|
|
||||||
<!-- Servers screen -->
|
<!-- Servers screen -->
|
||||||
<string name="server_add">Добавить сервер</string>
|
<string name="server_add">Добавить сервер</string>
|
||||||
|
|
@ -193,6 +194,12 @@
|
||||||
<item quantity="many">%d правил</item>
|
<item quantity="many">%d правил</item>
|
||||||
<item quantity="other">%d правила</item>
|
<item quantity="other">%d правила</item>
|
||||||
</plurals>
|
</plurals>
|
||||||
|
<plurals name="route_apps">
|
||||||
|
<item quantity="one">%d приложение</item>
|
||||||
|
<item quantity="few">%d приложения</item>
|
||||||
|
<item quantity="many">%d приложений</item>
|
||||||
|
<item quantity="other">%d приложения</item>
|
||||||
|
</plurals>
|
||||||
<plurals name="geosite_domains">
|
<plurals name="geosite_domains">
|
||||||
<item quantity="one">%d домен</item>
|
<item quantity="one">%d домен</item>
|
||||||
<item quantity="few">%d домена</item>
|
<item quantity="few">%d домена</item>
|
||||||
|
|
|
||||||
|
|
@ -54,10 +54,11 @@
|
||||||
<string name="stat_peak">Peak</string>
|
<string name="stat_peak">Peak</string>
|
||||||
<!-- Per-second suffix appended to a byte rate, e.g. "1.2 MB/s" -->
|
<!-- Per-second suffix appended to a byte rate, e.g. "1.2 MB/s" -->
|
||||||
<string name="rate_per_second">/s</string>
|
<string name="rate_per_second">/s</string>
|
||||||
<!-- Routing scope shown on the Tunnel tab; %1$s is a route_rules count -->
|
<!-- Routing scope shown on the Tunnel tab; %1$s is a route_rules count. Lower-case: the
|
||||||
<string name="route_scope_all">All traffic through the proxy</string>
|
first letter is capitalised in code so an optional app-count clause can prefix it. -->
|
||||||
<string name="route_scope_only">Through the proxy: %1$s</string>
|
<string name="route_scope_all">all through the proxy</string>
|
||||||
<string name="route_scope_except">Through the proxy, except %1$s</string>
|
<string name="route_scope_only">through the proxy: %1$s</string>
|
||||||
|
<string name="route_scope_except">through the proxy, except %1$s</string>
|
||||||
|
|
||||||
<!-- Servers screen -->
|
<!-- Servers screen -->
|
||||||
<string name="server_add">Add server</string>
|
<string name="server_add">Add server</string>
|
||||||
|
|
@ -200,6 +201,11 @@
|
||||||
<item quantity="one">%d rule</item>
|
<item quantity="one">%d rule</item>
|
||||||
<item quantity="other">%d rules</item>
|
<item quantity="other">%d rules</item>
|
||||||
</plurals>
|
</plurals>
|
||||||
|
|
||||||
|
<plurals name="route_apps">
|
||||||
|
<item quantity="one">%d app</item>
|
||||||
|
<item quantity="other">%d apps</item>
|
||||||
|
</plurals>
|
||||||
<plurals name="geosite_domains">
|
<plurals name="geosite_domains">
|
||||||
<item quantity="one">%d domain</item>
|
<item quantity="one">%d domain</item>
|
||||||
<item quantity="other">%d domains</item>
|
<item quantity="other">%d domains</item>
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue