Bug 1861664 - Fix shopping experience nimbus flag usage

(cherry picked from commit 9229d02daa613375bc9ea1f5aca669e1ec066a5b)
fenix/120.0
rahulsainani 7 months ago committed by mergify[bot]
parent de4a2329e5
commit 8a05a6e2c7

@ -285,9 +285,7 @@ class BrowserFragment : BaseBrowserFragment(), UserInteractionHandler {
feature = ReviewQualityCheckFeature(
appStore = requireComponents.appStore,
browserStore = context.components.core.store,
shoppingExperienceFeature = DefaultShoppingExperienceFeature(
settings = requireContext().settings(),
),
shoppingExperienceFeature = DefaultShoppingExperienceFeature(),
onIconVisibilityChange = {
if (!reviewQualityCheckAvailable && it) {
Shopping.addressBarIconDisplayed.record()

@ -40,7 +40,6 @@ import org.mozilla.fenix.GleanMetrics.Shopping
import org.mozilla.fenix.GleanMetrics.TrackingProtection
import org.mozilla.fenix.R
import org.mozilla.fenix.ext.components
import org.mozilla.fenix.ext.settings
import org.mozilla.fenix.settings.SupportUtils
import org.mozilla.fenix.settings.SupportUtils.SumoTopic.TOTAL_COOKIE_PROTECTION
import org.mozilla.fenix.shopping.DefaultShoppingExperienceFeature
@ -81,9 +80,7 @@ class BrowserToolbarCFRPresenter(
private val sessionId: String? = null,
private val onShoppingCfrActionClicked: () -> Unit,
private val onShoppingCfrDismiss: () -> Unit,
private val shoppingExperienceFeature: ShoppingExperienceFeature = DefaultShoppingExperienceFeature(
context.settings(),
),
private val shoppingExperienceFeature: ShoppingExperienceFeature = DefaultShoppingExperienceFeature(),
) {
@VisibleForTesting
internal var scope: CoroutineScope? = null

@ -60,12 +60,6 @@ class SecretSettingsFragment : PreferenceFragmentCompat() {
onPreferenceChangeListener = SharedPreferenceUpdater()
}
requirePreference<SwitchPreference>(R.string.pref_key_enable_shopping_experience).apply {
isVisible = Config.channel.isNightlyOrDebug
isChecked = context.settings().enableShoppingExperience
onPreferenceChangeListener = SharedPreferenceUpdater()
}
requirePreference<SwitchPreference>(R.string.pref_key_enable_translations).apply {
isVisible = FeatureFlags.translations
isChecked = context.settings().enableTranslations

@ -4,7 +4,7 @@
package org.mozilla.fenix.shopping
import org.mozilla.fenix.utils.Settings
import org.mozilla.fenix.nimbus.FxNimbus
/**
* An abstraction for shopping experience feature flag.
@ -19,13 +19,9 @@ interface ShoppingExperienceFeature {
/**
* The default implementation of [ShoppingExperienceFeature].
*
* @property settings Used to check if the feature is enabled.
*/
class DefaultShoppingExperienceFeature(
private val settings: Settings,
) : ShoppingExperienceFeature {
class DefaultShoppingExperienceFeature : ShoppingExperienceFeature {
override val isEnabled
get() = settings.enableShoppingExperience
get() = FxNimbus.features.shoppingExperience.value().enabled
}

@ -1852,14 +1852,6 @@ class Settings(private val appContext: Context) : PreferencesHolder {
default = FeatureFlags.composeTopSites,
)
/**
* Indicates if the shopping experience feature is enabled.
*/
val enableShoppingExperience by booleanPreference(
key = appContext.getPreferenceKey(R.string.pref_key_enable_shopping_experience),
default = FxNimbus.features.shoppingExperience.value().enabled,
)
/**
* Indicates if Firefox translations are enabled.
*/

@ -356,7 +356,6 @@
<string name="pref_key_custom_sponsored_stories_country" translatable="false">pref_key_custom_sponsored_stories_country</string>
<string name="pref_key_custom_sponsored_stories_city" translatable="false">pref_key_custom_sponsored_stories_city</string>
<string name="pref_key_enable_compose_top_sites" translatable="false">pref_key_enable_compose_top_sites</string>
<string name="pref_key_enable_shopping_experience" translatable="false">pref_key_enable_shopping_experience</string>
<string name="pref_key_enable_translations" translatable="false">pref_key_enable_translations</string>
<!-- Growth Data -->

@ -66,8 +66,6 @@
<string name="preferences_debug_settings_tabs_tray_to_compose" translatable="false">Enable Tabs Tray to Compose rewrite</string>
<!-- Label for enabling the Compose Top Sites -->
<string name="preferences_debug_settings_compose_top_sites" translatable="false">Enable Compose Top Sites</string>
<!-- Label for enabling the shopping experience -->
<string name="preferences_debug_settings_shopping_experience" translatable="false">Enable Shopping Experience</string>
<!-- Label for enabling translations -->
<string name="preferences_debug_settings_translations" translatable="false">Enable Firefox Translations</string>
<!-- Label for enabling Firefox Suggest -->

@ -25,11 +25,6 @@
android:key="@string/pref_key_enable_compose_top_sites"
android:title="@string/preferences_debug_settings_compose_top_sites"
app:iconSpaceReserved="false" />
<SwitchPreference
android:defaultValue="false"
android:key="@string/pref_key_enable_shopping_experience"
android:title="@string/preferences_debug_settings_shopping_experience"
app:iconSpaceReserved="false" />
<SwitchPreference
android:defaultValue="false"
android:key="@string/pref_key_enable_translations"

Loading…
Cancel
Save