use set directly instead of toList

This commit is contained in:
Kr328 committed 2020-04-16 22:36:45 +08:00
1 parent a12444b258
commit a573631068
2 files changed
+8 -9

No files matched your search

@@ -134,17 +134,17 @@ class TunService : VpnService(), CoroutineScope by MainScope() {
get() = PRIVATE_VLAN_DNS
override val dnsHijacking: Boolean
get() = settings.get(ServiceSettings.DNS_HIJACKING)
override val allowApplications: List<String>
override val allowApplications: Collection<String>
get() {
return if (settings.get(ServiceSettings.ACCESS_CONTROL_MODE) == ServiceSettings.ACCESS_CONTROL_MODE_WHITELIST) {
(settings.get(ServiceSettings.ACCESS_CONTROL_PACKAGES) + packageName).toList()
} else emptyList()
(settings.get(ServiceSettings.ACCESS_CONTROL_PACKAGES) + packageName)
} else emptySet()
}
override val disallowApplication: List<String>
override val disallowApplication: Collection<String>
get() {
return if (settings.get(ServiceSettings.ACCESS_CONTROL_MODE) == ServiceSettings.ACCESS_CONTROL_MODE_BLACKLIST) {
(settings.get(ServiceSettings.ACCESS_CONTROL_PACKAGES) - packageName).toList()
} else emptyList()
(settings.get(ServiceSettings.ACCESS_CONTROL_PACKAGES) - packageName)
} else emptySet()
}
override fun onCreateTunFailure() {
@@ -1,7 +1,6 @@
package com.github.kr328.clash.service.clash.module
import android.app.PendingIntent
import android.content.Intent
import android.net.VpnService
import android.os.Build
import com.github.kr328.clash.common.Global
@@ -20,8 +19,8 @@ class TunModule(private val service: VpnService) : Module() {
val route: List<String>
val dnsAddress: String
val dnsHijacking: Boolean
val allowApplications: List<String>
val disallowApplication: List<String>
val allowApplications: Collection<String>
val disallowApplication: Collection<String>
fun onCreateTunFailure()
}