Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
The Tor Project
Applications
fenix
Commits
21ca451f
Verified
Commit
21ca451f
authored
Aug 03, 2021
by
Matthew Finkel
Committed by
aguestuser
Apr 21, 2022
Browse files
Bug 40185: Use NimbusDisabled
parent
518ce382
Changes
3
Hide whitespace changes
Inline
Side-by-side
app/src/main/java/org/mozilla/fenix/components/Analytics.kt
View file @
21ca451f
...
...
@@ -15,6 +15,7 @@ import mozilla.components.lib.crash.service.GleanCrashReporterService
import
mozilla.components.lib.crash.service.MozillaSocorroService
import
mozilla.components.lib.crash.service.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.HomeActivity
...
...
@@ -112,8 +113,12 @@ class Analytics(
}
val
experiments
:
NimbusApi
by
lazyMonitored
{
createNimbus
(
context
,
BuildConfig
.
NIMBUS_ENDPOINT
).
also
{
api
->
FxNimbus
.
api
=
api
if
(
BuildConfig
.
DATA_COLLECTION_DISABLED
)
{
NimbusDisabled
(
context
)
}
else
{
createNimbus
(
context
,
BuildConfig
.
NIMBUS_ENDPOINT
).
also
{
api
->
FxNimbus
.
api
=
api
}
}
}
}
...
...
app/src/main/java/org/mozilla/fenix/settings/SettingsFragment.kt
View file @
21ca451f
...
...
@@ -158,11 +158,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"
)
...
...
app/src/main/java/org/mozilla/fenix/utils/Settings.kt
View file @
21ca451f
...
...
@@ -131,7 +131,8 @@ class Settings(private val appContext: Context) : PreferencesHolder {
var
showTopFrecentSites
by
lazyFeatureFlagPreference
(
appContext
.
getPreferenceKey
(
R
.
string
.
pref_key_enable_top_frecent_sites
),
featureFlag
=
true
,
default
=
{
homescreenSections
[
HomeScreenSection
.
TOP_SITES
]
==
true
},
default
=
{
true
}
// default = { homescreenSections[HomeScreenSection.TOP_SITES] == true },
)
var
numberOfAppLaunches
by
intPreference
(
...
...
@@ -379,19 +380,23 @@ class Settings(private val appContext: Context) : PreferencesHolder {
numberOfAppLaunches
>
APP_LAUNCHES_TO_SHOW_DEFAULT_BROWSER_CARD
}
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
false
// 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
),
...
...
@@ -513,7 +518,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
(
appContext
).
enabled
},
default
=
{
false
},
featureFlag
=
FeatureFlags
.
tabGroupFeature
)
...
...
@@ -1267,13 +1272,16 @@ class Settings(private val appContext: Context) : PreferencesHolder {
default
=
false
)
private
val
homescreenSections
:
Map
<
HomeScreenSection
,
Boolean
>
by
lazy
{
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.
// private val homescreenSections: Map<HomeScreenSection, Boolean> by lazy {
// FxNimbus.features.homescreen.value().sectionsEnabled
// }
var
historyMetadataUIFeature
by
lazyFeatureFlagPreference
(
appContext
.
getPreferenceKey
(
R
.
string
.
pref_key_history_metadata_feature
),
default
=
{
homescreenSections
[
HomeScreenSection
.
RECENT_EXPLORATIONS
]
==
true
},
default
=
{
true
},
// default = { homescreenSections[HomeScreenSection.RECENT_EXPLORATIONS] == true },
featureFlag
=
FeatureFlags
.
historyMetadataUIFeature
||
isHistoryMetadataEnabled
)
...
...
@@ -1284,7 +1292,8 @@ 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
},
// default = { homescreenSections[HomeScreenSection.JUMP_BACK_IN] == true },
)
/**
...
...
@@ -1293,7 +1302,8 @@ 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
},
// default = { homescreenSections[HomeScreenSection.RECENTLY_SAVED] == true },
featureFlag
=
FeatureFlags
.
recentBookmarksFeature
)
...
...
@@ -1325,7 +1335,8 @@ 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
},
// default = { homescreenSections[HomeScreenSection.POCKET] == true },
)
/**
...
...
@@ -1333,7 +1344,8 @@ 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
},
// default = { homescreenSections[HomeScreenSection.CONTILE_TOP_SITES] == true },
featureFlag
=
FeatureFlags
.
contileFeature
,
)
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment