morgan pushed to branch tor-browser-128.2.0esr-14.0-1 at The Tor Project / Applications / Tor Browser

Commits:

6 changed files:

Changes:

  • mobile/android/android-components/components/browser/engine-gecko/src/main/java/mozilla/components/browser/engine/gecko/GeckoEngineSession.kt
    ... ... @@ -1808,6 +1808,10 @@ class GeckoEngineSession(
    1808 1808
             geckoSession.translationsSessionDelegate = GeckoTranslateSessionDelegate(this)
    
    1809 1809
         }
    
    1810 1810
     
    
    1811
    +    fun newTorCircuit() {
    
    1812
    +        geckoSession.newTorCircuit()
    
    1813
    +    }
    
    1814
    +
    
    1811 1815
         companion object {
    
    1812 1816
             internal const val PROGRESS_START = 25
    
    1813 1817
             internal const val PROGRESS_STOP = 100
    

  • mobile/android/fenix/app/src/main/java/org/mozilla/fenix/components/toolbar/BrowserToolbarMenuController.kt
    ... ... @@ -16,6 +16,7 @@ import kotlinx.coroutines.Dispatchers
    16 16
     import kotlinx.coroutines.MainScope
    
    17 17
     import kotlinx.coroutines.launch
    
    18 18
     import mozilla.appservices.places.BookmarkRoot
    
    19
    +import mozilla.components.browser.engine.gecko.GeckoEngineSession
    
    19 20
     import mozilla.components.browser.state.action.EngineAction
    
    20 21
     import mozilla.components.browser.state.ext.getUrl
    
    21 22
     import mozilla.components.browser.state.selector.findCustomTabOrSelectedTab
    
    ... ... @@ -430,6 +431,13 @@ class DefaultBrowserToolbarMenuController(
    430 431
                         BrowserFragmentDirections.actionBrowserFragmentToTranslationsDialogFragment()
    
    431 432
                     navController.navigateSafe(R.id.browserFragment, directions)
    
    432 433
                 }
    
    434
    +
    
    435
    +            ToolbarMenu.Item.NewTorCircuit -> {
    
    436
    +                currentSession?.let {
    
    437
    +                    sessionUseCases.reload.invoke(it.id)
    
    438
    +                    (it.engineState.engineSession as GeckoEngineSession).newTorCircuit()
    
    439
    +                }
    
    440
    +            }
    
    433 441
             }
    
    434 442
         }
    
    435 443
     
    
    ... ... @@ -513,6 +521,10 @@ class DefaultBrowserToolbarMenuController(
    513 521
                         "translate",
    
    514 522
                     ),
    
    515 523
                 )
    
    524
    +
    
    525
    +            ToolbarMenu.Item.NewTorCircuit -> {
    
    526
    +                /* Tor doesn't use telemetry and therefore this doesn't need to be implemented */
    
    527
    +            }
    
    516 528
             }
    
    517 529
         }
    
    518 530
     
    

  • mobile/android/fenix/app/src/main/java/org/mozilla/fenix/components/toolbar/DefaultToolbarMenu.kt
    ... ... @@ -16,7 +16,6 @@ import kotlinx.coroutines.flow.distinctUntilChangedBy
    16 16
     import kotlinx.coroutines.flow.mapNotNull
    
    17 17
     import kotlinx.coroutines.launch
    
    18 18
     import mozilla.components.browser.menu.BrowserMenuHighlight
    
    19
    -import mozilla.components.browser.menu.BrowserMenuItem
    
    20 19
     import mozilla.components.browser.menu.WebExtensionBrowserMenuBuilder
    
    21 20
     import mozilla.components.browser.menu.item.BrowserMenuDivider
    
    22 21
     import mozilla.components.browser.menu.item.BrowserMenuHighlightableItem
    
    ... ... @@ -32,7 +31,6 @@ import mozilla.components.browser.state.state.TabSessionState
    32 31
     import mozilla.components.browser.state.store.BrowserStore
    
    33 32
     import mozilla.components.concept.storage.BookmarksStorage
    
    34 33
     import mozilla.components.feature.top.sites.PinnedSiteStorage
    
    35
    -import mozilla.components.feature.webcompat.reporter.WebCompatReporterFeature
    
    36 34
     import mozilla.components.lib.state.ext.flowScoped
    
    37 35
     import mozilla.components.support.ktx.android.content.getColorFromAttr
    
    38 36
     import mozilla.components.support.ktx.kotlinx.coroutines.flow.ifAnyChanged
    
    ... ... @@ -211,6 +209,14 @@ open class DefaultToolbarMenu(
    211 209
             onItemTapped.invoke(ToolbarMenu.Item.NewTab)
    
    212 210
         }
    
    213 211
     
    
    212
    +    private val newCircuitItem = BrowserMenuImageText(
    
    213
    +        context.getString(R.string.library_new_circuit),
    
    214
    +        R.drawable.new_circuit,
    
    215
    +        primaryTextColor(),
    
    216
    +    ) {
    
    217
    +        onItemTapped.invoke(ToolbarMenu.Item.NewTorCircuit)
    
    218
    +    }
    
    219
    +
    
    214 220
         //private val historyItem = BrowserMenuImageText(
    
    215 221
         //    context.getString(R.string.library_history),
    
    216 222
         //    R.drawable.ic_history,
    
    ... ... @@ -409,6 +415,8 @@ open class DefaultToolbarMenu(
    409 415
                     if (shouldUseBottomToolbar || !shouldShowMenuToolbar) null else menuToolbar,
    
    410 416
                     newTabItem,
    
    411 417
                     BrowserMenuDivider(),
    
    418
    +                newCircuitItem,
    
    419
    +                BrowserMenuDivider(),
    
    412 420
                     bookmarksItem,
    
    413 421
                     //historyItem,
    
    414 422
                     downloadsItem,
    

  • mobile/android/fenix/app/src/main/java/org/mozilla/fenix/components/toolbar/ToolbarMenu.kt
    ... ... @@ -55,6 +55,7 @@ interface ToolbarMenu {
    55 55
             object Passwords : Item()
    
    56 56
             object Downloads : Item()
    
    57 57
             object NewTab : Item()
    
    58
    +        object NewTorCircuit : Item()
    
    58 59
         }
    
    59 60
     
    
    60 61
         val menuBuilder: BrowserMenuBuilder
    

  • mobile/android/fenix/app/src/main/res/drawable/new_circuit.xml
    1
    +<vector xmlns:android="http://schemas.android.com/apk/res/android" android:autoMirrored="true" android:height="16dp" android:viewportHeight="16" android:viewportWidth="16" android:width="16dp">
    
    2
    +      
    
    3
    +    <path android:fillColor="#5B5B66" android:fillType="evenOdd" android:pathData="M10.599,2.897C9.522,2.349 8.298,2.155 7.104,2.344C6.642,2.417 6.195,2.546 5.769,2.726C5.822,2.91 5.85,3.105 5.85,3.307C5.85,4.48 4.898,5.432 3.725,5.432C2.551,5.432 1.6,4.48 1.6,3.307C1.6,2.133 2.551,1.182 3.725,1.182C4.238,1.182 4.708,1.363 5.075,1.666C5.654,1.399 6.271,1.21 6.908,1.109C8.363,0.879 9.854,1.115 11.167,1.784C12.479,2.452 13.547,3.52 14.216,4.832C14.885,6.145 15.121,7.635 14.891,9.09C14.837,9.431 14.517,9.664 14.176,9.61C13.835,9.556 13.602,9.236 13.656,8.895C13.845,7.701 13.651,6.477 13.102,5.4C12.553,4.322 11.677,3.446 10.599,2.897ZM4.65,3.307C4.65,3.818 4.235,4.232 3.725,4.232C3.214,4.232 2.8,3.818 2.8,3.307C2.8,2.796 3.214,2.382 3.725,2.382C4.235,2.382 4.65,2.796 4.65,3.307Z"/>
    
    4
    +      
    
    5
    +    <path android:fillColor="#5B5B66" android:fillType="evenOdd" android:pathData="M1.824,6.39C2.165,6.444 2.398,6.764 2.344,7.105C2.155,8.299 2.349,9.523 2.898,10.6C3.447,11.678 4.323,12.554 5.401,13.103C6.478,13.651 7.702,13.845 8.896,13.656C9.356,13.583 9.803,13.455 10.227,13.276C10.173,13.088 10.144,12.891 10.144,12.686C10.144,11.512 11.096,10.561 12.269,10.561C13.443,10.561 14.394,11.512 14.394,12.686C14.394,13.86 13.443,14.811 12.269,14.811C11.76,14.811 11.293,14.632 10.927,14.333C10.347,14.601 9.73,14.79 9.092,14.891C7.637,15.121 6.146,14.885 4.833,14.216C3.52,13.548 2.453,12.481 1.784,11.168C1.115,9.855 0.879,8.365 1.109,6.91C1.163,6.569 1.483,6.336 1.824,6.39ZM13.194,12.686C13.194,13.197 12.78,13.611 12.269,13.611C11.759,13.611 11.344,13.197 11.344,12.686C11.344,12.175 11.759,11.761 12.269,11.761C12.78,11.761 13.194,12.175 13.194,12.686Z"/>
    
    6
    +    
    
    7
    +</vector>

  • mobile/android/fenix/app/src/main/res/values/torbrowser_strings.xml
    ... ... @@ -31,6 +31,8 @@
    31 31
     
    
    32 32
         <string name="tor_explore_privately">Explore. Privately.</string>
    
    33 33
     
    
    34
    +    <string name="library_new_circuit">New circuit</string>
    
    35
    +
    
    34 36
         <string name="preferences_tor_connection_settings_title">Connection</string>
    
    35 37
         <string name="preferences_tor_network_settings">Tor Network</string>
    
    36 38
         <string name="preferences_tor_network_settings_explanation">Tor Browser routes your traffic over the Tor Network, run by thousands of volunteers around the world.</string>