Commit 8dbbaccd authored by Daniel Wolf's avatar Daniel Wolf
Browse files
parents 014aa38a 4ce06ecb
......@@ -144,7 +144,7 @@ dependencies {
implementation 'com.github.jorgecastilloprz:fabprogresscircle:1.01@aar'
implementation 'com.squareup.leakcanary:leaksentry:2.0-alpha-3'
leakCanaryImplementation 'com.squareup.leakcanary:leakcanary-android:2.0-beta-3'
leakCanaryImplementation 'com.squareup.leakcanary:leakcanary-android:2.0'
testImplementation 'junit:junit:4.12'
testImplementation "org.robolectric:robolectric:4.3.1"
......
......@@ -86,7 +86,7 @@ class DnsQueryRepository(private val dnsQueryDao: DnsQueryDao) {
builder.append(query.type.name).append(",")
builder.append(query.type.value).append(",")
builder.append(query.askedServer).append(",")
builder.append(query.responseSource?.name ?: "").append(",")
builder.append(query.responseSource.name).append(",")
builder.append(query.questionTime).append(",")
builder.append(query.responseTime).append(",")
builder.append("\"").append(responseConverter.someObjectListToString(query.responses).replace(",", ";").replace("\"", "'")).append("\"")
......
......@@ -223,6 +223,7 @@ class SettingsFragment : PreferenceFragmentCompat() {
dialog.setTitle(R.string.dialog_clearqueries_title)
dialog.setPositiveButton(R.string.all_yes) { d, _ ->
requireContext().getDatabase().dnsQueryDao().deleteAll()
getPreferences().exportedQueryCount = 0
exportQueries.summary =
getString(R.string.summary_export_queries, 0)
d.dismiss()
......
......@@ -561,44 +561,50 @@ class DnsVpnService : VpnService(), Runnable {
}
private fun setNotificationText() {
val primaryServer: String
val secondaryServer: String?
if (serverConfig.httpsConfiguration != null) {
notificationBuilder.setContentTitle(getString(R.string.notification_main_title_https))
primaryServer = serverConfig.httpsConfiguration!![0].urlCreator.address.getUrl(true)
secondaryServer =
serverConfig.httpsConfiguration!!.getOrNull(1)?.urlCreator?.address?.getUrl(true)
} else {
notificationBuilder.setContentTitle(getString(R.string.notification_main_title_tls))
primaryServer = serverConfig.tlsConfiguration!![0].formatToString()
secondaryServer = serverConfig.tlsConfiguration!!.getOrNull(1)?.formatToString()
}
val text =
when {
getPreferences().simpleNotification -> getString(R.string.notification_simple_text, serverConfig.name)
secondaryServer != null -> getString(
if (getPreferences().isBypassBlacklist) R.string.notification_main_text_with_secondary else R.string.notification_main_text_with_secondary_whitelist,
primaryServer,
secondaryServer,
packageBypassAmount,
dnsProxy?.cache?.livingCachedEntries() ?: 0
)
else -> getString(
if (getPreferences().isBypassBlacklist) R.string.notification_main_text else R.string.notification_main_text_whitelist,
primaryServer,
packageBypassAmount,
dnsProxy?.cache?.livingCachedEntries() ?: 0
)
if (this::serverConfig.isInitialized) {
val primaryServer: String
val secondaryServer: String?
if (serverConfig.httpsConfiguration != null) {
notificationBuilder.setContentTitle(getString(R.string.notification_main_title_https))
primaryServer = serverConfig.httpsConfiguration!![0].urlCreator.address.getUrl(true)
secondaryServer =
serverConfig.httpsConfiguration!!.getOrNull(1)
?.urlCreator?.address?.getUrl(true)
} else {
notificationBuilder.setContentTitle(getString(R.string.notification_main_title_tls))
primaryServer = serverConfig.tlsConfiguration!![0].formatToString()
secondaryServer = serverConfig.tlsConfiguration!!.getOrNull(1)?.formatToString()
}
if(simpleNotification) {
notificationBuilder.setStyle(null)
notificationBuilder.setContentText(text)
} else {
notificationBuilder.setStyle(
NotificationCompat.BigTextStyle(notificationBuilder).bigText(
text
val text =
when {
getPreferences().simpleNotification -> getString(
R.string.notification_simple_text,
serverConfig.name
)
secondaryServer != null -> getString(
if (getPreferences().isBypassBlacklist) R.string.notification_main_text_with_secondary else R.string.notification_main_text_with_secondary_whitelist,
primaryServer,
secondaryServer,
packageBypassAmount,
dnsProxy?.cache?.livingCachedEntries() ?: 0
)
else -> getString(
if (getPreferences().isBypassBlacklist) R.string.notification_main_text else R.string.notification_main_text_whitelist,
primaryServer,
packageBypassAmount,
dnsProxy?.cache?.livingCachedEntries() ?: 0
)
}
if (simpleNotification) {
notificationBuilder.setStyle(null)
notificationBuilder.setContentText(text)
} else {
notificationBuilder.setStyle(
NotificationCompat.BigTextStyle(notificationBuilder).bigText(
text
)
)
)
}
}
}
......
......@@ -111,6 +111,7 @@ class QueryListener(private val context: Context) : QueryListener {
} ?: return
val wasInserted = queryLogState.remove(responseMessage.id)!! != 0 // Update if already inserted (0=insert)
query.responseTime = System.currentTimeMillis()
query.responses = mutableListOf()
for (answer in responseMessage.answerSection) {
query.addResponse(answer)
}
......
anr.enable=true
anr.enable=false
uncaught.handler.enabled=false
\ No newline at end of file
Supports Markdown
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