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

fixup! Bug 40028: Implement Tor connect and logger screens

parent fc5c3aa6
No related branches found
No related tags found
1 merge request!26Bug 40041 09
......@@ -5,7 +5,6 @@
package org.mozilla.fenix.home.sessioncontrol.viewholders
import android.view.View
import android.widget.ProgressBar
import androidx.appcompat.widget.SwitchCompat
import androidx.recyclerview.widget.RecyclerView
import kotlinx.android.synthetic.main.tor_bootstrap_connect.view.*
......@@ -14,9 +13,6 @@ import org.mozilla.fenix.tor.TorEvents
import org.mozilla.fenix.tor.bootstrap.TorQuickStart
import org.mozilla.fenix.components.Components
import org.mozilla.fenix.home.sessioncontrol.TorBootstrapInteractor
import org.mozilla.fenix.tor.TorController
import org.torproject.android.service.TorServiceConstants
class TorBootstrapConnectViewHolder(
private val view: View,
......@@ -52,7 +48,6 @@ class TorBootstrapConnectViewHolder(
}
}
with(view.tor_bootstrap_connect_button) {
setOnClickListener {
interactor.onTorBootstrapConnectClicked()
......@@ -66,7 +61,7 @@ class TorBootstrapConnectViewHolder(
}
}
components.torController.registerTorListener(this);
components.torController.registerTorListener(this)
}
private fun setQuickStartDescription(view: View, torQuickStart: TorQuickStart) {
......@@ -88,7 +83,7 @@ class TorBootstrapConnectViewHolder(
}
override fun onTorConnected() {
components.torController.unregisterTorListener(this);
components.torController.unregisterTorListener(this)
}
@SuppressWarnings("EmptyFunctionBlock")
......
......
......@@ -4,7 +4,6 @@
package org.mozilla.fenix.home.sessioncontrol.viewholders
import android.text.method.MovementMethod
import android.text.method.ScrollingMovementMethod
import android.view.View
import androidx.recyclerview.widget.RecyclerView
......@@ -12,9 +11,6 @@ import kotlinx.android.synthetic.main.tor_bootstrap_logger.view.*
import org.mozilla.fenix.R
import org.mozilla.fenix.tor.TorEvents
import org.mozilla.fenix.components.Components
import org.mozilla.fenix.home.sessioncontrol.TorBootstrapInteractor
import org.torproject.android.service.TorServiceConstants
class TorBootstrapLoggerViewHolder(
private val view: View,
......@@ -24,13 +20,13 @@ class TorBootstrapLoggerViewHolder(
private var entries = mutableListOf<String>()
init {
components.torController.registerTorListener(this);
components.torController.registerTorListener(this)
val currentEntries = components.torController.logEntries.
filter { it.first != null }.
filter { !(it.first!!.startsWith("Circuit") && it.second == "ON") }.
val currentEntries = components.torController.logEntries
.filter { it.first != null }
.filter { !(it.first!!.startsWith("Circuit") && it.second == "ON") }
// Keep synchronized with format in onTorStatusUpdate
flatMap { listOf("(${it.second}) '${it.first}'") }
.flatMap { listOf("(${it.second}) '${it.first}'") }
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>
......@@ -64,7 +60,7 @@ class TorBootstrapLoggerViewHolder(
if (entries.size > MAX_LINES) {
entries = entries.drop(1) as MutableList<String>
}
entries.add("(${status}) '${entry}'")
entries.add("($status) '$entry'")
view.tor_bootstrap_log_entries.text = formatLogEntries(entries)
}
......
......
......@@ -5,12 +5,7 @@
package org.mozilla.fenix.home.sessioncontrol.viewholders
import android.view.View
import androidx.core.view.updateLayoutParams
import androidx.recyclerview.widget.RecyclerView
import androidx.viewpager2.widget.ViewPager2
import com.google.android.material.appbar.AppBarLayout
import com.google.android.material.appbar.AppBarLayout.LayoutParams
import com.google.android.material.appbar.AppBarLayout.LayoutParams.SCROLL_FLAG_NO_SCROLL
import kotlinx.android.synthetic.main.tor_bootstrap_pager.view.*
import org.mozilla.fenix.R
import org.mozilla.fenix.components.Components
......
......
......@@ -30,6 +30,7 @@ class BootstrapPagerAdapter(
}
}
@SuppressWarnings("EmptyFunctionBlock")
override fun onBindViewHolder(holder: RecyclerView.ViewHolder, position: Int) {
}
......
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment