Backed out changeset 48baafc34055 (bug 1789166) for causing mochitests failures....
[gecko.git] / mobile / android / fenix / app / src / main / java / org / mozilla / fenix / FeatureFlags.kt
bloba69b8f7df6a4870349173c026b4c07c5939b5cf5
1 /* This Source Code Form is subject to the terms of the Mozilla Public
2  * License, v. 2.0. If a copy of the MPL was not distributed with this
3  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
5 package org.mozilla.fenix
7 import android.content.Context
8 import mozilla.components.support.locale.LocaleManager
9 import mozilla.components.support.locale.LocaleManager.getSystemDefault
11 /**
12  * A single source for setting feature flags that are mostly based on build type.
13  */
14 object FeatureFlags {
16     /**
17      * Enables custom extension collection feature,
18      * This feature does not only depend on this flag. It requires the AMO collection override to
19      * be enabled which is behind the Secret Settings.
20      * */
21     val customExtensionCollectionFeature = Config.channel.isNightlyOrDebug || Config.channel.isBeta
23     /**
24      * Pull-to-refresh allows you to pull the web content down far enough to have the page to
25      * reload.
26      */
27     const val pullToRefreshEnabled = true
29     /**
30      * Enables the Sync Addresses feature.
31      */
32     const val syncAddressesFeature = false
34     /**
35      * Show Pocket recommended stories on home.
36      */
37     fun isPocketRecommendationsFeatureEnabled(context: Context): Boolean {
38         val langTag = LocaleManager.getCurrentLocale(context)
39             ?.toLanguageTag() ?: getSystemDefault().toLanguageTag()
40         return listOf("en-US", "en-CA").contains(langTag)
41     }
43     /**
44      * Show Pocket sponsored stories in between Pocket recommended stories on home.
45      */
46     fun isPocketSponsoredStoriesFeatureEnabled(context: Context): Boolean {
47         return isPocketRecommendationsFeatureEnabled(context)
48     }
50     /**
51      * Enables compose on the tabs tray items.
52      */
53     const val composeTabsTray = true
55     /**
56      * Enables compose on the top sites.
57      */
58     const val composeTopSites = false
60     /**
61      * Enables new search settings UI with two extra fragments, for managing the default engine
62      * and managing search shortcuts in the quick search menu.
63      */
64     const val unifiedSearchSettings = true
66     /**
67      * Allows users to enable Firefox Suggest.
68      */
69     const val fxSuggest = true
71     /**
72      * Allows users to enable SuggestStrongPassword feature.
73      */
74     const val suggestStrongPassword = true
76     /**
77      * Enable Meta attribution.
78      */
79     const val metaAttributionEnabled = true
81     /**
82      * Enables Navigation Toolbar.
83      */
84     val navigationToolbarEnabled = Config.channel.isNightlyOrDebug
86     /**
87      * Enables the menu redesign.
88      */
89     const val menuRedesignEnabled = false
91     /**
92      * Enables the Compose Homepage.
93      */
94     const val composeHomepage = false
96     /**
97      * Enables Homepage as a New Tab.
98      */
99     const val homepageAsNewTab = false