|
|
|
@ -291,7 +291,7 @@ class BrowserFragment : Fragment(), BackHandler, CoroutineScope {
|
|
|
|
|
.findNavController(toolbarComponent.getView())
|
|
|
|
|
.navigate(
|
|
|
|
|
BrowserFragmentDirections.actionBrowserFragmentToSearchFragment(
|
|
|
|
|
requireComponents.core.sessionManager.selectedSession?.id
|
|
|
|
|
getSessionByIdOrUseSelectedSession().id
|
|
|
|
|
)
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
@ -323,8 +323,7 @@ class BrowserFragment : Fragment(), BackHandler, CoroutineScope {
|
|
|
|
|
}
|
|
|
|
|
is QuickActionAction.SharePressed -> {
|
|
|
|
|
requireComponents.analytics.metrics.track(Event.QuickActionSheetShareTapped)
|
|
|
|
|
requireComponents.core.sessionManager
|
|
|
|
|
.selectedSession?.url?.apply { requireContext().share(this) }
|
|
|
|
|
getSessionByIdOrUseSelectedSession().url.apply { requireContext().share(this) }
|
|
|
|
|
}
|
|
|
|
|
is QuickActionAction.DownloadsPressed -> {
|
|
|
|
|
requireComponents.analytics.metrics.track(Event.QuickActionSheetDownloadTapped)
|
|
|
|
@ -332,10 +331,10 @@ class BrowserFragment : Fragment(), BackHandler, CoroutineScope {
|
|
|
|
|
}
|
|
|
|
|
is QuickActionAction.BookmarkPressed -> {
|
|
|
|
|
requireComponents.analytics.metrics.track(Event.QuickActionSheetBookmarkTapped)
|
|
|
|
|
val session = requireComponents.core.sessionManager.selectedSession
|
|
|
|
|
val session = getSessionByIdOrUseSelectedSession()
|
|
|
|
|
CoroutineScope(IO).launch {
|
|
|
|
|
val guid = requireComponents.core.bookmarksStorage
|
|
|
|
|
.addItem(BookmarkRoot.Mobile.id, session!!.url, session.title, null)
|
|
|
|
|
.addItem(BookmarkRoot.Mobile.id, session.url, session.title, null)
|
|
|
|
|
launch(Main) {
|
|
|
|
|
FenixSnackbar.make(
|
|
|
|
|
view!!,
|
|
|
|
@ -426,6 +425,7 @@ class BrowserFragment : Fragment(), BackHandler, CoroutineScope {
|
|
|
|
|
|
|
|
|
|
requireComponents.analytics.metrics.track(Event.BrowserMenuItemTapped(item))
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// This method triggers the complexity warning. However it's actually not that hard to understand.
|
|
|
|
|
@SuppressWarnings("ComplexMethod")
|
|
|
|
|
private fun handleToolbarItemInteraction(action: SearchAction.ToolbarMenuItemTapped) {
|
|
|
|
@ -440,8 +440,7 @@ class BrowserFragment : Fragment(), BackHandler, CoroutineScope {
|
|
|
|
|
ToolbarMenu.Item.Library -> Navigation.findNavController(toolbarComponent.getView())
|
|
|
|
|
.navigate(BrowserFragmentDirections.actionBrowserFragmentToLibraryFragment())
|
|
|
|
|
is ToolbarMenu.Item.RequestDesktop -> sessionUseCases.requestDesktopSite.invoke(action.item.isChecked)
|
|
|
|
|
ToolbarMenu.Item.Share -> requireComponents.core.sessionManager
|
|
|
|
|
.selectedSession?.url?.apply { requireContext().share(this) }
|
|
|
|
|
ToolbarMenu.Item.Share -> getSessionByIdOrUseSelectedSession().url.apply { requireContext().share(this) }
|
|
|
|
|
ToolbarMenu.Item.NewPrivateTab -> {
|
|
|
|
|
val directions = BrowserFragmentDirections
|
|
|
|
|
.actionBrowserFragmentToSearchFragment(null)
|
|
|
|
@ -452,8 +451,7 @@ class BrowserFragment : Fragment(), BackHandler, CoroutineScope {
|
|
|
|
|
FindInPageIntegration.launch?.invoke()
|
|
|
|
|
requireComponents.analytics.metrics.track(Event.FindInPageOpened)
|
|
|
|
|
}
|
|
|
|
|
ToolbarMenu.Item.ReportIssue -> requireComponents.core.sessionManager
|
|
|
|
|
.selectedSession?.url?.apply {
|
|
|
|
|
ToolbarMenu.Item.ReportIssue -> getSessionByIdOrUseSelectedSession().url.apply {
|
|
|
|
|
val reportUrl = String.format(REPORT_SITE_ISSUE_URL, this)
|
|
|
|
|
sessionUseCases.loadUrl.invoke(reportUrl)
|
|
|
|
|
}
|
|
|
|
|