Skip to content
Snippets Groups Projects
Commit 9a7c8cb0 authored by Matthew Finkel's avatar Matthew Finkel Committed by Richard Pospesel
Browse files

Bug 40185: Use NimbusDisabled

parent 4510447b
Branches
Tags
1 merge request!162Draft: Rebase Fenix
......@@ -15,6 +15,7 @@ import mozilla.components.lib.crash.service.GleanCrashReporterService
import mozilla.components.lib.crash.service.MozillaSocorroService
import mozilla.components.lib.crash.sentry.SentryService
import mozilla.components.service.nimbus.NimbusApi
import mozilla.components.service.nimbus.NimbusDisabled
import org.mozilla.fenix.BuildConfig
import org.mozilla.fenix.Config
import org.mozilla.fenix.GleanMetrics.Messaging
......@@ -124,7 +125,13 @@ class Analytics(
}
val experiments: NimbusApi by lazyMonitored {
createNimbus(context, BuildConfig.NIMBUS_ENDPOINT)
if (BuildConfig.DATA_COLLECTION_DISABLED) {
NimbusDisabled(context)
} else {
createNimbus(context, BuildConfig.NIMBUS_ENDPOINT).also { api ->
FxNimbus.api = api
}
}
}
val messagingStorage by lazyMonitored {
......
......@@ -170,11 +170,14 @@ class SettingsFragment : PreferenceFragmentCompat() {
override fun onResume() {
super.onResume()
// Use nimbus to set the title, and a trivial addition
val nimbusValidation = FxNimbus.features.nimbusValidation.value()
val title = nimbusValidation.settingsTitle
val suffix = nimbusValidation.settingsPunctuation
// IN TOR BROWSER: We don't talk about Nimbus!
// ~Use nimbus to set the title, and a trivial addition~
// val nimbusValidation = FxNimbus.features.nimbusValidation.value()
// val title = nimbusValidation.settingsTitle
// val suffix = nimbusValidation.settingsPunctuation
val title = getString(R.string.settings_title)
val suffix = ""
showToolbar("$title$suffix")
......
......@@ -134,7 +134,7 @@ class Settings(private val appContext: Context) : PreferencesHolder {
var showTopSitesFeature by lazyFeatureFlagPreference(
appContext.getPreferenceKey(R.string.pref_key_show_top_sites),
featureFlag = true,
default = { homescreenSections[HomeScreenSection.TOP_SITES] == true },
default = { true }
)
var numberOfAppLaunches by intPreference(
......@@ -312,19 +312,15 @@ class Settings(private val appContext: Context) : PreferencesHolder {
default = false
)
private val defaultBrowserFeature: DefaultBrowserMessage by lazy {
FxNimbus.features.defaultBrowserMessage.value()
}
// IN TOR BROWSER: we want to avoid ever calling Nimbus, so we hard-code defaults
// for everything that would have accessed this property.
// private val defaultBrowserFeature: DefaultBrowserMessage by lazy {
// FxNimbus.features.defaultBrowserMessage.value()
// }
@Suppress("UNUSED_PARAMETER")
fun isDefaultBrowserMessageLocation(surfaceId: MessageSurfaceId): Boolean =
defaultBrowserFeature.messageLocation?.let { experimentalSurfaceId ->
if (experimentalSurfaceId == surfaceId) {
val browsers = BrowsersCache.all(appContext)
!browsers.isFirefoxDefaultBrowser
} else {
false
}
} ?: false
var gridTabView by booleanPreference(
appContext.getPreferenceKey(R.string.pref_key_tab_view_grid),
......@@ -445,7 +441,7 @@ class Settings(private val appContext: Context) : PreferencesHolder {
*/
var searchTermTabGroupsAreEnabled by lazyFeatureFlagPreference(
appContext.getPreferenceKey(R.string.pref_key_search_term_tab_groups),
default = { FxNimbus.features.searchTermGroups.value().enabled },
default = { false },
featureFlag = FeatureFlags.tabGroupFeature
)
......@@ -1203,12 +1199,12 @@ class Settings(private val appContext: Context) : PreferencesHolder {
default = false
)
private val homescreenSections: Map<HomeScreenSection, Boolean> get() =
FxNimbus.features.homescreen.value().sectionsEnabled
// IN TOR BROWSER: we want to avoid ever calling Nimbus, so we hard-code defaults
// for everything that would have accessed this property.
var historyMetadataUIFeature by lazyFeatureFlagPreference(
appContext.getPreferenceKey(R.string.pref_key_history_metadata_feature),
default = { homescreenSections[HomeScreenSection.RECENT_EXPLORATIONS] == true },
default = { true },
featureFlag = FeatureFlags.historyMetadataUIFeature || isHistoryMetadataEnabled
)
......@@ -1219,7 +1215,7 @@ class Settings(private val appContext: Context) : PreferencesHolder {
var showRecentTabsFeature by lazyFeatureFlagPreference(
appContext.getPreferenceKey(R.string.pref_key_recent_tabs),
featureFlag = FeatureFlags.showRecentTabsFeature,
default = { homescreenSections[HomeScreenSection.JUMP_BACK_IN] == true },
default = { true },
)
/**
......@@ -1228,7 +1224,7 @@ class Settings(private val appContext: Context) : PreferencesHolder {
*/
var showRecentBookmarksFeature by lazyFeatureFlagPreference(
appContext.getPreferenceKey(R.string.pref_key_recent_bookmarks),
default = { homescreenSections[HomeScreenSection.RECENTLY_SAVED] == true },
default = { true },
featureFlag = FeatureFlags.recentBookmarksFeature
)
......@@ -1271,7 +1267,7 @@ class Settings(private val appContext: Context) : PreferencesHolder {
var showPocketRecommendationsFeature by lazyFeatureFlagPreference(
appContext.getPreferenceKey(R.string.pref_key_pocket_homescreen_recommendations),
featureFlag = FeatureFlags.isPocketRecommendationsFeatureEnabled(appContext),
default = { homescreenSections[HomeScreenSection.POCKET] == true },
default = { false },
)
/**
......@@ -1297,7 +1293,7 @@ class Settings(private val appContext: Context) : PreferencesHolder {
*/
var showContileFeature by lazyFeatureFlagPreference(
key = appContext.getPreferenceKey(R.string.pref_key_enable_contile),
default = { homescreenSections[HomeScreenSection.CONTILE_TOP_SITES] == true },
default = { false },
featureFlag = true,
)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment