parent
943a03d167
commit
5fc1e9227f
|
@ -13,5 +13,6 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|||
- #1036 - Adds telemetry for Find in Page
|
||||
- #1049 - Add style for progress bar with gradient drawable
|
||||
- #1165 - Added doorhanger to the toolbar
|
||||
- #1195 - Adds telemetry for quick action sheet
|
||||
### Changed
|
||||
### Removed
|
|
@ -223,6 +223,74 @@ find_in_page:
|
|||
- telemetry-client-dev@mozilla.com
|
||||
expires: "2020-03-01"
|
||||
|
||||
quick_action_sheet:
|
||||
opened:
|
||||
type: event
|
||||
description: >
|
||||
A user opened the quick action sheet UI
|
||||
bugs:
|
||||
- 1195
|
||||
data_reviews:
|
||||
- https://github.com/mozilla-mobile/fenix/pull/1362#issuecomment-479668466
|
||||
notification_emails:
|
||||
- telemetry-client-dev@mozilla.com
|
||||
expires: "2020-03-01"
|
||||
closed:
|
||||
type: event
|
||||
description: >
|
||||
A user closed the quick action sheet UI
|
||||
bugs:
|
||||
- 1195
|
||||
data_reviews:
|
||||
- https://github.com/mozilla-mobile/fenix/pull/1362#issuecomment-479668466
|
||||
notification_emails:
|
||||
- telemetry-client-dev@mozilla.com
|
||||
expires: "2020-03-01"
|
||||
share_tapped:
|
||||
type: event
|
||||
description: >
|
||||
A user tapped the share button
|
||||
bugs:
|
||||
- 1195
|
||||
data_reviews:
|
||||
- https://github.com/mozilla-mobile/fenix/pull/1362#issuecomment-479668466
|
||||
notification_emails:
|
||||
- telemetry-client-dev@mozilla.com
|
||||
expires: "2020-03-01"
|
||||
bookmark_tapped:
|
||||
type: event
|
||||
description: >
|
||||
A user tapped the bookmark button
|
||||
bugs:
|
||||
- 1195
|
||||
data_reviews:
|
||||
- https://github.com/mozilla-mobile/fenix/pull/1362#issuecomment-479668466
|
||||
notification_emails:
|
||||
- telemetry-client-dev@mozilla.com
|
||||
expires: "2020-03-01"
|
||||
download_tapped:
|
||||
type: event
|
||||
description: >
|
||||
A user tapped the download button
|
||||
bugs:
|
||||
- 1195
|
||||
data_reviews:
|
||||
- https://github.com/mozilla-mobile/fenix/pull/1362#issuecomment-479668466
|
||||
notification_emails:
|
||||
- telemetry-client-dev@mozilla.com
|
||||
expires: "2020-03-01"
|
||||
read_tapped:
|
||||
type: event
|
||||
description: >
|
||||
A user tapped the read button
|
||||
bugs:
|
||||
- 1195
|
||||
data_reviews:
|
||||
- https://github.com/mozilla-mobile/fenix/pull/1362#issuecomment-479668466
|
||||
notification_emails:
|
||||
- telemetry-client-dev@mozilla.com
|
||||
expires: "2020-03-01"
|
||||
|
||||
metrics:
|
||||
default_browser:
|
||||
type: boolean
|
||||
|
|
|
@ -274,6 +274,7 @@ class BrowserFragment : Fragment(), BackHandler {
|
|||
(activity as AppCompatActivity).supportActionBar?.hide()
|
||||
}
|
||||
|
||||
@Suppress("ComplexMethod")
|
||||
override fun onStart() {
|
||||
super.onStart()
|
||||
getAutoDisposeObservable<SearchAction>()
|
||||
|
@ -302,14 +303,23 @@ class BrowserFragment : Fragment(), BackHandler {
|
|||
getAutoDisposeObservable<QuickActionAction>()
|
||||
.subscribe {
|
||||
when (it) {
|
||||
is QuickActionAction.Opened -> {
|
||||
requireComponents.analytics.metrics.track(Event.QuickActionSheetOpened)
|
||||
}
|
||||
is QuickActionAction.Closed -> {
|
||||
requireComponents.analytics.metrics.track(Event.QuickActionSheetClosed)
|
||||
}
|
||||
is QuickActionAction.SharePressed -> {
|
||||
requireComponents.analytics.metrics.track(Event.QuickActionSheetShareTapped)
|
||||
requireComponents.core.sessionManager
|
||||
.selectedSession?.url?.apply { requireContext().share(this) }
|
||||
}
|
||||
is QuickActionAction.DownloadsPressed -> {
|
||||
requireComponents.analytics.metrics.track(Event.QuickActionSheetDownloadTapped)
|
||||
ItsNotBrokenSnack(context!!).showSnackbar(issueNumber = "348")
|
||||
}
|
||||
is QuickActionAction.BookmarkPressed -> {
|
||||
requireComponents.analytics.metrics.track(Event.QuickActionSheetBookmarkTapped)
|
||||
val session = requireComponents.core.sessionManager.selectedSession
|
||||
CoroutineScope(IO).launch {
|
||||
requireComponents.core.bookmarksStorage
|
||||
|
@ -334,6 +344,7 @@ class BrowserFragment : Fragment(), BackHandler {
|
|||
}
|
||||
}
|
||||
is QuickActionAction.ReadPressed -> {
|
||||
requireComponents.analytics.metrics.track(Event.QuickActionSheetReadTapped)
|
||||
ItsNotBrokenSnack(context!!).showSnackbar(issueNumber = "908")
|
||||
}
|
||||
}
|
||||
|
|
|
@ -12,6 +12,7 @@ import org.mozilla.fenix.GleanMetrics.CrashReporter
|
|||
import org.mozilla.fenix.GleanMetrics.Events
|
||||
import org.mozilla.fenix.GleanMetrics.FindInPage
|
||||
import org.mozilla.fenix.GleanMetrics.ContextMenu
|
||||
import org.mozilla.fenix.GleanMetrics.QuickActionSheet
|
||||
import org.mozilla.fenix.GleanMetrics.Metrics
|
||||
import org.mozilla.fenix.utils.Settings
|
||||
|
||||
|
@ -84,6 +85,24 @@ private val Event.wrapper
|
|||
{ Events.browserMenuAction },
|
||||
{ Events.browserMenuActionKeys.valueOf(it) }
|
||||
)
|
||||
is Event.QuickActionSheetOpened -> EventWrapper<NoExtraKeys>(
|
||||
{ QuickActionSheet.opened.record(it) }
|
||||
)
|
||||
is Event.QuickActionSheetClosed -> EventWrapper<NoExtraKeys>(
|
||||
{ QuickActionSheet.closed.record(it) }
|
||||
)
|
||||
is Event.QuickActionSheetShareTapped -> EventWrapper<NoExtraKeys>(
|
||||
{ QuickActionSheet.shareTapped.record(it) }
|
||||
)
|
||||
is Event.QuickActionSheetBookmarkTapped -> EventWrapper<NoExtraKeys>(
|
||||
{ QuickActionSheet.bookmarkTapped.record(it) }
|
||||
)
|
||||
is Event.QuickActionSheetDownloadTapped -> EventWrapper<NoExtraKeys>(
|
||||
{ QuickActionSheet.downloadTapped.record(it) }
|
||||
)
|
||||
is Event.QuickActionSheetReadTapped -> EventWrapper<NoExtraKeys>(
|
||||
{ QuickActionSheet.readTapped.record(it) }
|
||||
)
|
||||
|
||||
// Don't track other events with Glean
|
||||
else -> null
|
||||
|
|
|
@ -10,9 +10,6 @@ import mozilla.components.support.base.facts.Facts
|
|||
import org.mozilla.fenix.BuildConfig
|
||||
|
||||
sealed class Event {
|
||||
object AddBookmark : Event()
|
||||
object RemoveBookmark : Event()
|
||||
object OpenedBookmark : Event()
|
||||
|
||||
data class OpenedApp(val source: Source) : Event() {
|
||||
enum class Source { APP_ICON, LINK, CUSTOM_TAB }
|
||||
|
@ -49,6 +46,15 @@ sealed class Event {
|
|||
object DarkModeEnabled : Event()
|
||||
object SearchShortcutMenuOpened : Event()
|
||||
object SearchShortcutMenuClosed : Event()
|
||||
object AddBookmark : Event()
|
||||
object RemoveBookmark : Event()
|
||||
object OpenedBookmark : Event()
|
||||
object QuickActionSheetOpened : Event()
|
||||
object QuickActionSheetClosed : Event()
|
||||
object QuickActionSheetShareTapped : Event()
|
||||
object QuickActionSheetBookmarkTapped : Event()
|
||||
object QuickActionSheetDownloadTapped : Event()
|
||||
object QuickActionSheetReadTapped : Event()
|
||||
|
||||
// Interaction Events
|
||||
data class SearchBarTapped(val source: Source) : Event() {
|
||||
|
|
|
@ -41,6 +41,8 @@ class QuickActionComponent(
|
|||
data class QuickActionState(val readable: Boolean) : ViewState
|
||||
|
||||
sealed class QuickActionAction : Action {
|
||||
object Opened : QuickActionAction()
|
||||
object Closed : QuickActionAction()
|
||||
object SharePressed : QuickActionAction()
|
||||
object DownloadsPressed : QuickActionAction()
|
||||
object BookmarkPressed : QuickActionAction()
|
||||
|
|
|
@ -48,17 +48,6 @@ class QuickActionSheet @JvmOverloads constructor(
|
|||
|
||||
handle.setAccessibilityDelegate(HandleAccessibilityDelegate(quickActionSheetBehavior))
|
||||
|
||||
quickActionSheetBehavior.setBottomSheetCallback(object : BottomSheetBehavior.BottomSheetCallback() {
|
||||
override fun onStateChanged(v: View, state: Int) {
|
||||
updateImportantForAccessibility(state)
|
||||
}
|
||||
|
||||
override fun onSlide(p0: View, p1: Float) {
|
||||
}
|
||||
})
|
||||
|
||||
updateImportantForAccessibility(quickActionSheetBehavior.state)
|
||||
|
||||
val settings = Settings.getInstance(context)
|
||||
if (settings.shouldAutoBounceQuickActionSheet) {
|
||||
settings.incrementAutomaticBounceQuickActionSheetCount()
|
||||
|
@ -66,14 +55,6 @@ class QuickActionSheet @JvmOverloads constructor(
|
|||
}
|
||||
}
|
||||
|
||||
private fun updateImportantForAccessibility(state: Int) {
|
||||
findViewById<LinearLayout>(R.id.quick_action_buttons_layout).importantForAccessibility =
|
||||
if (state == BottomSheetBehavior.STATE_COLLAPSED || state == BottomSheetBehavior.STATE_HIDDEN)
|
||||
View.IMPORTANT_FOR_ACCESSIBILITY_NO_HIDE_DESCENDANTS
|
||||
else
|
||||
View.IMPORTANT_FOR_ACCESSIBILITY_AUTO
|
||||
}
|
||||
|
||||
private fun bounceSheet(
|
||||
quickActionSheetBehavior: QuickActionSheetBehavior,
|
||||
duration: Long = bounceAnimationLength
|
||||
|
|
|
@ -7,6 +7,7 @@ package org.mozilla.fenix.quickactionsheet
|
|||
import android.view.LayoutInflater
|
||||
import android.view.View
|
||||
import android.view.ViewGroup
|
||||
import android.widget.LinearLayout
|
||||
import androidx.core.widget.NestedScrollView
|
||||
import com.google.android.material.bottomsheet.BottomSheetBehavior
|
||||
import io.reactivex.Observable
|
||||
|
@ -15,6 +16,8 @@ import io.reactivex.functions.Consumer
|
|||
import kotlinx.android.synthetic.main.fragment_browser.*
|
||||
import kotlinx.android.synthetic.main.layout_quick_action_sheet.view.*
|
||||
import org.mozilla.fenix.R
|
||||
import org.mozilla.fenix.components.metrics.Event
|
||||
import org.mozilla.fenix.ext.components
|
||||
import org.mozilla.fenix.mvi.UIView
|
||||
|
||||
class QuickActionUIView(
|
||||
|
@ -31,6 +34,23 @@ class QuickActionUIView(
|
|||
val quickActionSheetBehavior =
|
||||
BottomSheetBehavior.from(nestedScrollQuickAction as View) as QuickActionSheetBehavior
|
||||
|
||||
quickActionSheetBehavior.setBottomSheetCallback(object : BottomSheetBehavior.BottomSheetCallback() {
|
||||
override fun onStateChanged(v: View, state: Int) {
|
||||
updateImportantForAccessibility(state)
|
||||
|
||||
if (state == BottomSheetBehavior.STATE_EXPANDED) {
|
||||
actionEmitter.onNext(QuickActionAction.Opened)
|
||||
} else if (state == BottomSheetBehavior.STATE_COLLAPSED) {
|
||||
actionEmitter.onNext(QuickActionAction.Closed)
|
||||
}
|
||||
}
|
||||
|
||||
override fun onSlide(p0: View, p1: Float) {
|
||||
}
|
||||
})
|
||||
|
||||
updateImportantForAccessibility(quickActionSheetBehavior.state)
|
||||
|
||||
view.quick_action_share.setOnClickListener {
|
||||
actionEmitter.onNext(QuickActionAction.SharePressed)
|
||||
quickActionSheetBehavior.state = BottomSheetBehavior.STATE_COLLAPSED
|
||||
|
@ -49,6 +69,23 @@ class QuickActionUIView(
|
|||
}
|
||||
}
|
||||
|
||||
private fun updateImportantForAccessibility(state: Int) {
|
||||
view.findViewById<LinearLayout>(R.id.quick_action_buttons_layout).importantForAccessibility =
|
||||
if (state == BottomSheetBehavior.STATE_COLLAPSED || state == BottomSheetBehavior.STATE_HIDDEN)
|
||||
View.IMPORTANT_FOR_ACCESSIBILITY_NO_HIDE_DESCENDANTS
|
||||
else
|
||||
View.IMPORTANT_FOR_ACCESSIBILITY_AUTO
|
||||
}
|
||||
|
||||
private fun sendTelemetryEvent(state: Int) {
|
||||
when (state) {
|
||||
BottomSheetBehavior.STATE_EXPANDED ->
|
||||
view.context.components.analytics.metrics.track(Event.QuickActionSheetOpened)
|
||||
BottomSheetBehavior.STATE_COLLAPSED ->
|
||||
view.context.components.analytics.metrics.track(Event.QuickActionSheetClosed)
|
||||
}
|
||||
}
|
||||
|
||||
override fun updateView() = Consumer<QuickActionState> {
|
||||
view.quick_action_read.visibility = if (it.readable) View.VISIBLE else View.GONE
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue