diff --git a/app/src/main/java/org/mozilla/fenix/components/metrics/LeanplumMetricsService.kt b/app/src/main/java/org/mozilla/fenix/components/metrics/LeanplumMetricsService.kt index 15b59c1c8..4d9ca393e 100644 --- a/app/src/main/java/org/mozilla/fenix/components/metrics/LeanplumMetricsService.kt +++ b/app/src/main/java/org/mozilla/fenix/components/metrics/LeanplumMetricsService.kt @@ -37,7 +37,8 @@ private val Event.name: String? is Event.CollectionSaved -> "E_Collection_Created" is Event.CollectionTabRestored -> "E_Collection_Tab_Opened" is Event.SyncAuthSignUp -> "E_FxA_New_Signup" - is Event.SyncAuthSignIn -> "E_Sign_In_FxA" + is Event.SyncAuthSignIn, Event.SyncAuthPaired, Event.SyncAuthOtherExternal -> "E_Sign_In_FxA" + is Event.SyncAuthFromShared -> "E_Sign_In_FxA_Fennec_to_Fenix" is Event.SyncAuthSignOut -> "E_Sign_Out_FxA" is Event.ClearedPrivateData -> "E_Cleared_Private_Data" is Event.DismissedOnboarding -> "E_Dismissed_Onboarding" @@ -107,13 +108,13 @@ class LeanplumMetricsService( val currentLocale = applicationSetLocale ?: Locale.getDefault() val languageCode = currentLocale.iso3LanguageOrNull - ?: currentLocale.language.let { - if (it.isNotBlank()) { - it - } else { - currentLocale.toString() + ?: currentLocale.language.let { + if (it.isNotBlank()) { + it + } else { + currentLocale.toString() + } } - } if (!isLeanplumEnabled(languageCode)) { Log.i(LOGTAG, "Leanplum is not available for this locale: $languageCode") @@ -142,18 +143,21 @@ class LeanplumMetricsService( } } - Leanplum.start(application, hashMapOf( - "default_browser" to MozillaProductDetector.getMozillaBrowserDefault(application).orEmpty(), - "fennec_installed" to installedApps.contains(MozillaProducts.FIREFOX.productName), - "focus_installed" to installedApps.contains(MozillaProducts.FOCUS.productName), - "klar_installed" to installedApps.contains(MozillaProducts.KLAR.productName), - "fxa_signed_in" to application.settings().fxaSignedIn, - "fxa_has_synced_items" to application.settings().fxaHasSyncedItems, - "search_widget_installed" to application.settings().searchWidgetInstalled, - "tracking_protection_enabled" to application.settings().shouldUseTrackingProtection, - "tracking_protection_setting" to trackingProtection, - "fenix" to true - )) + Leanplum.start( + application, hashMapOf( + "default_browser" to MozillaProductDetector.getMozillaBrowserDefault(application) + .orEmpty(), + "fennec_installed" to installedApps.contains(MozillaProducts.FIREFOX.productName), + "focus_installed" to installedApps.contains(MozillaProducts.FOCUS.productName), + "klar_installed" to installedApps.contains(MozillaProducts.KLAR.productName), + "fxa_signed_in" to application.settings().fxaSignedIn, + "fxa_has_synced_items" to application.settings().fxaHasSyncedItems, + "search_widget_installed" to application.settings().searchWidgetInstalled, + "tracking_protection_enabled" to application.settings().shouldUseTrackingProtection, + "tracking_protection_setting" to trackingProtection, + "fenix" to true + ) + ) withContext(Main) { LeanplumInternal.setCalledStart(true) @@ -202,7 +206,9 @@ class LeanplumMetricsService( get() = try { this.isO3Language - } catch (_: MissingResourceException) { null } + } catch (_: MissingResourceException) { + null + } companion object { private const val LOGTAG = "LeanplumMetricsService" @@ -213,6 +219,7 @@ class LeanplumMetricsService( private val LeanplumToken: String // Debug builds have a null (nullable) LEANPLUM_TOKEN get() = BuildConfig.LEANPLUM_TOKEN.orEmpty() + // Leanplum needs to be enabled for the following locales. // Irrespective of the actual device location. private val LEANPLUM_ENABLED_LOCALES = setOf( diff --git a/docs/mma.md b/docs/mma.md index de12f9208..4db6157ae 100644 --- a/docs/mma.md +++ b/docs/mma.md @@ -225,7 +225,12 @@ Here is the list of current Events sent, which can be found here in the code bas `E_Sign_In_FxA` The user successfully signed in to FxA #4626 - + + + `E_Sign_In_FxA_Fennec_to_Fenix` + The user successfully signed in to FxA using previously signed in Fennec account + #4626 + `E_Sign_Out_FxA` The user successfully signed out of FxA