Skip to content
Snippets Groups Projects
Commit fc5c3aa6 authored by Matthew Finkel's avatar Matthew Finkel
Browse files

fixup! Bug 40028: Implement Tor connect and logger screens

parent 50a2e757
Branches
No related tags found
1 merge request!26Bug 40041 09
......@@ -31,9 +31,9 @@ class TorBootstrapLoggerViewHolder(
filter { !(it.first!!.startsWith("Circuit") && it.second == "ON") }.
// Keep synchronized with format in onTorStatusUpdate
flatMap { listOf("(${it.second}) '${it.first}'") }
val entries_len = currentEntries.size
val subListOffset = if (entries_len > 24) 24 else entries_len
entries = currentEntries.subList((entries_len - subListOffset), entries_len) as MutableList<String>
val entriesLen = currentEntries.size
val subListOffset = if (entriesLen > MAX_NEW_ENTRIES) MAX_NEW_ENTRIES else entriesLen
entries = currentEntries.subList((entriesLen - subListOffset), entriesLen) as MutableList<String>
val initLog = "---------------" + view.resources.getString(R.string.tor_initializing_log) + "---------------"
entries.add(0, initLog)
......@@ -45,6 +45,7 @@ class TorBootstrapLoggerViewHolder(
private fun formatLogEntries(entries: List<String>) = entries.joinToString("\n")
@SuppressWarnings("EmptyFunctionBlock")
override fun onTorConnecting() {
}
......@@ -52,6 +53,7 @@ class TorBootstrapLoggerViewHolder(
components.torController.unregisterTorListener(this)
}
@SuppressWarnings("EmptyFunctionBlock")
override fun onTorStopped() {
}
......@@ -59,7 +61,7 @@ class TorBootstrapLoggerViewHolder(
if (status == null || entry == null) return
if (status == "ON" && entry.startsWith("Circuit")) return
if (entries.size > 25) {
if (entries.size > MAX_LINES) {
entries = entries.drop(1) as MutableList<String>
}
entries.add("(${status}) '${entry}'")
......@@ -69,5 +71,7 @@ class TorBootstrapLoggerViewHolder(
companion object {
const val LAYOUT_ID = R.layout.tor_bootstrap_logger
const val MAX_NEW_ENTRIES = 24
const val MAX_LINES = 25
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment