1
0
Fork 0

For #8125 - Send top sites count with metrics ping

master
ekager 2020-03-31 11:27:10 -07:00 committed by Jeff Boek
parent 8c398c86ef
commit 96c6401457
6 changed files with 42 additions and 13 deletions

View File

@ -295,6 +295,34 @@ metrics:
notification_emails:
- fenix-core@mozilla.com
expires: "2020-09-01"
top_sites_count:
type: counter
lifetime: application
description: >
A counter that indicates how many top sites a user has
send_in_pings:
- metrics
bugs:
- https://github.com/mozilla-mobile/fenix/issues/8125
data_reviews:
- https://github.com/mozilla-mobile/fenix/pull/9556
notification_emails:
- fenix-core@mozilla.com
expires: "2020-09-01"
has_top_sites:
type: boolean
lifetime: application
description: >
A boolean that indicates if the user has top sites
send_in_pings:
- metrics
bugs:
- https://github.com/mozilla-mobile/fenix/issues/8125
data_reviews:
- https://github.com/mozilla-mobile/fenix/pull/9556
notification_emails:
- fenix-core@mozilla.com
expires: "2020-09-01"
search_count:
type: labeled_counter
description: >

View File

@ -546,6 +546,8 @@ class GleanMetricsService(private val context: Context) : MetricsService {
adjustAdGroup.set(context.settings().adjustAdGroup)
adjustCreative.set(context.settings().adjustCreative)
adjustNetwork.set(context.settings().adjustNetwork)
hasTopSites.set(context.settings().topSitesSize > 0)
topSitesCount.add(context.settings().topSitesSize)
toolbarPosition.set(
if (context.settings().shouldUseBottomToolbar) {

View File

@ -42,19 +42,8 @@ import androidx.recyclerview.widget.RecyclerView
import androidx.recyclerview.widget.RecyclerView.SCROLL_STATE_IDLE
import com.google.android.material.appbar.AppBarLayout
import com.google.android.material.snackbar.Snackbar
import kotlinx.android.synthetic.main.fragment_home.homeAppBar
import kotlinx.android.synthetic.main.fragment_home.privateBrowsingButton
import kotlinx.android.synthetic.main.fragment_home.search_engine_icon
import kotlinx.android.synthetic.main.fragment_home.toolbarLayout
import kotlinx.android.synthetic.main.fragment_home.view.add_tab_button
import kotlinx.android.synthetic.main.fragment_home.view.bottomBarShadow
import kotlinx.android.synthetic.main.fragment_home.view.bottom_bar
import kotlinx.android.synthetic.main.fragment_home.view.homeAppBar
import kotlinx.android.synthetic.main.fragment_home.view.menuButton
import kotlinx.android.synthetic.main.fragment_home.view.sessionControlRecyclerView
import kotlinx.android.synthetic.main.fragment_home.view.toolbar
import kotlinx.android.synthetic.main.fragment_home.view.toolbarLayout
import kotlinx.android.synthetic.main.fragment_home.view.toolbar_wrapper
import kotlinx.android.synthetic.main.fragment_home.*
import kotlinx.android.synthetic.main.fragment_home.view.*
import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.Dispatchers.IO
import kotlinx.coroutines.Dispatchers.Main
@ -689,6 +678,8 @@ class HomeFragment : Fragment() {
private fun subscribeToTopSites(): Observer<List<TopSite>> {
return Observer<List<TopSite>> { topSites ->
requireComponents.core.topSiteStorage.cachedTopSites = topSites
context?.settings()?.preferences?.edit()
?.putInt(getString(R.string.pref_key_top_sites_size), topSites.size)?.apply()
homeFragmentStore.dispatch(HomeFragmentAction.TopSitesChange(topSites))
}.also { observer ->
requireComponents.core.topSiteStorage.getTopSites().observe(this, observer)

View File

@ -609,4 +609,9 @@ class Settings private constructor(
appContext.getPreferenceKey(R.string.pref_key_override_sync_tokenserver),
default = ""
)
val topSitesSize by intPreference(
appContext.getPreferenceKey(R.string.pref_key_top_sites_size),
default = 0
)
}

View File

@ -156,4 +156,5 @@
<string name="pref_key_encryption_key_generated" translatable="false">pref_key_encryption_key_generated</string>
<string name="default_top_sites_added" translatable="false">pref_key_pocket_top_site_added</string>
<string name="pref_key_top_sites_size" translatable="false">pref_key_top_sites_size</string>
</resources>

File diff suppressed because one or more lines are too long