Commit 7c4316eb authored by Daniel Wolf's avatar Daniel Wolf
Browse files

Small cleanup

parent b2a76ed4
...@@ -45,8 +45,4 @@ captures/ ...@@ -45,8 +45,4 @@ captures/
libs/ libs/
libs/** libs/**
\ No newline at end of file
.idea/markdown-navigator-enh.xml
.idea/markdown-navigator.xml
.idea/navEditor.xml
\ No newline at end of file
...@@ -46,7 +46,7 @@ There are two options on how to use the DNS rules:<br> ...@@ -46,7 +46,7 @@ There are two options on how to use the DNS rules:<br>
You can either define your own rules - for example to block single hosts - or import *rule sources* which contain a list of rules.<br><br> You can either define your own rules - for example to block single hosts - or import *rule sources* which contain a list of rules.<br><br>
There are multiple lists maintained by independent people you can use in Nebulo. There are multiple lists maintained by independent people you can use in Nebulo.
They cover different topics, from blocking ads, tracking to blocking porn or social media.<br> They cover different topics, from blocking ads, tracking to blocking porn or social media.<br>
I recommend checking out [Energized](energized.pro). I recommend checking out [Energized](https://energized.pro).
It has multiple types of lists, covering use cases mentioned above. It has multiple types of lists, covering use cases mentioned above.
If you have the F-Droid version the Energized lists are already added as sources. If you have the F-Droid version the Energized lists are already added as sources.
......
...@@ -62,6 +62,7 @@ import java.util.logging.Level ...@@ -62,6 +62,7 @@ import java.util.logging.Level
* You can contact the developer at daniel.wolf@frostnerd.com. * You can contact the developer at daniel.wolf@frostnerd.com.
*/ */
@Suppress("DEPRECATION")
fun Context.canUseFingerprintAuthentication(): Boolean { fun Context.canUseFingerprintAuthentication(): Boolean {
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.M) return false if (Build.VERSION.SDK_INT < Build.VERSION_CODES.M) return false
val mgr = getSystemService(Context.FINGERPRINT_SERVICE) as? FingerprintManager val mgr = getSystemService(Context.FINGERPRINT_SERVICE) as? FingerprintManager
...@@ -72,6 +73,7 @@ fun Context.canUseFingerprintAuthentication(): Boolean { ...@@ -72,6 +73,7 @@ fun Context.canUseFingerprintAuthentication(): Boolean {
return true return true
} }
@Suppress("unused")
fun Context.registerReceiver(intentFilter: IntentFilter, receiver: (intent: Intent?) -> Unit): BroadcastReceiver { fun Context.registerReceiver(intentFilter: IntentFilter, receiver: (intent: Intent?) -> Unit): BroadcastReceiver {
val actualReceiver = object : BroadcastReceiver() { val actualReceiver = object : BroadcastReceiver() {
override fun onReceive(context: Context?, intent: Intent?) { override fun onReceive(context: Context?, intent: Intent?) {
...@@ -157,6 +159,7 @@ fun AppCompatActivity.registerLocalReceiver( ...@@ -157,6 +159,7 @@ fun AppCompatActivity.registerLocalReceiver(
mgr.registerReceiver(actualReceiver, filter) mgr.registerReceiver(actualReceiver, filter)
if(unregisterOnDestroy) lifecycle.addObserver(object:LifecycleObserver { if(unregisterOnDestroy) lifecycle.addObserver(object:LifecycleObserver {
@OnLifecycleEvent(Lifecycle.Event.ON_DESTROY) @OnLifecycleEvent(Lifecycle.Event.ON_DESTROY)
@Suppress("unused")
fun onDestroy() { fun onDestroy() {
mgr.unregisterReceiver(actualReceiver) mgr.unregisterReceiver(actualReceiver)
} }
...@@ -398,7 +401,7 @@ private fun createHttpsUpstreamAddress(url: String): HttpsUpstreamAddress { ...@@ -398,7 +401,7 @@ private fun createHttpsUpstreamAddress(url: String): HttpsUpstreamAddress {
} }
private fun createTlsUpstreamAddress(host: String): TLSUpstreamAddress { private fun createTlsUpstreamAddress(host: String): TLSUpstreamAddress {
var parsedHost = "" val parsedHost:String
var port: Int? = null var port: Int? = null
if (host.contains(":")) { if (host.contains(":")) {
parsedHost = host.split(":")[0] parsedHost = host.split(":")[0]
......
...@@ -138,7 +138,7 @@ fun Context.closeLogger() { ...@@ -138,7 +138,7 @@ fun Context.closeLogger() {
fun Context.deleteAllLogs() { fun Context.deleteAllLogs() {
if (Logger.isOpen()) if (Logger.isOpen())
Logger.getInstance(this).destroy() Logger.getInstance(this).destroy()
Logger.getLogDir(this).listFiles().forEach { Logger.getLogDir(this).listFiles()!!.forEach {
it.delete() it.delete()
} }
} }
...@@ -360,7 +360,7 @@ fun Context.zipAllLogFiles(): File? { ...@@ -360,7 +360,7 @@ fun Context.zipAllLogFiles(): File? {
if (zipFile.exists() && (!zipFile.canRead() || !zipFile.canWrite())) return null if (zipFile.exists() && (!zipFile.canRead() || !zipFile.canWrite())) return null
if (zipFile.exists()) zipFile.delete() if (zipFile.exists()) zipFile.delete()
var filesToBeZipped = dir.listFiles() var filesToBeZipped = dir.listFiles()!!
val dest = FileOutputStream(zipFile) val dest = FileOutputStream(zipFile)
val out = ZipOutputStream(BufferedOutputStream(dest)) val out = ZipOutputStream(BufferedOutputStream(dest))
val buffer = ByteArray(2048) val buffer = ByteArray(2048)
......
...@@ -65,15 +65,15 @@ class SmokeScreen : Application() { ...@@ -65,15 +65,15 @@ class SmokeScreen : Application() {
else { else {
context.log("Using fallback server: $to") context.log("Using fallback server: $to")
val configs = to.serverConfigurations.values val configs = to.serverConfigurations.values
AddressCreator.globalResolve = { AddressCreator.globalResolve = { domain ->
val responsesIpv4 = configs.random().query(Question(it, Record.TYPE.A))?.takeIf { val responsesIpv4 = configs.random().query(Question(domain, Record.TYPE.A))?.takeIf {
it.responseCode == DnsMessage.RESPONSE_CODE.NO_ERROR it.responseCode == DnsMessage.RESPONSE_CODE.NO_ERROR
}?.answerSection?.map { }?.answerSection?.map {
it.payload as A it.payload as A
}?.map { }?.map {
it.inetAddress it.inetAddress
} }
val responsesIpv6 = configs.random().query(Question(it, Record.TYPE.AAAA))?.takeIf { val responsesIpv6 = configs.random().query(Question(domain, Record.TYPE.AAAA))?.takeIf {
it.responseCode == DnsMessage.RESPONSE_CODE.NO_ERROR it.responseCode == DnsMessage.RESPONSE_CODE.NO_ERROR
}?.answerSection?.map { }?.answerSection?.map {
it.payload as AAAA it.payload as AAAA
...@@ -139,7 +139,7 @@ class SmokeScreen : Application() { ...@@ -139,7 +139,7 @@ class SmokeScreen : Application() {
log("Application created.") log("Application created.")
handleFallbackDns() handleFallbackDns()
loadKnownDNSServers() loadKnownDNSServers()
AbstractQuicDnsHandle.installProvider(this, {}) AbstractQuicDnsHandle.installProvider(this) {}
} }
private fun handleFallbackDns() { private fun handleFallbackDns() {
...@@ -275,7 +275,7 @@ class SmokeScreen : Application() { ...@@ -275,7 +275,7 @@ class SmokeScreen : Application() {
) { ) {
log("Sentry DSN retrieval returned invalid DSN '$retrievedDSN'.") log("Sentry DSN retrieval returned invalid DSN '$retrievedDSN'.")
} else { } else {
if (true || retrievedDSN != primaryDSN) { if (retrievedDSN != primaryDSN) {
log("Sentry DSN successfuly resolved to '$retrievedDSN'") log("Sentry DSN successfuly resolved to '$retrievedDSN'")
then(retrievedDSN) then(retrievedDSN)
} else log("Retrieved Sentry DSN is the same as configured DSN, not re-configuring") } else log("Retrieved Sentry DSN is the same as configured DSN, not re-configuring")
......
...@@ -10,6 +10,7 @@ import android.os.Bundle ...@@ -10,6 +10,7 @@ import android.os.Bundle
import android.os.PowerManager import android.os.PowerManager
import android.widget.Toast import android.widget.Toast
import androidx.appcompat.app.AlertDialog import androidx.appcompat.app.AlertDialog
import androidx.core.content.ContextCompat
import com.frostnerd.general.service.isServiceRunning import com.frostnerd.general.service.isServiceRunning
import com.frostnerd.lifecyclemanagement.launchWithLifecycle import com.frostnerd.lifecyclemanagement.launchWithLifecycle
import com.frostnerd.navigationdraweractivity.NavigationDrawerActivity import com.frostnerd.navigationdraweractivity.NavigationDrawerActivity
...@@ -94,7 +95,7 @@ class MainActivity : NavigationDrawerActivity() { ...@@ -94,7 +95,7 @@ class MainActivity : NavigationDrawerActivity() {
setTheme(getPreferences().theme.layoutStyle) setTheme(getPreferences().theme.layoutStyle)
super.onCreate(savedInstanceState) super.onCreate(savedInstanceState)
Notifications.createAllChannels(this) Notifications.createAllChannels(this)
setCardView { viewParent, suggestedHeight -> setCardView { viewParent, _ ->
val view = layoutInflater.inflate(R.layout.menu_cardview, viewParent, false) val view = layoutInflater.inflate(R.layout.menu_cardview, viewParent, false)
val update = { val update = {
launchWithLifecycle { launchWithLifecycle {
...@@ -283,11 +284,11 @@ class MainActivity : NavigationDrawerActivity() { ...@@ -283,11 +284,11 @@ class MainActivity : NavigationDrawerActivity() {
override fun createDrawerItems(): MutableList<DrawerItem> { override fun createDrawerItems(): MutableList<DrawerItem> {
return createMenu { return createMenu {
fragmentItem(getString(R.string.menu_main), fragmentItem(getString(R.string.menu_main),
iconLeft = getDrawable(R.drawable.ic_menu_dnsoverhttps), iconLeft = ContextCompat.getDrawable(this@MainActivity, R.drawable.ic_menu_dnsoverhttps),
fragmentCreator = singleInstanceFragment { MainFragment() } fragmentCreator = singleInstanceFragment { MainFragment() }
) )
fragmentItem(getString(R.string.menu_settings), fragmentItem(getString(R.string.menu_settings),
iconLeft = getDrawable(R.drawable.ic_menu_settings), iconLeft = ContextCompat.getDrawable(this@MainActivity, R.drawable.ic_menu_settings),
fragmentCreator = singleInstanceFragment { args -> fragmentCreator = singleInstanceFragment { args ->
SettingsOverviewFragment().also { SettingsOverviewFragment().also {
it.arguments = args it.arguments = args
...@@ -296,7 +297,7 @@ class MainActivity : NavigationDrawerActivity() { ...@@ -296,7 +297,7 @@ class MainActivity : NavigationDrawerActivity() {
if (getPreferences().queryLoggingEnabled) { if (getPreferences().queryLoggingEnabled) {
divider() divider()
fragmentItem(getString(R.string.menu_querylogging), fragmentItem(getString(R.string.menu_querylogging),
iconLeft = getDrawable(R.drawable.ic_eye), iconLeft = ContextCompat.getDrawable(this@MainActivity, R.drawable.ic_eye),
fragmentCreator = { fragmentCreator = {
QueryLogFragment() QueryLogFragment()
}) })
...@@ -304,7 +305,7 @@ class MainActivity : NavigationDrawerActivity() { ...@@ -304,7 +305,7 @@ class MainActivity : NavigationDrawerActivity() {
} }
divider() divider()
clickableItem(getString(R.string.menu_create_shortcut), clickableItem(getString(R.string.menu_create_shortcut),
iconLeft = getDrawable(R.drawable.ic_external_link), iconLeft = ContextCompat.getDrawable(this@MainActivity, R.drawable.ic_external_link),
onLongClick = null, onLongClick = null,
onSimpleClick = { _, _, _ -> onSimpleClick = { _, _, _ ->
ServerChoosalDialog(this@MainActivity, onEntrySelected = { ServerChoosalDialog(this@MainActivity, onEntrySelected = {
...@@ -313,14 +314,14 @@ class MainActivity : NavigationDrawerActivity() { ...@@ -313,14 +314,14 @@ class MainActivity : NavigationDrawerActivity() {
false false
}) })
fragmentItem(getString(R.string.button_main_dnsrules), fragmentItem(getString(R.string.button_main_dnsrules),
iconLeft = getDrawable(R.drawable.ic_view_list), iconLeft = ContextCompat.getDrawable(this@MainActivity, R.drawable.ic_view_list),
fragmentCreator = { fragmentCreator = {
DnsRuleFragment() DnsRuleFragment()
}) })
divider() divider()
if (isPackageInstalled(this@MainActivity, "com.android.vending")) { if (isPackageInstalled(this@MainActivity, "com.android.vending")) {
clickableItem(getString(R.string.menu_rate), clickableItem(getString(R.string.menu_rate),
iconLeft = getDrawable(R.drawable.ic_star), iconLeft = ContextCompat.getDrawable(this@MainActivity, R.drawable.ic_star),
onLongClick = null, onLongClick = null,
onSimpleClick = { _, _, _ -> onSimpleClick = { _, _, _ ->
AlertDialog.Builder(this@MainActivity, getPreferences().theme.dialogStyle) AlertDialog.Builder(this@MainActivity, getPreferences().theme.dialogStyle)
...@@ -337,7 +338,7 @@ class MainActivity : NavigationDrawerActivity() { ...@@ -337,7 +338,7 @@ class MainActivity : NavigationDrawerActivity() {
} }
if (isPackageInstalled(this@MainActivity, "org.fdroid.fdroid")) { if (isPackageInstalled(this@MainActivity, "org.fdroid.fdroid")) {
clickableItem(getString(R.string.menu_show_on_fdroid), clickableItem(getString(R.string.menu_show_on_fdroid),
iconLeft = getDrawable(R.drawable.ic_adb), iconLeft = ContextCompat.getDrawable(this@MainActivity, R.drawable.ic_adb),
onLongClick = null, onLongClick = null,
onSimpleClick = { _, _, _ -> onSimpleClick = { _, _, _ ->
startActivity( startActivity(
...@@ -351,7 +352,7 @@ class MainActivity : NavigationDrawerActivity() { ...@@ -351,7 +352,7 @@ class MainActivity : NavigationDrawerActivity() {
) )
} }
fragmentItem(getString(R.string.menu_about), fragmentItem(getString(R.string.menu_about),
iconLeft = getDrawable(R.drawable.ic_info), iconLeft = ContextCompat.getDrawable(this@MainActivity, R.drawable.ic_info),
fragmentCreator = singleInstanceFragment { AboutFragment() }) fragmentCreator = singleInstanceFragment { AboutFragment() })
} }
} }
......
...@@ -54,6 +54,7 @@ import java.security.NoSuchAlgorithmException ...@@ -54,6 +54,7 @@ import java.security.NoSuchAlgorithmException
class PinActivity: BaseActivity() { class PinActivity: BaseActivity() {
companion object { companion object {
@Suppress("MemberVisibilityCanBePrivate")
const val PIN_TIMEOUTMS = 2*60*1000 const val PIN_TIMEOUTMS = 2*60*1000
fun shouldValidatePin(context: Context, intent: Intent?): Boolean { fun shouldValidatePin(context: Context, intent: Intent?): Boolean {
...@@ -133,7 +134,7 @@ class PinActivity: BaseActivity() { ...@@ -133,7 +134,7 @@ class PinActivity: BaseActivity() {
setTheme(getPreferences().theme.dialogStyle) setTheme(getPreferences().theme.dialogStyle)
super.onCreate(savedInstanceState) super.onCreate(savedInstanceState)
if(!getPreferences().enablePin) { if(!getPreferences().enablePin) {
onPinPassed(false) onPinPassed()
} else { } else {
val view = layoutInflater.inflate(R.layout.dialog_pin, null, false) val view = layoutInflater.inflate(R.layout.dialog_pin, null, false)
val handler = Handler() val handler = Handler()
...@@ -201,7 +202,7 @@ class PinActivity: BaseActivity() { ...@@ -201,7 +202,7 @@ class PinActivity: BaseActivity() {
return intent?.getSerializableExtra("pin_type") as? PinType ?: PinType.APP return intent?.getSerializableExtra("pin_type") as? PinType ?: PinType.APP
} }
private fun onPinPassed(pinEnabled:Boolean = true) { private fun onPinPassed() {
when(getPinType()) { when(getPinType()) {
PinType.APP -> if(getPreferences().shouldShowAppIntro()) { PinType.APP -> if(getPreferences().shouldShowAppIntro()) {
val startIntent = Intent(this, NebuloAppIntro::class.java) val startIntent = Intent(this, NebuloAppIntro::class.java)
......
package com.frostnerd.smokescreen.activity package com.frostnerd.smokescreen.activity
import android.annotation.SuppressLint
import android.content.Context import android.content.Context
import android.graphics.Color import android.graphics.Color
import android.os.Bundle import android.os.Bundle
import android.view.View import android.view.View
import android.widget.LinearLayout
import android.widget.ProgressBar
import android.widget.TextView
import androidx.recyclerview.widget.LinearLayoutManager import androidx.recyclerview.widget.LinearLayoutManager
import androidx.recyclerview.widget.RecyclerView import androidx.recyclerview.widget.RecyclerView
import com.frostnerd.cacheadapter.AdapterBuilder import com.frostnerd.cacheadapter.AdapterBuilder
...@@ -47,6 +51,7 @@ import kotlinx.coroutines.Job ...@@ -47,6 +51,7 @@ import kotlinx.coroutines.Job
* You can contact the developer at daniel.wolf@frostnerd.com. * You can contact the developer at daniel.wolf@frostnerd.com.
*/ */
@SuppressLint("SetTextI18n")
class SpeedTestActivity : BaseActivity() { class SpeedTestActivity : BaseActivity() {
private var testRunning = false private var testRunning = false
private var wasStartedBefore = false private var wasStartedBefore = false
...@@ -98,13 +103,13 @@ class SpeedTestActivity : BaseActivity() { ...@@ -98,13 +103,13 @@ class SpeedTestActivity : BaseActivity() {
val dohReachable = testResults!!.count {it.server.type == ServerType.DOH && it.latency != null} val dohReachable = testResults!!.count {it.server.type == ServerType.DOH && it.latency != null}
val dohNotReachable = dohCount - dohReachable val dohNotReachable = dohCount - dohReachable
val doqCount = testResults!!.count { it.server.type == ServerType.DOQ } /*val doqCount = testResults!!.count { it.server.type == ServerType.DOQ }
val doqReachable = testResults!!.count {it.server.type == ServerType.DOQ && it.latency != null} val doqReachable = testResults!!.count {it.server.type == ServerType.DOQ && it.latency != null}
val doqNotReachable = dohCount - dohReachable val doqNotReachable = dohCount - dohReachable */
val avgLatency = testResults!!.sumBy { it.latency ?: 0 }/testResults!!.size val avgLatency = testResults!!.sumBy { it.latency ?: 0 }/testResults!!.size
val fastestServer = testResults!!.minBy { it.latency ?: Integer.MAX_VALUE} val fastestServer = testResults!!.minByOrNull { it.latency ?: Integer.MAX_VALUE }
val slowestServer = testResults!!.maxBy { it.latency ?: 0} val slowestServer = testResults!!.maxByOrNull { it.latency ?: 0 }
showInfoTextDialog(this, showInfoTextDialog(this,
getString(R.string.dialog_speedresult_title), getString(R.string.dialog_speedresult_title),
...@@ -238,12 +243,12 @@ class SpeedTestActivity : BaseActivity() { ...@@ -238,12 +243,12 @@ class SpeedTestActivity : BaseActivity() {
} }
private inner class SpeedViewHolder(view: View, private val showUseServerDialog:(SpeedTest) -> Any) : BaseViewHolder(view) { private inner class SpeedViewHolder(view: View, private val showUseServerDialog:(SpeedTest) -> Any) : BaseViewHolder(view) {
val name = view.name val name: TextView = view.name
val servers = view.servers val servers: TextView = view.servers
val progress = view.progress val progress: ProgressBar = view.progress
val latency = view.latency val latency: TextView = view.latency
val serverType = view.serverType val serverType: TextView = view.serverType
val nameWrap = view.nameWrap val nameWrap: LinearLayout = view.nameWrap
private var defaultTextColor = latency.currentTextColor private var defaultTextColor = latency.currentTextColor
fun display(speedTest: SpeedTest) { fun display(speedTest: SpeedTest) {
......
...@@ -154,6 +154,7 @@ private fun migration( ...@@ -154,6 +154,7 @@ private fun migration(
} }
} }
@Suppress("unused")
private fun emptyMigration(from: Int, to: Int = AppDatabase.currentVersion): Migration { private fun emptyMigration(from: Int, to: Int = AppDatabase.currentVersion): Migration {
return migration(from, to) { } return migration(from, to) { }
} }
......
...@@ -38,15 +38,15 @@ import java.io.FileWriter ...@@ -38,15 +38,15 @@ import java.io.FileWriter
class DnsQueryRepository(private val dnsQueryDao: DnsQueryDao) { class DnsQueryRepository(private val dnsQueryDao: DnsQueryDao) {
fun getAllWithFilterLive(filterConfig: QueryLogFilterDialog.FilterConfig): LiveData<List<DnsQuery>> { fun getAllWithFilterLive(filterConfig: QueryLogFilterDialog.FilterConfig): LiveData<List<DnsQuery>> {
return dnsQueryDao.getAllWithFilterLive(filterConfig.showForwarded, filterConfig.showCache, filterConfig.showDnsrules, filterConfig.showBlockedByDns).let { return filterDnsQuery(filterConfig,
filterDnsQuery(filterConfig, it) dnsQueryDao.getAllWithFilterLive(filterConfig.showForwarded, filterConfig.showCache, filterConfig.showDnsrules, filterConfig.showBlockedByDns)
} )
} }
fun getAllWithHostAndFilterLive(hostPart:String, filterConfig: QueryLogFilterDialog.FilterConfig): LiveData<List<DnsQuery>> { fun getAllWithHostAndFilterLive(hostPart:String, filterConfig: QueryLogFilterDialog.FilterConfig): LiveData<List<DnsQuery>> {
return dnsQueryDao.getAllWithHostAndFilterLive(hostPart, filterConfig.showForwarded, filterConfig.showCache, filterConfig.showDnsrules, filterConfig.showBlockedByDns).let { return filterDnsQuery(filterConfig,
filterDnsQuery(filterConfig, it) dnsQueryDao.getAllWithHostAndFilterLive(hostPart, filterConfig.showForwarded, filterConfig.showCache, filterConfig.showDnsrules, filterConfig.showBlockedByDns)
} )
} }
private fun filterDnsQuery(filterConfig: QueryLogFilterDialog.FilterConfig, liveData: LiveData<List<DnsQuery>>):LiveData<List<DnsQuery>> { private fun filterDnsQuery(filterConfig: QueryLogFilterDialog.FilterConfig, liveData: LiveData<List<DnsQuery>>):LiveData<List<DnsQuery>> {
......
...@@ -96,21 +96,21 @@ class DnsRuleDialog(context: Context, dnsRule: DnsRule? = null, onRuleCreated: ( ...@@ -96,21 +96,21 @@ class DnsRuleDialog(context: Context, dnsRule: DnsRule? = null, onRuleCreated: (
!view.ipv4Address.text.isNullOrBlank() -> Record.TYPE.A !view.ipv4Address.text.isNullOrBlank() -> Record.TYPE.A
else -> Record.TYPE.AAAA else -> Record.TYPE.AAAA
} }
val primaryTarget = if (isWhitelist) { val primaryTarget = when {
"" isWhitelist -> ""
} else if(isBlockHost) { isBlockHost -> "0.0.0.0"
"0.0.0.0" else -> when (type) {
} else when (type) { Record.TYPE.A, Record.TYPE.ANY -> view.ipv4Address.text.toString()
Record.TYPE.A, Record.TYPE.ANY -> view.ipv4Address.text.toString() else -> view.ipv6Address.text.toString()
else -> view.ipv6Address.text.toString() }
} }
val secondaryTarget = if (isWhitelist) { val secondaryTarget = when {
null isWhitelist -> null
} else if(isBlockHost){ isBlockHost -> "::"
"::" else -> when (type) {
}else when (type) { Record.TYPE.AAAA, Record.TYPE.ANY -> view.ipv6Address.text.toString()
Record.TYPE.AAAA, Record.TYPE.ANY -> view.ipv6Address.text.toString() else -> null
else -> null }
} }
var isWildcard = false var isWildcard = false
val host = view.host.text.toString().let { val host = view.host.text.toString().let {
......
...@@ -36,7 +36,7 @@ import kotlin.coroutines.CoroutineContext ...@@ -36,7 +36,7 @@ import kotlin.coroutines.CoroutineContext
class DnsRuleSearchDialog( class DnsRuleSearchDialog(
context: Context context: Context
):AlertDialog(context, context.getPreferences().theme.dialogStyle), CoroutineScope { ):AlertDialog(context, context.getPreferences().theme.dialogStyle), CoroutineScope {
val supervisor = SupervisorJob() private val supervisor = SupervisorJob()
override val coroutineContext: CoroutineContext = supervisor + Dispatchers.IO override val coroutineContext: CoroutineContext = supervisor + Dispatchers.IO
var currentSearchJob:Job? = null var currentSearchJob:Job? = null
......
...@@ -62,7 +62,12 @@ class QueryLogFilterDialog ( ...@@ -62,7 +62,12 @@ class QueryLogFilterDialog (
val showAll = showForwarded && showCache && showDnsrules && showBlockedByDns val showAll = showForwarded && showCache && showDnsrules && showBlockedByDns
companion object { companion object {
val showAllConfig = FilterConfig(true, true, true, true) val showAllConfig = FilterConfig(
showForwarded = true,
showCache = true,
showDnsrules = true,
showBlockedByDns = true
)
} }
} }
} }
\ No newline at end of file
...@@ -136,26 +136,30 @@ class ServerChoosalDialog( ...@@ -136,26 +136,30 @@ class ServerChoosalDialog(
} }
private fun loadServerData(type:ServerType) { private fun loadServerData(type:ServerType) {
if (type == ServerType.DOT) { when (type) {
val hiddenServers = context.getPreferences().removedDefaultDoTServers ServerType.DOT -> {
defaultConfig = AbstractTLSDnsHandle.waitUntilKnownServersArePopulated { servers -> val hiddenServers = context.getPreferences().removedDefaultDoTServers
servers.filter { defaultConfig = AbstractTLSDnsHandle.waitUntilKnownServersArePopulated { servers ->
it.key !in hiddenServers servers.filter {
}.values.toList() it.key !in hiddenServers
}.values.toList()
}
} }
} else if(type == ServerType.DOH){ ServerType.DOH -> {
val hiddenServers = context.getPreferences().removedDefaultDoHServers