Skip to content
This repository has been archived by the owner on Feb 20, 2023. It is now read-only.

Commit

Permalink
Closes #335 - Adds Report Site Issue Menu Item
Browse files Browse the repository at this point in the history
  • Loading branch information
ekager authored and sblatz committed Feb 8, 2019
1 parent e424b4d commit 0298950
Show file tree
Hide file tree
Showing 4 changed files with 33 additions and 9 deletions.
18 changes: 10 additions & 8 deletions app/src/main/java/org/mozilla/fenix/browser/BrowserFragment.kt
Original file line number Diff line number Diff line change
Expand Up @@ -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 {

Expand Down Expand Up @@ -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)
}
}
}

Expand All @@ -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"
}
}
10 changes: 10 additions & 0 deletions app/src/main/java/org/mozilla/fenix/search/toolbar/ToolbarMenu.kt
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ class ToolbarMenu(
object Back : Item()
object Forward : Item()
object Reload : Item()
object ReportIssue : Item()
}

val menuBuilder by lazy { BrowserMenuBuilder(menuItems) }
Expand Down Expand Up @@ -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
Expand Down
12 changes: 12 additions & 0 deletions app/src/main/res/drawable/ic_report_issues.xml
Original file line number Diff line number Diff line change
@@ -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>
2 changes: 1 addition & 1 deletion app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down

0 comments on commit 0298950

Please sign in to comment.