diff --git a/app/src/main/java/org/mozilla/fenix/experiments/NimbusSetup.kt b/app/src/main/java/org/mozilla/fenix/experiments/NimbusSetup.kt index e769bec4fe..14156c570d 100644 --- a/app/src/main/java/org/mozilla/fenix/experiments/NimbusSetup.kt +++ b/app/src/main/java/org/mozilla/fenix/experiments/NimbusSetup.kt @@ -101,7 +101,8 @@ fun createNimbus(context: Context, url: String?): NimbusApi { globalUserParticipation = enabled } - if (url.isNullOrBlank()) { + if (context.settings().isFirstRun || url.isNullOrBlank()) { + context.settings().isFirstRun = false setExperimentsLocally(R.raw.initial_experiments) } diff --git a/app/src/main/java/org/mozilla/fenix/utils/Settings.kt b/app/src/main/java/org/mozilla/fenix/utils/Settings.kt index 09884d5ed7..a89e1712e6 100644 --- a/app/src/main/java/org/mozilla/fenix/utils/Settings.kt +++ b/app/src/main/java/org/mozilla/fenix/utils/Settings.kt @@ -347,18 +347,10 @@ class Settings(private val appContext: Context) : PreferencesHolder { default = false ) - val isFirstRun: Boolean = - if (!preferences.contains(appContext.getPreferenceKey(R.string.pref_key_is_first_run))) { - preferences.edit() - .putBoolean( - appContext.getPreferenceKey(R.string.pref_key_is_first_run), - false - ) - .apply() - true - } else { - false - } + val isFirstRun: Boolean by booleanPreference( + appContext.getPreferenceKey(R.string.pref_key_is_first_run), + default = true + ) /** * Indicates the last time when the user was interacting with the [BrowserFragment],