Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions app/src/main/java/com/github/kr328/clash/AccessControlActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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()
}
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -128,8 +128,6 @@ class NetworkSettingsDesign(
clicked {
requests.trySend(Request.StartAccessControlList)
}

vpnDependencies.add(this)
}

if (running) {
Expand Down
Loading