[SDK-344] Pass in first-run information to Nimbus for targeting

upstream-sync
Travis Long 3 years ago committed by mergify[bot]
parent 98b218d964
commit c9c28b66c8

@ -63,7 +63,10 @@ fun createNimbus(context: Context, url: String?): NimbusApi {
// Note: Using BuildConfig.BUILD_TYPE is important here so that it matches the value
// passed into Glean. `Config.channel.toString()` turned out to be non-deterministic
// and would mostly produce the value `Beta` and rarely would produce `beta`.
channel = BuildConfig.BUILD_TYPE
channel = BuildConfig.BUILD_TYPE,
customTargetingAttributes = mapOf(
"isFirstRun" to context.settings().isFirstRun.toString()
)
)
Nimbus(context, appInfo, serverSettings, errorReporter).apply {
// This performs the minimal amount of work required to load branch and enrolment data

@ -352,6 +352,25 @@ class Settings(private val appContext: Context) : PreferencesHolder {
default = false
)
val isFirstRun: Boolean
get() {
val isFirstRun = preferences.getBoolean(
appContext.getPreferenceKey(R.string.pref_key_is_first_run),
true
)
if (isFirstRun) {
preferences.edit()
.putBoolean(
appContext.getPreferenceKey(R.string.pref_key_is_first_run),
false
)
.apply()
}
return isFirstRun
}
/**
* Indicates the last time when the user was interacting with the [BrowserFragment],
* This is useful to determine if the user has to start on the [HomeFragment]

@ -69,6 +69,7 @@
<string name="pref_key_last_browse_activity_time" translatable="false">pref_key_last_browse_activity_time</string>
<string name="pref_key_last_cfr_shown_time" translatable="false">pref_key_last_cfr_shown_time</string>
<string name="pref_key_should_show_default_browser_notification" translatable="false">pref_key_should_show_default_browser_notification</string>
<string name="pref_key_is_first_run" translatable="false">pref_key_is_first_run</string>
<!-- Data Choices -->
<string name="pref_key_telemetry" translatable="false">pref_key_telemetry</string>

Loading…
Cancel
Save