mirror of
https://github.com/wgtunnel/android.git
synced 2026-07-03 14:07:49 +02:00
+2
-2
@@ -36,13 +36,13 @@ fun SplitTunnelScreen(tunnelId: Int, viewModel: SplitTunnelViewModel = hiltViewM
|
||||
val conf by remember { derivedStateOf { tunnelConf.toAmConfig() } }
|
||||
|
||||
var splitConfig by remember {
|
||||
mutableStateOf<Pair<SplitOption, Set<String>>>(
|
||||
mutableStateOf(
|
||||
when {
|
||||
conf.`interface`.excludedApplications.isNotEmpty() ->
|
||||
Pair(SplitOption.EXCLUDE, conf.`interface`.excludedApplications.toSet())
|
||||
conf.`interface`.includedApplications.isNotEmpty() ->
|
||||
Pair(SplitOption.INCLUDE, conf.`interface`.includedApplications.toSet())
|
||||
else -> Pair(SplitOption.ALL, emptySet())
|
||||
else -> Pair(SplitOption.ALL, emptySet<String>())
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
+7
-1
@@ -31,6 +31,7 @@ fun AppListSection(
|
||||
) {
|
||||
|
||||
var query by remember { mutableStateOf("") }
|
||||
val locale = remember { Locale.getDefault() }
|
||||
|
||||
val filteredAndSortedPackages by remember {
|
||||
derivedStateOf {
|
||||
@@ -40,7 +41,12 @@ fun AppListSection(
|
||||
pkg.name.contains(query, ignoreCase = true) ||
|
||||
pkg.packageName.contains(query, ignoreCase = true)
|
||||
}
|
||||
.sortedBy { pkg -> pkg.name.lowercase(Locale.getDefault()) }
|
||||
.sortedWith(
|
||||
compareByDescending<InstalledPackage> {
|
||||
splitConfig.second.contains(it.packageName)
|
||||
}
|
||||
.thenBy { it.name.lowercase(locale) }
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user