[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
Tue Jun 11 21:29:09 UTC 2024



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


Commits:
d483554e by Dan Ballard at 2024-06-11T12:38:20-07:00
fixup! Add Tor integration and UI

Bug 42632: Don't display builtin bridges in provide bridge popup;
Also fix saving user provided bridges by splitting on \n instead of \r\n and prune empty lines

- - - - -


1 changed file:

- fenix/app/src/main/java/org/mozilla/fenix/tor/TorControllerGV.kt


Changes:

=====================================
fenix/app/src/main/java/org/mozilla/fenix/tor/TorControllerGV.kt
=====================================
@@ -157,12 +157,20 @@ class TorControllerGV(
     // with no bridge strings
     override var userProvidedBridges: String?
         get() {
-            return getTorSettings()?.bridgeBridgeStrings?.joinToString("\r\n")
+            return getTorSettings()?.let {
+                if (it.bridgesSource == BridgeSource.UserProvided) {
+                    return getTorSettings()?.bridgeBridgeStrings?.joinToString("\n")
+                }
+                return ""
+            }
         }
         set(value) {
             getTorSettings()?.let {
+                Log.i(TAG, "setUserProvidedBridges: '$value'");
+                // Hack: we don't have validation so lets do something quick and dirty (each line has a length)
+                val  userProvidedLines: Array<String> = value?.split("\n")?.filter { it.length > 4 }?.toTypedArray() ?: arrayOf<String>()
                 it.bridgesSource = BridgeSource.UserProvided
-                it.bridgeBridgeStrings = value?.split("\r\n")?.toTypedArray() ?: arrayOf<String>()
+                it.bridgeBridgeStrings = userProvidedLines
                 getTorIntegration().setSettings(it, true, true)
             }
         }



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

-- 
View it on GitLab: https://gitlab.torproject.org/tpo/applications/firefox-android/-/commit/d483554e3c1b34ba0d64e9ec35647097d5080532
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/20240611/42508e92/attachment-0001.htm>


More information about the tbb-commits mailing list