File tree Expand file tree Collapse file tree
app/src/main/java/com/github/kr328/clash
design/src/main/java/com/github/kr328/clash/design Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -11,7 +11,10 @@ import com.github.kr328.clash.design.AccessControlDesign
1111import com.github.kr328.clash.design.model.AppInfo
1212import com.github.kr328.clash.design.util.toAppInfo
1313import com.github.kr328.clash.service.store.ServiceStore
14+ import com.github.kr328.clash.util.startClashService
15+ import com.github.kr328.clash.util.stopClashService
1416import kotlinx.coroutines.Dispatchers
17+ import kotlinx.coroutines.delay
1518import kotlinx.coroutines.isActive
1619import kotlinx.coroutines.selects.select
1720import kotlinx.coroutines.withContext
@@ -26,7 +29,15 @@ class AccessControlActivity : BaseActivity<AccessControlDesign>() {
2629
2730 defer {
2831 withContext(Dispatchers .IO ) {
32+ val changed = selected != service.accessControlPackages
2933 service.accessControlPackages = selected
34+ if (clashRunning && changed) {
35+ stopClashService()
36+ while (clashRunning) {
37+ delay(200 )
38+ }
39+ startClashService()
40+ }
3041 }
3142 }
3243
Original file line number Diff line number Diff line change @@ -128,8 +128,6 @@ class NetworkSettingsDesign(
128128 clicked {
129129 requests.trySend(Request .StartAccessControlList )
130130 }
131-
132- vpnDependencies.add(this )
133131 }
134132
135133 if (running) {
You can’t perform that action at this time.
0 commit comments