Commit e367e568 authored by Daniel Wolf's avatar Daniel Wolf
Browse files

Some more cleanup

parent 7c4316eb
Pipeline #7680 passed with stage
in 4 minutes and 19 seconds
......@@ -174,6 +174,7 @@ class DnsRuleDialog(context: Context, dnsRule: DnsRule? = null, onRuleCreated: (
view.ipv4Address.setText(dnsRule.target)
view.ipv6Address.setText(dnsRule.ipv6Target)
}
else -> {}
}
isBlockHost = dnsRule.target == "0.0.0.0" && dnsRule.ipv6Target?.equalsAny("::1", "::") == true
}
......
......@@ -320,10 +320,6 @@ class NewServerDialog(
R.string.dialog_doh_detect_type_title,
R.string.dialog_doh_detect_type_message
)
val httpClient = OkHttpClient.Builder()
.connectTimeout(1250, TimeUnit.MILLISECONDS)
.readTimeout(1250, TimeUnit.MILLISECONDS)
.build()
dialog.show()
GlobalScope.launch {
val availableTypes = mapOf(
......
......@@ -98,7 +98,7 @@ class ServerImportDialog(context: Context, loadedServers: List<DnsServerInformat
private fun doImport() {
val prefs = context.getPreferences()
prefs.edit {
val servers = servers.filterIndexed { index, item ->
val servers = servers.filterIndexed { index, _ ->
selectedServerPositions.contains(index)
}
prefs.addUserServerConfiguration(servers)
......@@ -109,7 +109,7 @@ class ServerImportDialog(context: Context, loadedServers: List<DnsServerInformat
val name: TextView = itemView.findViewById(R.id.name)
private val urls = itemView.findViewById<TextView>(R.id.urls)
private val capabilities = itemView.findViewById<TextView>(R.id.capabilities)
val selected = itemView.findViewById<CheckBox>(R.id.checkbox)
val selected: CheckBox = itemView.findViewById(R.id.checkbox)
private val serverType = itemView.findViewById<TextView>(R.id.serverType)
override fun destroy() {
......
......@@ -213,9 +213,9 @@ class DnsRuleFragment : Fragment() {
adapterDataSource = ListDataSource(sourceAdapterList)
var showUserRules = false
var userRuleCount = 0
sourceAdapter = ModelAdapterBuilder.withModelAndViewHolder({ view, type ->
sourceAdapter = ModelAdapterBuilder.withModelAndViewHolder({ itemView, type ->
when (type) {
0 -> SourceViewHolder(view, deleteSource = {
0 -> SourceViewHolder(itemView, deleteSource = {
showInfoTextDialog(requireContext(),
getString(R.string.dialog_deletehostsource_title, it.name),
getString(R.string.dialog_deletehostsource_message, it.name),
......@@ -268,7 +268,7 @@ class DnsRuleFragment : Fragment() {
refreshProgressShown = true
})
1 -> CustomRulesViewHolder(
view,
itemView,
changeSourceStatus = {
getPreferences().customHostsEnabled = it
},
......@@ -364,7 +364,7 @@ class DnsRuleFragment : Fragment() {
}
}).show()
})
else -> CustomRuleHostViewHolder(view, deleteRule = {
else -> CustomRuleHostViewHolder(itemView, deleteRule = {
val index = userDnsRules.indexOf(it)
userDnsRules.remove(it)
getDatabase().dnsRuleRepository().removeAsync(it)
......
......@@ -310,7 +310,7 @@ class MainFragment : Fragment() {
}
private fun updatePrivacyPolicyLink(serverInfo: DnsServerInformation<*>) {
activity?.let { activity ->
activity?.let { _ ->
if (!serverInfo.specification.privacyPolicyURL.isNullOrBlank()) {
launchWithLifecycle {
val url = URL(serverInfo.specification.privacyPolicyURL)
......
......@@ -228,7 +228,7 @@ class ConfigureActivity : BaseActivity() {
}
})
editText.setOnFocusChangeListener { _, hasFocus ->
editText.setOnFocusChangeListener { _, _ ->
setHints()
}
}
......
......@@ -86,6 +86,7 @@ class DnsSpeedTest(context:Context,
for (i in 0 until passes) {
when(server.type) {
ServerType.DOT -> {
@Suppress("UNCHECKED_CAST")
(server as DnsServerInformation<TLSUpstreamAddress>).servers.forEach {
if(firstPass) testTls(it.address)
latencies += testTls(it.address) ?: 0
......@@ -105,6 +106,7 @@ class DnsSpeedTest(context:Context,
}
}
ServerType.DOQ -> {
@Suppress("UNCHECKED_CAST")
(server as DnsServerInformation<QuicUpstreamAddress>).servers.forEach {
if(cronetEngine != null) {
if(firstPass) testQuic(it.address)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment