[tbb-commits] [Git][tpo/applications/firefox-android][firefox-android-115.2.1-13.5-1] fixup! Add Tor integration and UI

Dan Ballard (@dan) git at gitlab.torproject.org
Wed Jan 31 23:33:38 UTC 2024



Dan Ballard pushed to branch firefox-android-115.2.1-13.5-1 at The Tor Project / Applications / firefox-android


Commits:
87e8fea1 by clairehurst at 2024-01-31T16:12:55-07:00
fixup! Add Tor integration and UI

- - - - -


10 changed files:

- fenix/app/src/main/java/org/mozilla/fenix/HomeActivity.kt
- fenix/app/src/main/java/org/mozilla/fenix/IntentReceiverActivity.kt
- fenix/app/src/main/java/org/mozilla/fenix/components/TorBrowserFeatures.kt
- fenix/app/src/main/java/org/mozilla/fenix/settings/TorNetworkSettingsFragment.kt
- fenix/app/src/main/java/org/mozilla/fenix/tor/TorBootstrapStatus.kt
- fenix/app/src/main/java/org/mozilla/fenix/tor/TorController.kt
- fenix/app/src/main/java/org/mozilla/fenix/tor/TorControllerGV.kt
- fenix/app/src/main/java/org/mozilla/fenix/tor/TorControllerTAS.kt
- fenix/app/src/main/java/org/mozilla/fenix/tor/view/TorBootstrapConnectViewHolder.kt
- fenix/app/src/main/java/org/mozilla/fenix/tor/view/TorBootstrapLoggerViewHolder.kt


Changes:

=====================================
fenix/app/src/main/java/org/mozilla/fenix/HomeActivity.kt
=====================================
@@ -685,7 +685,7 @@ open class HomeActivity : LocaleAwareAppCompatActivity(), NavHostActivity, TorIn
                 }
                 override fun onTorConnecting() { /* no-op */ }
                 override fun onTorStopped() { /* no-op */ }
-                override fun onTorStatusUpdate(entry: String?, status: String?) { /* no-op */ }
+                override fun onTorStatusUpdate(entry: String?, status: String?, progress: Double?) { /* no-op */ }
             })
             return
         }


=====================================
fenix/app/src/main/java/org/mozilla/fenix/IntentReceiverActivity.kt
=====================================
@@ -59,7 +59,7 @@ class IntentReceiverActivity : Activity() {
                 }
                 override fun onTorConnecting() { /* no-op */ }
                 override fun onTorStopped() { /* no-op */ }
-                override fun onTorStatusUpdate(entry: String?, status: String?) { /* no-op */ }
+                override fun onTorStatusUpdate(entry: String?, status: String?, progress: Double?) { /* no-op */ }
             })
 
             // In the meantime, open the HomeActivity so the user can get connected.


=====================================
fenix/app/src/main/java/org/mozilla/fenix/components/TorBrowserFeatures.kt
=====================================
@@ -164,7 +164,7 @@ object TorBrowserFeatures {
             }
 
             @SuppressWarnings("EmptyFunctionBlock")
-            override fun onTorStatusUpdate(entry: String?, status: String?) {
+            override fun onTorStatusUpdate(entry: String?, status: String?, progress: Double?) {
             }
         })
     }


=====================================
fenix/app/src/main/java/org/mozilla/fenix/settings/TorNetworkSettingsFragment.kt
=====================================
@@ -166,7 +166,7 @@ class TorNetworkSettingsFragment : PreferenceFragmentCompat(), TorEvents {
     override fun onTorStopped() {
     }
 
-    override fun onTorStatusUpdate(entry: String?, status: String?) {
+    override fun onTorStatusUpdate(entry: String?, status: String?, progress: Double?) {
         setStatus()
     }
 }


=====================================
fenix/app/src/main/java/org/mozilla/fenix/tor/TorBootstrapStatus.kt
=====================================
@@ -34,7 +34,7 @@ class TorBootstrapStatus(
         }
 
         @SuppressWarnings("EmptyFunctionBlock")
-        override fun onTorStatusUpdate(entry: String?, status: String?) {
+        override fun onTorStatusUpdate(entry: String?, status: String?, progress: Double?) {
         }
 
         fun unregisterTorListener() {


=====================================
fenix/app/src/main/java/org/mozilla/fenix/tor/TorController.kt
=====================================
@@ -9,7 +9,7 @@ import androidx.lifecycle.LifecycleCoroutineScope
 interface TorEvents {
     fun onTorConnecting()
     fun onTorConnected()
-    fun onTorStatusUpdate(entry: String?, status: String?)
+    fun onTorStatusUpdate(entry: String?, status: String?, progress: Double? = 0.0)
     fun onTorStopped()
 }
 
@@ -55,7 +55,7 @@ interface TorController: TorEvents {
 
     override fun onTorConnecting()
     override fun onTorConnected()
-    override fun onTorStatusUpdate(entry: String?, status: String?)
+    override fun onTorStatusUpdate(entry: String?, status: String?, progress: Double?)
     override fun onTorStopped()
 
     fun registerTorListener(l: TorEvents)


=====================================
fenix/app/src/main/java/org/mozilla/fenix/tor/TorControllerGV.kt
=====================================
@@ -155,9 +155,9 @@ class TorControllerGV(
     }
 
     // TorEvents
-    override fun onTorStatusUpdate(entry: String?, status: String?) {
+    override fun onTorStatusUpdate(entry: String?, status: String?, progress: Double?) {
         synchronized(torListeners) {
-            torListeners.toList().forEach { it.onTorStatusUpdate(entry, status) }
+            torListeners.toList().forEach { it.onTorStatusUpdate(entry, status, progress) }
         }
     }
 
@@ -221,7 +221,7 @@ class TorControllerGV(
     // and state for firefox-android (designed for tor-android-service)
     //   fun onTorConnecting()
     //   fun onTorConnected()
-    //   fun onTorStatusUpdate(entry: String?, status: String?)
+    //   fun onTorStatusUpdate(entry: String?, status: String?, progress: Double?)
     //   fun onTorStopped()
 
     // TorEventsBootstrapStateChangeListener
@@ -268,7 +268,7 @@ class TorControllerGV(
 
         }
         entries.add(Pair(status, lastKnownStatus.toTorStatus().status))
-        onTorStatusUpdate(status, lastKnownStatus.toTorStatus().status)
+        onTorStatusUpdate(status, lastKnownStatus.toTorStatus().status, progress)
     }
 
     // TorEventsBootstrapStateChangeListener


=====================================
fenix/app/src/main/java/org/mozilla/fenix/tor/TorControllerTAS.kt
=====================================
@@ -170,7 +170,7 @@ class TorControllerTAS (private val context: Context): TorController {
         handlePendingRegistrationChanges()
     }
 
-    override fun onTorStatusUpdate(entry: String?, status: String?) {
+    override fun onTorStatusUpdate(entry: String?, status: String?, progress: Double?) {
         lockTorListenersMutation = true
         torListeners.forEach { it.onTorStatusUpdate(entry, status) }
         lockTorListenersMutation = false


=====================================
fenix/app/src/main/java/org/mozilla/fenix/tor/view/TorBootstrapConnectViewHolder.kt
=====================================
@@ -92,7 +92,7 @@ class TorBootstrapConnectViewHolder(
     override fun onTorStopped() {
     }
 
-    override fun onTorStatusUpdate(entry: String?, status: String?) {
+    override fun onTorStatusUpdate(entry: String?, status: String?, progress: Double?) {
         if (entry == null) return
 
         binding.torBootstrapStatusMessage.text = entry
@@ -103,7 +103,7 @@ class TorBootstrapConnectViewHolder(
                 percentIdx
             )
             with(binding.torBootstrapProgress) {
-                progress = percent.toInt()
+                this.progress = percent.toInt()
             }
         }
     }


=====================================
fenix/app/src/main/java/org/mozilla/fenix/tor/view/TorBootstrapLoggerViewHolder.kt
=====================================
@@ -55,7 +55,7 @@ class TorBootstrapLoggerViewHolder(
     override fun onTorStopped() {
     }
 
-    override fun onTorStatusUpdate(entry: String?, status: String?) {
+    override fun onTorStatusUpdate(entry: String?, status: String?, progress: Double?) {
         if (status == null || entry == null) return
         if (status == "ON" && entry.startsWith("Circuit")) return
 



View it on GitLab: https://gitlab.torproject.org/tpo/applications/firefox-android/-/commit/87e8fea17d0222d4f105ad875a9817c64e5baef7

-- 
View it on GitLab: https://gitlab.torproject.org/tpo/applications/firefox-android/-/commit/87e8fea17d0222d4f105ad875a9817c64e5baef7
You're receiving this email because of your account on gitlab.torproject.org.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.torproject.org/pipermail/tbb-commits/attachments/20240131/c1351c75/attachment-0001.htm>


More information about the tbb-commits mailing list