Trigger managed mode scan when enabling per-app proxy

This commit is contained in:
世界
2025-12-24 16:50:14 +08:00
parent b1f0ba2417
commit 104da5d312

View File

@@ -208,15 +208,32 @@ fun ProfileOverrideScreen(navController: NavController) {
}, },
trailingContent = { trailingContent = {
if (isPerAppProxyAvailable) { if (isPerAppProxyAvailable) {
Switch( if (isScanning) {
checked = perAppProxyEnabled, CircularProgressIndicator(
onCheckedChange = { checked -> modifier = Modifier.size(24.dp),
perAppProxyEnabled = checked strokeWidth = 2.dp,
scope.launch(Dispatchers.IO) { )
Settings.perAppProxyEnabled = checked } else {
} Switch(
}, checked = perAppProxyEnabled,
) onCheckedChange = { checked ->
perAppProxyEnabled = checked
scope.launch(Dispatchers.IO) {
Settings.perAppProxyEnabled = checked
}
if (checked && managedModeEnabled) {
isScanning = true
scope.launch {
val chinaApps = scanAllChinaApps()
withContext(Dispatchers.IO) {
Settings.perAppProxyManagedList = chinaApps
}
isScanning = false
}
}
},
)
}
} }
}, },
modifier = modifier =