Skip to content

Commit

Permalink
For mozilla-mobile#11531: Add search widget installed leanplum event
Browse files Browse the repository at this point in the history
  • Loading branch information
sblatz authored and ekager committed Jul 29, 2020
1 parent 6b6e195 commit 2b1122b
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -665,6 +665,7 @@ private val Event.wrapper: EventWrapper<*>?
is Event.DismissedOnboarding -> null
is Event.FennecToFenixMigrated -> null
is Event.AddonInstalled -> null
is Event.SearchWidgetInstalled -> null
}

class GleanMetricsService(private val context: Context) : MetricsService {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ private val Event.name: String?
is Event.DismissedOnboarding -> "E_Dismissed_Onboarding"
is Event.FennecToFenixMigrated -> "E_Fennec_To_Fenix_Migrated"
is Event.AddonInstalled -> "E_Addon_Installed"
is Event.SearchWidgetInstalled -> "E_Search_Widget_Added"

// Do not track other events in Leanplum
else -> null
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,7 @@ sealed class Event {
object SearchWidgetCFRCanceled : Event()
object SearchWidgetCFRNotNowPressed : Event()
object SearchWidgetCFRAddWidgetPressed : Event()
object SearchWidgetInstalled : Event()
object OnboardingAutoSignIn : Event()
object OnboardingManualSignIn : Event()
object OnboardingPrivacyNotice : Event()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ import androidx.core.graphics.drawable.toBitmap
import org.mozilla.fenix.HomeActivity
import org.mozilla.fenix.IntentReceiverActivity
import org.mozilla.fenix.R
import org.mozilla.fenix.components.metrics.Event
import org.mozilla.fenix.ext.metrics
import org.mozilla.fenix.ext.settings
import org.mozilla.fenix.home.intent.StartSearchIntentProcessor
import org.mozilla.fenix.widget.VoiceSearchActivity
Expand All @@ -36,6 +38,7 @@ class SearchWidgetProvider : AppWidgetProvider() {

override fun onEnabled(context: Context) {
context.settings().addSearchWidgetInstalled(1)
context.metrics.track(Event.SearchWidgetInstalled)
}

override fun onDeleted(context: Context, appWidgetIds: IntArray) {
Expand Down

0 comments on commit 2b1122b

Please sign in to comment.