Commits:
5 changed files:
Changes:
mobile/android/fenix/app/src/main/java/org/mozilla/fenix/components/menu/MenuDialogFragment.kt
| ... |
... |
@@ -117,6 +117,9 @@ import org.mozilla.fenix.webcompat.middleware.DefaultWebCompatReporterRetrievalS |
|
117
|
117
|
import org.mozilla.fenix.webcompat.middleware.WebCompatInfoDeserializer
|
|
118
|
118
|
import com.google.android.material.R as materialR
|
|
119
|
119
|
|
|
|
120
|
+import mozilla.components.browser.engine.gecko.GeckoEngineSession
|
|
|
121
|
+import android.util.Log
|
|
|
122
|
+
|
|
120
|
123
|
// EXPANDED_MIN_RATIO is used for BottomSheetBehavior.halfExpandedRatio().
|
|
121
|
124
|
// That value needs to be less than the PEEK_HEIGHT.
|
|
122
|
125
|
// If EXPANDED_MIN_RATIO is greater than the PEEK_HEIGHT, then there will be
|
| ... |
... |
@@ -785,6 +788,13 @@ class MenuDialogFragment : BottomSheetDialogFragment() { |
|
785
|
788
|
},
|
|
786
|
789
|
)
|
|
787
|
790
|
},
|
|
|
791
|
+ onNewCircuitButtonClick = {
|
|
|
792
|
+ components.core.store.state.selectedTab?.let {
|
|
|
793
|
+ (it.engineState.engineSession as GeckoEngineSession).newTorCircuit()
|
|
|
794
|
+ components.useCases.sessionUseCases.reload.invoke(it.id)
|
|
|
795
|
+ dismiss()
|
|
|
796
|
+ } ?: Log.e("MenuDialogFragment", "selectedTab was null, tab and tor circuit not refreshed")
|
|
|
797
|
+ },
|
|
788
|
798
|
)
|
|
789
|
799
|
}
|
|
790
|
800
|
|
mobile/android/fenix/app/src/main/java/org/mozilla/fenix/components/menu/compose/MainMenu.kt
| ... |
... |
@@ -169,6 +169,7 @@ fun MainMenu( |
|
169
|
169
|
extensionsMenuItemDescription: String?,
|
|
170
|
170
|
moreSettingsSubmenu: @Composable () -> Unit,
|
|
171
|
171
|
extensionSubmenu: @Composable () -> Unit,
|
|
|
172
|
+ onNewCircuitButtonClick: () -> Unit,
|
|
172
|
173
|
) {
|
|
173
|
174
|
MenuFrame(
|
|
174
|
175
|
contentModifier = Modifier
|
| ... |
... |
@@ -290,6 +291,7 @@ fun MainMenu( |
|
290
|
291
|
extensionsMenuItemDescription = extensionsMenuItemDescription,
|
|
291
|
292
|
moreSettingsSubmenu = moreSettingsSubmenu,
|
|
292
|
293
|
extensionSubmenu = extensionSubmenu,
|
|
|
294
|
+ onNewCircuitButtonClick = onNewCircuitButtonClick,
|
|
293
|
295
|
)
|
|
294
|
296
|
}
|
|
295
|
297
|
|
| ... |
... |
@@ -363,6 +365,7 @@ private fun ToolsAndActionsMenuGroup( |
|
363
|
365
|
extensionsMenuItemDescription: String?,
|
|
364
|
366
|
moreSettingsSubmenu: @Composable () -> Unit,
|
|
365
|
367
|
extensionSubmenu: @Composable () -> Unit,
|
|
|
368
|
+ onNewCircuitButtonClick: (() -> Unit)?,
|
|
366
|
369
|
) {
|
|
367
|
370
|
MenuGroup {
|
|
368
|
371
|
val labelId = R.string.browser_menu_desktop_site
|
| ... |
... |
@@ -380,6 +383,12 @@ private fun ToolsAndActionsMenuGroup( |
|
380
|
383
|
menuItemState = if (isPdf) MenuItemState.DISABLED else MenuItemState.ENABLED
|
|
381
|
384
|
}
|
|
382
|
385
|
|
|
|
386
|
+ MenuItem(
|
|
|
387
|
+ label = stringResource(R.string.library_new_circuit),
|
|
|
388
|
+ beforeIconPainter = painterResource(R.drawable.new_circuit),
|
|
|
389
|
+ onClick = onNewCircuitButtonClick,
|
|
|
390
|
+ )
|
|
|
391
|
+
|
|
383
|
392
|
if (isBookmarked) {
|
|
384
|
393
|
MenuItem(
|
|
385
|
394
|
label = stringResource(id = R.string.browser_menu_edit_bookmark),
|
| ... |
... |
@@ -764,6 +773,7 @@ private fun MenuDialogPreview() { |
|
764
|
773
|
onShareButtonClick = {},
|
|
765
|
774
|
moreSettingsSubmenu = {},
|
|
766
|
775
|
extensionSubmenu = {},
|
|
|
776
|
+ onNewCircuitButtonClick = {},
|
|
767
|
777
|
)
|
|
768
|
778
|
}
|
|
769
|
779
|
}
|
| ... |
... |
@@ -853,6 +863,7 @@ private fun MenuDialogPrivatePreview( |
|
853
|
863
|
onWebExtensionMenuItemClick = {},
|
|
854
|
864
|
)
|
|
855
|
865
|
},
|
|
|
866
|
+ onNewCircuitButtonClick = {},
|
|
856
|
867
|
)
|
|
857
|
868
|
}
|
|
858
|
869
|
}
|
mobile/android/fenix/app/src/main/java/org/mozilla/fenix/components/toolbar/BrowserToolbarMenuController.kt
| ... |
... |
@@ -453,6 +453,7 @@ class DefaultBrowserToolbarMenuController( |
|
453
|
453
|
navController.navigateSafe(R.id.browserFragment, directions)
|
|
454
|
454
|
}
|
|
455
|
455
|
|
|
|
456
|
+ // Remove once moz deletes this old UI (Toolbar Menu is being replaced by MainMenu)
|
|
456
|
457
|
ToolbarMenu.Item.NewTorCircuit -> {
|
|
457
|
458
|
currentSession?.let {
|
|
458
|
459
|
sessionUseCases.reload.invoke(it.id)
|
| ... |
... |
@@ -612,6 +613,7 @@ class DefaultBrowserToolbarMenuController( |
|
612
|
613
|
),
|
|
613
|
614
|
)
|
|
614
|
615
|
|
|
|
616
|
+ // Remove once moz deletes this old UI (Toolbar Menu is being replaced by MainMenu)
|
|
615
|
617
|
ToolbarMenu.Item.NewTorCircuit -> {
|
|
616
|
618
|
/* Tor doesn't use telemetry and therefore this doesn't need to be implemented */
|
|
617
|
619
|
}
|
mobile/android/fenix/app/src/main/java/org/mozilla/fenix/components/toolbar/DefaultToolbarMenu.kt
| ... |
... |
@@ -228,6 +228,7 @@ open class DefaultToolbarMenu( |
|
228
|
228
|
onItemTapped.invoke(ToolbarMenu.Item.NewTab)
|
|
229
|
229
|
}
|
|
230
|
230
|
|
|
|
231
|
+ // Remove once moz deletes this old UI (Toolbar Menu is being replaced by MainMenu)
|
|
231
|
232
|
private val newCircuitItem = BrowserMenuImageText(
|
|
232
|
233
|
context.getString(R.string.library_new_circuit),
|
|
233
|
234
|
R.drawable.new_circuit,
|
| ... |
... |
@@ -409,6 +410,7 @@ open class DefaultToolbarMenu( |
|
409
|
410
|
listOfNotNull(
|
|
410
|
411
|
if (shouldUseBottomToolbar) null else menuToolbar,
|
|
411
|
412
|
newTabItem,
|
|
|
413
|
+ // Remove once moz deletes this old UI (Toolbar Menu is being replaced by MainMenu)
|
|
412
|
414
|
BrowserMenuDivider(),
|
|
413
|
415
|
newCircuitItem,
|
|
414
|
416
|
BrowserMenuDivider(),
|
mobile/android/fenix/app/src/main/java/org/mozilla/fenix/components/toolbar/ToolbarMenu.kt
| ... |
... |
@@ -70,6 +70,7 @@ interface ToolbarMenu { |
|
70
|
70
|
object Passwords : Item()
|
|
71
|
71
|
object Downloads : Item()
|
|
72
|
72
|
object NewTab : Item()
|
|
|
73
|
+ // Remove once moz deletes this old UI (Toolbar Menu is being replaced by MainMenu)
|
|
73
|
74
|
object NewTorCircuit : Item()
|
|
74
|
75
|
}
|
|
75
|
76
|
|
|