Closes #335 - Adds Report Site Issue Menu Item
parent
e424b4d9d0
commit
0298950025
|
@ -24,22 +24,18 @@ import mozilla.components.feature.contextmenu.ContextMenuCandidate
|
|||
import mozilla.components.feature.contextmenu.ContextMenuFeature
|
||||
import mozilla.components.feature.customtabs.CustomTabsToolbarFeature
|
||||
import mozilla.components.feature.downloads.DownloadsFeature
|
||||
import mozilla.components.feature.prompts.PromptFeature
|
||||
import mozilla.components.feature.session.SessionFeature
|
||||
import mozilla.components.feature.session.SessionUseCases
|
||||
import mozilla.components.support.ktx.android.arch.lifecycle.addObservers
|
||||
import org.mozilla.fenix.R
|
||||
import org.mozilla.fenix.ext.requireComponents
|
||||
import mozilla.components.feature.prompts.PromptFeature
|
||||
import org.mozilla.fenix.BackHandler
|
||||
import org.mozilla.fenix.R
|
||||
import org.mozilla.fenix.components.FindInPageIntegration
|
||||
import org.mozilla.fenix.ext.requireComponents
|
||||
import org.mozilla.fenix.ext.share
|
||||
import org.mozilla.fenix.mvi.ActionBusFactory
|
||||
import org.mozilla.fenix.mvi.getSafeManagedObservable
|
||||
import org.mozilla.fenix.search.toolbar.SearchAction
|
||||
import org.mozilla.fenix.search.toolbar.ToolbarComponent
|
||||
import org.mozilla.fenix.search.toolbar.SearchState
|
||||
import org.mozilla.fenix.search.toolbar.ToolbarUIView
|
||||
import org.mozilla.fenix.search.toolbar.ToolbarMenu
|
||||
import org.mozilla.fenix.search.toolbar.*
|
||||
|
||||
class BrowserFragment : Fragment(), BackHandler {
|
||||
|
||||
|
@ -200,6 +196,11 @@ class BrowserFragment : Fragment(), BackHandler {
|
|||
is ToolbarMenu.Item.RequestDesktop -> sessionUseCases.requestDesktopSite.invoke(action.item.isChecked)
|
||||
is ToolbarMenu.Item.Share -> requireComponents.core.sessionManager
|
||||
.selectedSession?.url?.apply { requireContext().share(this) }
|
||||
is ToolbarMenu.Item.ReportIssue -> requireComponents.core.sessionManager
|
||||
.selectedSession?.url?.apply {
|
||||
val reportUrl = String.format(REPORT_SITE_ISSUE_URL, this)
|
||||
sessionUseCases.loadUrl.invoke(reportUrl)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -208,5 +209,6 @@ class BrowserFragment : Fragment(), BackHandler {
|
|||
private const val REQUEST_CODE_DOWNLOAD_PERMISSIONS = 1
|
||||
private const val REQUEST_CODE_PROMPT_PERMISSIONS = 2
|
||||
private const val TOOLBAR_HEIGHT = 56f
|
||||
private const val REPORT_SITE_ISSUE_URL = "https://webcompat.com/issues/new?url=%s&label=browser-fenix"
|
||||
}
|
||||
}
|
||||
|
|
|
@ -29,6 +29,7 @@ class ToolbarMenu(
|
|||
object Back : Item()
|
||||
object Forward : Item()
|
||||
object Reload : Item()
|
||||
object ReportIssue : Item()
|
||||
}
|
||||
|
||||
val menuBuilder by lazy { BrowserMenuBuilder(menuItems) }
|
||||
|
@ -133,6 +134,15 @@ class ToolbarMenu(
|
|||
onItemTapped.invoke(Item.Share)
|
||||
},
|
||||
|
||||
BrowserMenuImageText(
|
||||
context.getString(R.string.browser_menu_report_issue),
|
||||
R.drawable.ic_report_issues,
|
||||
context.getString(R.string.browser_menu_report_issue),
|
||||
R.color.icons
|
||||
) {
|
||||
onItemTapped.invoke(Item.ReportIssue)
|
||||
},
|
||||
|
||||
BrowserMenuDivider(),
|
||||
|
||||
menuToolbar
|
||||
|
|
|
@ -0,0 +1,12 @@
|
|||
<!-- This Source Code Form is subject to the terms of the Mozilla Public
|
||||
- License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
- file, You can obtain one at http://mozilla.org/MPL/2.0/. -->
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="24dp"
|
||||
android:height="24dp"
|
||||
android:viewportWidth="16"
|
||||
android:viewportHeight="16">
|
||||
<path
|
||||
android:fillColor="context-fill"
|
||||
android:pathData="M8,0C4.3,0 2,2.107 2,5.5c0,2.372 2.065,4.268 3,5L5,14c0,1.476 1.616,2 3,2s3,-0.524 3,-2v-3.5c0.935,-0.736 3,-2.632 3,-5C14,2.107 11.7,0 8,0zM9,12L7,12v-1h2zM8,14a3.086,3.086 0,0 1,-1 -0.172L7,13h2v0.828A3.047,3.047 0,0 1,8 14zM9.445,9.168A1,1 0,0 0,9 10L7,10a1,1 0,0 0,-0.444 -0.831C5.845,8.691 4,7.1 4,5.5 4,2.607 6.175,2 8,2s4,0.607 4,3.5c0,1.6 -1.845,3.191 -2.555,3.668z" />
|
||||
</vector>
|
|
@ -24,7 +24,7 @@
|
|||
<string name="browser_menu_find_in_page">Find in Page</string>
|
||||
<string name="browser_menu_private_tab">Private Tab</string>
|
||||
<string name="browser_menu_new_tab">New Tab</string>
|
||||
<string name="browser_menu_report_issue">Report Issue</string>
|
||||
<string name="browser_menu_report_issue">Report Site Issue</string>
|
||||
<string name="browser_menu_share">Share</string>
|
||||
|
||||
<string name="sessions_intro_description">Fenix will collect your browsing sessions on your Home Screen for you to retrieve later.</string>
|
||||
|
|
Loading…
Reference in New Issue