mirror of
https://github.com/MetaCubeX/ClashMetaForAndroid.git
synced 2026-06-14 21:08:28 +08:00
allow change access packages when vpn enabled (#560)
This commit is contained in:
parent
4ece5c4315
commit
99cbc449c2
@ -11,7 +11,10 @@ import com.github.kr328.clash.design.AccessControlDesign
|
||||
import com.github.kr328.clash.design.model.AppInfo
|
||||
import com.github.kr328.clash.design.util.toAppInfo
|
||||
import com.github.kr328.clash.service.store.ServiceStore
|
||||
import com.github.kr328.clash.util.startClashService
|
||||
import com.github.kr328.clash.util.stopClashService
|
||||
import kotlinx.coroutines.Dispatchers
|
||||
import kotlinx.coroutines.delay
|
||||
import kotlinx.coroutines.isActive
|
||||
import kotlinx.coroutines.selects.select
|
||||
import kotlinx.coroutines.withContext
|
||||
@ -26,7 +29,15 @@ class AccessControlActivity : BaseActivity<AccessControlDesign>() {
|
||||
|
||||
defer {
|
||||
withContext(Dispatchers.IO) {
|
||||
val changed = selected != service.accessControlPackages
|
||||
service.accessControlPackages = selected
|
||||
if (clashRunning && changed) {
|
||||
stopClashService()
|
||||
while (clashRunning) {
|
||||
delay(200)
|
||||
}
|
||||
startClashService()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -128,8 +128,6 @@ class NetworkSettingsDesign(
|
||||
clicked {
|
||||
requests.trySend(Request.StartAccessControlList)
|
||||
}
|
||||
|
||||
vpnDependencies.add(this)
|
||||
}
|
||||
|
||||
if (running) {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user