Closes #26858: Remove unused nimbus engine-settings tabs-prioritization-enabled feature.
This commit is contained in:
parent
49bef5d309
commit
5358e9b878
|
@ -1,12 +1,4 @@
|
||||||
---
|
---
|
||||||
engine-settings:
|
|
||||||
description: Contains a set of settings for controlling the web engine configurations.
|
|
||||||
hasExposure: true
|
|
||||||
exposureDescription: ""
|
|
||||||
variables:
|
|
||||||
tabs-prioritization-enabled:
|
|
||||||
type: boolean
|
|
||||||
description: "If true, enables tabs prioritization feature."
|
|
||||||
homescreen:
|
homescreen:
|
||||||
description: The homescreen that the user goes to when they press home or new tab.
|
description: The homescreen that the user goes to when they press home or new tab.
|
||||||
hasExposure: true
|
hasExposure: true
|
||||||
|
|
|
@ -88,7 +88,6 @@ import org.mozilla.fenix.historymetadata.DefaultHistoryMetadataService
|
||||||
import org.mozilla.fenix.historymetadata.HistoryMetadataMiddleware
|
import org.mozilla.fenix.historymetadata.HistoryMetadataMiddleware
|
||||||
import org.mozilla.fenix.historymetadata.HistoryMetadataService
|
import org.mozilla.fenix.historymetadata.HistoryMetadataService
|
||||||
import org.mozilla.fenix.media.MediaSessionService
|
import org.mozilla.fenix.media.MediaSessionService
|
||||||
import org.mozilla.fenix.nimbus.FxNimbus
|
|
||||||
import org.mozilla.fenix.perf.StrictModeManager
|
import org.mozilla.fenix.perf.StrictModeManager
|
||||||
import org.mozilla.fenix.perf.lazyMonitored
|
import org.mozilla.fenix.perf.lazyMonitored
|
||||||
import org.mozilla.fenix.settings.SupportUtils
|
import org.mozilla.fenix.settings.SupportUtils
|
||||||
|
@ -106,7 +105,7 @@ import java.util.concurrent.TimeUnit
|
||||||
class Core(
|
class Core(
|
||||||
private val context: Context,
|
private val context: Context,
|
||||||
private val crashReporter: CrashReporting,
|
private val crashReporter: CrashReporting,
|
||||||
strictMode: StrictModeManager
|
strictMode: StrictModeManager,
|
||||||
) {
|
) {
|
||||||
/**
|
/**
|
||||||
* The browser engine component initialized based on the build
|
* The browser engine component initialized based on the build
|
||||||
|
@ -129,15 +128,15 @@ class Core(
|
||||||
enterpriseRootsEnabled = context.settings().allowThirdPartyRootCerts,
|
enterpriseRootsEnabled = context.settings().allowThirdPartyRootCerts,
|
||||||
clearColor = ContextCompat.getColor(
|
clearColor = ContextCompat.getColor(
|
||||||
context,
|
context,
|
||||||
R.color.fx_mobile_layer_color_1
|
R.color.fx_mobile_layer_color_1,
|
||||||
),
|
),
|
||||||
httpsOnlyMode = context.settings().getHttpsOnlyMode()
|
httpsOnlyMode = context.settings().getHttpsOnlyMode(),
|
||||||
)
|
)
|
||||||
|
|
||||||
GeckoEngine(
|
GeckoEngine(
|
||||||
context,
|
context,
|
||||||
defaultSettings,
|
defaultSettings,
|
||||||
geckoRuntime
|
geckoRuntime,
|
||||||
).also {
|
).also {
|
||||||
WebCompatFeature.install(it)
|
WebCompatFeature.install(it)
|
||||||
|
|
||||||
|
@ -168,7 +167,7 @@ class Core(
|
||||||
val client: Client by lazyMonitored {
|
val client: Client by lazyMonitored {
|
||||||
GeckoViewFetchClient(
|
GeckoViewFetchClient(
|
||||||
context,
|
context,
|
||||||
geckoRuntime
|
geckoRuntime,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -177,7 +176,7 @@ class Core(
|
||||||
context,
|
context,
|
||||||
lazyAutofillStorage,
|
lazyAutofillStorage,
|
||||||
lazyPasswordsStorage,
|
lazyPasswordsStorage,
|
||||||
trackingProtectionPolicyFactory.createTrackingProtectionPolicy()
|
trackingProtectionPolicyFactory.createTrackingProtectionPolicy(),
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -224,8 +223,6 @@ class Core(
|
||||||
* The [BrowserStore] holds the global [BrowserState].
|
* The [BrowserStore] holds the global [BrowserState].
|
||||||
*/
|
*/
|
||||||
val store by lazyMonitored {
|
val store by lazyMonitored {
|
||||||
val tabsPrioritizationEnable =
|
|
||||||
FxNimbus.features.engineSettings.value().tabsPrioritizationEnabled
|
|
||||||
val middlewareList =
|
val middlewareList =
|
||||||
mutableListOf(
|
mutableListOf(
|
||||||
LastAccessMiddleware(),
|
LastAccessMiddleware(),
|
||||||
|
@ -239,18 +236,15 @@ class Core(
|
||||||
SearchMiddleware(
|
SearchMiddleware(
|
||||||
context,
|
context,
|
||||||
additionalBundledSearchEngineIds = listOf("reddit", "youtube"),
|
additionalBundledSearchEngineIds = listOf("reddit", "youtube"),
|
||||||
migration = SearchMigration(context)
|
migration = SearchMigration(context),
|
||||||
),
|
),
|
||||||
RecordingDevicesMiddleware(context),
|
RecordingDevicesMiddleware(context),
|
||||||
PromptMiddleware(),
|
PromptMiddleware(),
|
||||||
AdsTelemetryMiddleware(adsTelemetry),
|
AdsTelemetryMiddleware(adsTelemetry),
|
||||||
LastMediaAccessMiddleware(),
|
LastMediaAccessMiddleware(),
|
||||||
HistoryMetadataMiddleware(historyMetadataService),
|
HistoryMetadataMiddleware(historyMetadataService),
|
||||||
) + if (tabsPrioritizationEnable) {
|
SessionPrioritizationMiddleware(),
|
||||||
listOf(SessionPrioritizationMiddleware())
|
)
|
||||||
} else {
|
|
||||||
emptyList()
|
|
||||||
}
|
|
||||||
|
|
||||||
BrowserStore(
|
BrowserStore(
|
||||||
initialState = BrowserState(
|
initialState = BrowserState(
|
||||||
|
@ -260,7 +254,7 @@ class Core(
|
||||||
} else {
|
} else {
|
||||||
emptyList()
|
emptyList()
|
||||||
},
|
},
|
||||||
)
|
),
|
||||||
),
|
),
|
||||||
middleware = middlewareList + EngineMiddleware.create(
|
middleware = middlewareList + EngineMiddleware.create(
|
||||||
engine,
|
engine,
|
||||||
|
@ -271,8 +265,8 @@ class Core(
|
||||||
// https://github.com/mozilla-mobile/fenix/issues/12731
|
// https://github.com/mozilla-mobile/fenix/issues/12731
|
||||||
// https://github.com/mozilla-mobile/android-components/issues/11300
|
// https://github.com/mozilla-mobile/android-components/issues/11300
|
||||||
// https://github.com/mozilla-mobile/android-components/issues/11653
|
// https://github.com/mozilla-mobile/android-components/issues/11653
|
||||||
trimMemoryAutomatically = false
|
trimMemoryAutomatically = false,
|
||||||
)
|
),
|
||||||
).apply {
|
).apply {
|
||||||
// Install the "icons" WebExtension to automatically load icons for every visited website.
|
// Install the "icons" WebExtension to automatically load icons for every visited website.
|
||||||
icons.install(engine, this)
|
icons.install(engine, this)
|
||||||
|
@ -284,8 +278,12 @@ class Core(
|
||||||
searchTelemetry.install(engine, this)
|
searchTelemetry.install(engine, this)
|
||||||
|
|
||||||
WebNotificationFeature(
|
WebNotificationFeature(
|
||||||
context, engine, icons, R.drawable.ic_status_logo,
|
context,
|
||||||
permissionStorage.permissionsStorage, IntentReceiverActivity::class.java
|
engine,
|
||||||
|
icons,
|
||||||
|
R.drawable.ic_status_logo,
|
||||||
|
permissionStorage.permissionsStorage,
|
||||||
|
IntentReceiverActivity::class.java,
|
||||||
)
|
)
|
||||||
|
|
||||||
MediaSessionFeature(context, MediaSessionService::class.java, this).start()
|
MediaSessionFeature(context, MediaSessionService::class.java, this).start()
|
||||||
|
@ -337,7 +335,7 @@ class Core(
|
||||||
WebAppShortcutManager(
|
WebAppShortcutManager(
|
||||||
context,
|
context,
|
||||||
client,
|
client,
|
||||||
webAppManifestStorage
|
webAppManifestStorage,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -349,14 +347,16 @@ class Core(
|
||||||
val lazyHistoryStorage = lazyMonitored { PlacesHistoryStorage(context, crashReporter) }
|
val lazyHistoryStorage = lazyMonitored { PlacesHistoryStorage(context, crashReporter) }
|
||||||
val lazyBookmarksStorage = lazyMonitored { PlacesBookmarksStorage(context) }
|
val lazyBookmarksStorage = lazyMonitored { PlacesBookmarksStorage(context) }
|
||||||
val lazyPasswordsStorage = lazyMonitored { SyncableLoginsStorage(context, lazySecurePrefs) }
|
val lazyPasswordsStorage = lazyMonitored { SyncableLoginsStorage(context, lazySecurePrefs) }
|
||||||
val lazyAutofillStorage = lazyMonitored { AutofillCreditCardsAddressesStorage(context, lazySecurePrefs) }
|
val lazyAutofillStorage =
|
||||||
|
lazyMonitored { AutofillCreditCardsAddressesStorage(context, lazySecurePrefs) }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The storage component to sync and persist tabs in a Firefox Sync account.
|
* The storage component to sync and persist tabs in a Firefox Sync account.
|
||||||
*/
|
*/
|
||||||
val lazyRemoteTabsStorage = lazyMonitored { RemoteTabsStorage(context) }
|
val lazyRemoteTabsStorage = lazyMonitored { RemoteTabsStorage(context) }
|
||||||
|
|
||||||
val recentlyClosedTabsStorage = lazyMonitored { RecentlyClosedTabsStorage(context, engine, crashReporter) }
|
val recentlyClosedTabsStorage =
|
||||||
|
lazyMonitored { RecentlyClosedTabsStorage(context, engine, crashReporter) }
|
||||||
|
|
||||||
// For most other application code (non-startup), these wrappers are perfectly fine and more ergonomic.
|
// For most other application code (non-startup), these wrappers are perfectly fine and more ergonomic.
|
||||||
val historyStorage: PlacesHistoryStorage get() = lazyHistoryStorage.value
|
val historyStorage: PlacesHistoryStorage get() = lazyHistoryStorage.value
|
||||||
|
@ -367,7 +367,7 @@ class Core(
|
||||||
val tabCollectionStorage by lazyMonitored {
|
val tabCollectionStorage by lazyMonitored {
|
||||||
TabCollectionStorage(
|
TabCollectionStorage(
|
||||||
context,
|
context,
|
||||||
strictMode
|
strictMode,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -385,8 +385,8 @@ class Core(
|
||||||
Frequency(4, TimeUnit.HOURS),
|
Frequency(4, TimeUnit.HOURS),
|
||||||
Profile(
|
Profile(
|
||||||
profileId = UUID.fromString(context.settings().pocketSponsoredStoriesProfileId),
|
profileId = UUID.fromString(context.settings().pocketSponsoredStoriesProfileId),
|
||||||
appId = BuildConfig.POCKET_CONSUMER_KEY
|
appId = BuildConfig.POCKET_CONSUMER_KEY,
|
||||||
)
|
),
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
val pocketStoriesService by lazyMonitored { PocketStoriesService(context, pocketStoriesConfig) }
|
val pocketStoriesService by lazyMonitored { PocketStoriesService(context, pocketStoriesConfig) }
|
||||||
|
@ -395,7 +395,7 @@ class Core(
|
||||||
ContileTopSitesProvider(
|
ContileTopSitesProvider(
|
||||||
context = context,
|
context = context,
|
||||||
client = client,
|
client = client,
|
||||||
maxCacheAgeInMinutes = CONTILE_MAX_CACHE_AGE
|
maxCacheAgeInMinutes = CONTILE_MAX_CACHE_AGE,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -404,7 +404,7 @@ class Core(
|
||||||
ContileTopSitesUpdater(
|
ContileTopSitesUpdater(
|
||||||
context = context,
|
context = context,
|
||||||
provider = contileTopSitesProvider,
|
provider = contileTopSitesProvider,
|
||||||
frequency = Frequency(3, TimeUnit.HOURS)
|
frequency = Frequency(3, TimeUnit.HOURS),
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -417,59 +417,59 @@ class Core(
|
||||||
defaultTopSites.add(
|
defaultTopSites.add(
|
||||||
Pair(
|
Pair(
|
||||||
context.getString(R.string.default_top_site_baidu),
|
context.getString(R.string.default_top_site_baidu),
|
||||||
SupportUtils.BAIDU_URL
|
SupportUtils.BAIDU_URL,
|
||||||
)
|
),
|
||||||
)
|
)
|
||||||
|
|
||||||
defaultTopSites.add(
|
defaultTopSites.add(
|
||||||
Pair(
|
Pair(
|
||||||
context.getString(R.string.default_top_site_jd),
|
context.getString(R.string.default_top_site_jd),
|
||||||
SupportUtils.JD_URL
|
SupportUtils.JD_URL,
|
||||||
)
|
),
|
||||||
)
|
)
|
||||||
|
|
||||||
defaultTopSites.add(
|
defaultTopSites.add(
|
||||||
Pair(
|
Pair(
|
||||||
context.getString(R.string.default_top_site_pdd),
|
context.getString(R.string.default_top_site_pdd),
|
||||||
SupportUtils.PDD_URL
|
SupportUtils.PDD_URL,
|
||||||
)
|
),
|
||||||
)
|
)
|
||||||
|
|
||||||
defaultTopSites.add(
|
defaultTopSites.add(
|
||||||
Pair(
|
Pair(
|
||||||
context.getString(R.string.default_top_site_tc),
|
context.getString(R.string.default_top_site_tc),
|
||||||
SupportUtils.TC_URL
|
SupportUtils.TC_URL,
|
||||||
)
|
),
|
||||||
)
|
)
|
||||||
|
|
||||||
defaultTopSites.add(
|
defaultTopSites.add(
|
||||||
Pair(
|
Pair(
|
||||||
context.getString(R.string.default_top_site_meituan),
|
context.getString(R.string.default_top_site_meituan),
|
||||||
SupportUtils.MEITUAN_URL
|
SupportUtils.MEITUAN_URL,
|
||||||
)
|
),
|
||||||
)
|
)
|
||||||
} else {
|
} else {
|
||||||
defaultTopSites.add(
|
defaultTopSites.add(
|
||||||
Pair(
|
Pair(
|
||||||
context.getString(R.string.default_top_site_google),
|
context.getString(R.string.default_top_site_google),
|
||||||
SupportUtils.GOOGLE_URL
|
SupportUtils.GOOGLE_URL,
|
||||||
)
|
),
|
||||||
)
|
)
|
||||||
|
|
||||||
if (LocaleManager.getSelectedLocale(context).language == "en") {
|
if (LocaleManager.getSelectedLocale(context).language == "en") {
|
||||||
defaultTopSites.add(
|
defaultTopSites.add(
|
||||||
Pair(
|
Pair(
|
||||||
context.getString(R.string.pocket_pinned_top_articles),
|
context.getString(R.string.pocket_pinned_top_articles),
|
||||||
SupportUtils.POCKET_TRENDING_URL
|
SupportUtils.POCKET_TRENDING_URL,
|
||||||
)
|
),
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
defaultTopSites.add(
|
defaultTopSites.add(
|
||||||
Pair(
|
Pair(
|
||||||
context.getString(R.string.default_top_site_wikipedia),
|
context.getString(R.string.default_top_site_wikipedia),
|
||||||
SupportUtils.WIKIPEDIA_URL
|
SupportUtils.WIKIPEDIA_URL,
|
||||||
)
|
),
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -481,7 +481,7 @@ class Core(
|
||||||
pinnedSitesStorage = pinnedSiteStorage,
|
pinnedSitesStorage = pinnedSiteStorage,
|
||||||
historyStorage = historyStorage,
|
historyStorage = historyStorage,
|
||||||
topSitesProvider = contileTopSitesProvider,
|
topSitesProvider = contileTopSitesProvider,
|
||||||
defaultTopSites = defaultTopSites
|
defaultTopSites = defaultTopSites,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -501,7 +501,7 @@ class Core(
|
||||||
SecureAbove22Preferences(
|
SecureAbove22Preferences(
|
||||||
context = context,
|
context = context,
|
||||||
name = KEY_STORAGE_NAME,
|
name = KEY_STORAGE_NAME,
|
||||||
forceInsecure = !Config.channel.isNightlyOrDebug
|
forceInsecure = !Config.channel.isNightlyOrDebug,
|
||||||
)
|
)
|
||||||
|
|
||||||
// Temporary. See https://github.com/mozilla-mobile/fenix/issues/19155
|
// Temporary. See https://github.com/mozilla-mobile/fenix/issues/19155
|
||||||
|
@ -535,6 +535,7 @@ class Core(
|
||||||
|
|
||||||
// Maximum number of suggestions returned from the history search engine source.
|
// Maximum number of suggestions returned from the history search engine source.
|
||||||
const val METADATA_HISTORY_SUGGESTION_LIMIT = 100
|
const val METADATA_HISTORY_SUGGESTION_LIMIT = 100
|
||||||
|
|
||||||
// Maximum number of suggestions returned from shortcut search engine.
|
// Maximum number of suggestions returned from shortcut search engine.
|
||||||
const val METADATA_SHORTCUT_SUGGESTION_LIMIT = 20
|
const val METADATA_SHORTCUT_SUGGESTION_LIMIT = 20
|
||||||
}
|
}
|
||||||
|
|
|
@ -15,7 +15,7 @@ import org.mozilla.fenix.utils.Settings
|
||||||
*/
|
*/
|
||||||
class TrackingProtectionPolicyFactory(
|
class TrackingProtectionPolicyFactory(
|
||||||
private val settings: Settings,
|
private val settings: Settings,
|
||||||
private val resources: Resources
|
private val resources: Resources,
|
||||||
) {
|
) {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -30,7 +30,7 @@ class TrackingProtectionPolicyFactory(
|
||||||
@Suppress("ComplexMethod")
|
@Suppress("ComplexMethod")
|
||||||
fun createTrackingProtectionPolicy(
|
fun createTrackingProtectionPolicy(
|
||||||
normalMode: Boolean = settings.shouldUseTrackingProtection,
|
normalMode: Boolean = settings.shouldUseTrackingProtection,
|
||||||
privateMode: Boolean = settings.shouldUseTrackingProtection
|
privateMode: Boolean = settings.shouldUseTrackingProtection,
|
||||||
): TrackingProtectionPolicy {
|
): TrackingProtectionPolicy {
|
||||||
val trackingProtectionPolicy =
|
val trackingProtectionPolicy =
|
||||||
when {
|
when {
|
||||||
|
@ -51,7 +51,7 @@ class TrackingProtectionPolicyFactory(
|
||||||
return TrackingProtectionPolicy.select(
|
return TrackingProtectionPolicy.select(
|
||||||
cookiePolicy = getCustomCookiePolicy(),
|
cookiePolicy = getCustomCookiePolicy(),
|
||||||
trackingCategories = getCustomTrackingCategories(),
|
trackingCategories = getCustomTrackingCategories(),
|
||||||
cookiePurging = getCustomCookiePurgingPolicy()
|
cookiePurging = getCustomCookiePurgingPolicy(),
|
||||||
).let {
|
).let {
|
||||||
if (settings.blockTrackingContentSelectionInCustomTrackingProtection == "private") {
|
if (settings.blockTrackingContentSelectionInCustomTrackingProtection == "private") {
|
||||||
it.forPrivateSessionsOnly()
|
it.forPrivateSessionsOnly()
|
||||||
|
@ -81,7 +81,7 @@ class TrackingProtectionPolicyFactory(
|
||||||
TrackingProtectionPolicy.TrackingCategory.AD,
|
TrackingProtectionPolicy.TrackingCategory.AD,
|
||||||
TrackingProtectionPolicy.TrackingCategory.ANALYTICS,
|
TrackingProtectionPolicy.TrackingCategory.ANALYTICS,
|
||||||
TrackingProtectionPolicy.TrackingCategory.SOCIAL,
|
TrackingProtectionPolicy.TrackingCategory.SOCIAL,
|
||||||
TrackingProtectionPolicy.TrackingCategory.MOZILLA_SOCIAL
|
TrackingProtectionPolicy.TrackingCategory.MOZILLA_SOCIAL,
|
||||||
)
|
)
|
||||||
|
|
||||||
if (settings.blockTrackingContentInCustomTrackingProtection) {
|
if (settings.blockTrackingContentInCustomTrackingProtection) {
|
||||||
|
|
|
@ -88,6 +88,7 @@ class Settings(private val appContext: Context) : PreferencesHolder {
|
||||||
|
|
||||||
// The maximum number of top sites to display.
|
// The maximum number of top sites to display.
|
||||||
const val TOP_SITES_MAX_COUNT = 16
|
const val TOP_SITES_MAX_COUNT = 16
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Only fetch top sites from the [ContileTopSitesProvider] when the number of default and
|
* Only fetch top sites from the [ContileTopSitesProvider] when the number of default and
|
||||||
* pinned sites are below this maximum threshold.
|
* pinned sites are below this maximum threshold.
|
||||||
|
@ -139,17 +140,17 @@ class Settings(private val appContext: Context) : PreferencesHolder {
|
||||||
|
|
||||||
var numberOfAppLaunches by intPreference(
|
var numberOfAppLaunches by intPreference(
|
||||||
appContext.getPreferenceKey(R.string.pref_key_times_app_opened),
|
appContext.getPreferenceKey(R.string.pref_key_times_app_opened),
|
||||||
default = 0
|
default = 0,
|
||||||
)
|
)
|
||||||
|
|
||||||
var lastReviewPromptTimeInMillis by longPreference(
|
var lastReviewPromptTimeInMillis by longPreference(
|
||||||
appContext.getPreferenceKey(R.string.pref_key_last_review_prompt_shown_time),
|
appContext.getPreferenceKey(R.string.pref_key_last_review_prompt_shown_time),
|
||||||
default = 0L
|
default = 0L,
|
||||||
)
|
)
|
||||||
|
|
||||||
var lastCfrShownTimeInMillis by longPreference(
|
var lastCfrShownTimeInMillis by longPreference(
|
||||||
appContext.getPreferenceKey(R.string.pref_key_last_cfr_shown_time),
|
appContext.getPreferenceKey(R.string.pref_key_last_cfr_shown_time),
|
||||||
default = 0L
|
default = 0L,
|
||||||
)
|
)
|
||||||
|
|
||||||
val canShowCfr: Boolean
|
val canShowCfr: Boolean
|
||||||
|
@ -157,37 +158,37 @@ class Settings(private val appContext: Context) : PreferencesHolder {
|
||||||
|
|
||||||
var forceEnableZoom by booleanPreference(
|
var forceEnableZoom by booleanPreference(
|
||||||
appContext.getPreferenceKey(R.string.pref_key_accessibility_force_enable_zoom),
|
appContext.getPreferenceKey(R.string.pref_key_accessibility_force_enable_zoom),
|
||||||
default = false
|
default = false,
|
||||||
)
|
)
|
||||||
|
|
||||||
var adjustCampaignId by stringPreference(
|
var adjustCampaignId by stringPreference(
|
||||||
appContext.getPreferenceKey(R.string.pref_key_adjust_campaign),
|
appContext.getPreferenceKey(R.string.pref_key_adjust_campaign),
|
||||||
default = ""
|
default = "",
|
||||||
)
|
)
|
||||||
|
|
||||||
var adjustNetwork by stringPreference(
|
var adjustNetwork by stringPreference(
|
||||||
appContext.getPreferenceKey(R.string.pref_key_adjust_network),
|
appContext.getPreferenceKey(R.string.pref_key_adjust_network),
|
||||||
default = ""
|
default = "",
|
||||||
)
|
)
|
||||||
|
|
||||||
var adjustAdGroup by stringPreference(
|
var adjustAdGroup by stringPreference(
|
||||||
appContext.getPreferenceKey(R.string.pref_key_adjust_adgroup),
|
appContext.getPreferenceKey(R.string.pref_key_adjust_adgroup),
|
||||||
default = ""
|
default = "",
|
||||||
)
|
)
|
||||||
|
|
||||||
var adjustCreative by stringPreference(
|
var adjustCreative by stringPreference(
|
||||||
appContext.getPreferenceKey(R.string.pref_key_adjust_creative),
|
appContext.getPreferenceKey(R.string.pref_key_adjust_creative),
|
||||||
default = ""
|
default = "",
|
||||||
)
|
)
|
||||||
|
|
||||||
var contileContextId by stringPreference(
|
var contileContextId by stringPreference(
|
||||||
appContext.getPreferenceKey(R.string.pref_key_contile_context_id),
|
appContext.getPreferenceKey(R.string.pref_key_contile_context_id),
|
||||||
default = ""
|
default = "",
|
||||||
)
|
)
|
||||||
|
|
||||||
var currentWallpaperName by stringPreference(
|
var currentWallpaperName by stringPreference(
|
||||||
appContext.getPreferenceKey(R.string.pref_key_current_wallpaper),
|
appContext.getPreferenceKey(R.string.pref_key_current_wallpaper),
|
||||||
default = Wallpaper.Default.name
|
default = Wallpaper.Default.name,
|
||||||
)
|
)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -195,7 +196,7 @@ class Settings(private val appContext: Context) : PreferencesHolder {
|
||||||
*/
|
*/
|
||||||
var currentWallpaperTextColor by longPreference(
|
var currentWallpaperTextColor by longPreference(
|
||||||
appContext.getPreferenceKey(R.string.pref_key_current_wallpaper_text_color),
|
appContext.getPreferenceKey(R.string.pref_key_current_wallpaper_text_color),
|
||||||
default = 0
|
default = 0,
|
||||||
)
|
)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -203,7 +204,7 @@ class Settings(private val appContext: Context) : PreferencesHolder {
|
||||||
*/
|
*/
|
||||||
var currentWallpaperCardColor by longPreference(
|
var currentWallpaperCardColor by longPreference(
|
||||||
appContext.getPreferenceKey(R.string.pref_key_current_wallpaper_card_color),
|
appContext.getPreferenceKey(R.string.pref_key_current_wallpaper_card_color),
|
||||||
default = 0
|
default = 0,
|
||||||
)
|
)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -217,64 +218,64 @@ class Settings(private val appContext: Context) : PreferencesHolder {
|
||||||
|
|
||||||
var openLinksInAPrivateTab by booleanPreference(
|
var openLinksInAPrivateTab by booleanPreference(
|
||||||
appContext.getPreferenceKey(R.string.pref_key_open_links_in_a_private_tab),
|
appContext.getPreferenceKey(R.string.pref_key_open_links_in_a_private_tab),
|
||||||
default = false
|
default = false,
|
||||||
)
|
)
|
||||||
|
|
||||||
var allowScreenshotsInPrivateMode by booleanPreference(
|
var allowScreenshotsInPrivateMode by booleanPreference(
|
||||||
appContext.getPreferenceKey(R.string.pref_key_allow_screenshots_in_private_mode),
|
appContext.getPreferenceKey(R.string.pref_key_allow_screenshots_in_private_mode),
|
||||||
default = false
|
default = false,
|
||||||
)
|
)
|
||||||
|
|
||||||
var shouldReturnToBrowser by booleanPreference(
|
var shouldReturnToBrowser by booleanPreference(
|
||||||
appContext.getString(R.string.pref_key_return_to_browser),
|
appContext.getString(R.string.pref_key_return_to_browser),
|
||||||
false
|
false,
|
||||||
)
|
)
|
||||||
|
|
||||||
var defaultSearchEngineName by stringPreference(
|
var defaultSearchEngineName by stringPreference(
|
||||||
appContext.getPreferenceKey(R.string.pref_key_search_engine),
|
appContext.getPreferenceKey(R.string.pref_key_search_engine),
|
||||||
default = ""
|
default = "",
|
||||||
)
|
)
|
||||||
|
|
||||||
var openInAppOpened by booleanPreference(
|
var openInAppOpened by booleanPreference(
|
||||||
appContext.getPreferenceKey(R.string.pref_key_open_in_app_opened),
|
appContext.getPreferenceKey(R.string.pref_key_open_in_app_opened),
|
||||||
default = false
|
default = false,
|
||||||
)
|
)
|
||||||
|
|
||||||
var installPwaOpened by booleanPreference(
|
var installPwaOpened by booleanPreference(
|
||||||
appContext.getPreferenceKey(R.string.pref_key_install_pwa_opened),
|
appContext.getPreferenceKey(R.string.pref_key_install_pwa_opened),
|
||||||
default = false
|
default = false,
|
||||||
)
|
)
|
||||||
|
|
||||||
var showCollectionsPlaceholderOnHome by booleanPreference(
|
var showCollectionsPlaceholderOnHome by booleanPreference(
|
||||||
appContext.getPreferenceKey(R.string.pref_key_show_collections_placeholder_home),
|
appContext.getPreferenceKey(R.string.pref_key_show_collections_placeholder_home),
|
||||||
default = true
|
default = true,
|
||||||
)
|
)
|
||||||
|
|
||||||
val isCrashReportingEnabled: Boolean
|
val isCrashReportingEnabled: Boolean
|
||||||
get() = isCrashReportEnabledInBuild &&
|
get() = isCrashReportEnabledInBuild &&
|
||||||
preferences.getBoolean(
|
preferences.getBoolean(
|
||||||
appContext.getPreferenceKey(R.string.pref_key_crash_reporter),
|
appContext.getPreferenceKey(R.string.pref_key_crash_reporter),
|
||||||
true
|
true,
|
||||||
)
|
)
|
||||||
|
|
||||||
val isRemoteDebuggingEnabled by booleanPreference(
|
val isRemoteDebuggingEnabled by booleanPreference(
|
||||||
appContext.getPreferenceKey(R.string.pref_key_remote_debugging),
|
appContext.getPreferenceKey(R.string.pref_key_remote_debugging),
|
||||||
default = false
|
default = false,
|
||||||
)
|
)
|
||||||
|
|
||||||
val isTelemetryEnabled by booleanPreference(
|
val isTelemetryEnabled by booleanPreference(
|
||||||
appContext.getPreferenceKey(R.string.pref_key_telemetry),
|
appContext.getPreferenceKey(R.string.pref_key_telemetry),
|
||||||
default = true
|
default = true,
|
||||||
)
|
)
|
||||||
|
|
||||||
var isMarketingTelemetryEnabled by booleanPreference(
|
var isMarketingTelemetryEnabled by booleanPreference(
|
||||||
appContext.getPreferenceKey(R.string.pref_key_marketing_telemetry),
|
appContext.getPreferenceKey(R.string.pref_key_marketing_telemetry),
|
||||||
default = !Config.channel.isMozillaOnline
|
default = !Config.channel.isMozillaOnline,
|
||||||
)
|
)
|
||||||
|
|
||||||
var isExperimentationEnabled by booleanPreference(
|
var isExperimentationEnabled by booleanPreference(
|
||||||
appContext.getPreferenceKey(R.string.pref_key_experimentation),
|
appContext.getPreferenceKey(R.string.pref_key_experimentation),
|
||||||
default = true
|
default = true,
|
||||||
)
|
)
|
||||||
|
|
||||||
var isOverrideTPPopupsForPerformanceTest = false
|
var isOverrideTPPopupsForPerformanceTest = false
|
||||||
|
@ -289,87 +290,87 @@ class Settings(private val appContext: Context) : PreferencesHolder {
|
||||||
|
|
||||||
var shouldShowPrivacyPopWindow by booleanPreference(
|
var shouldShowPrivacyPopWindow by booleanPreference(
|
||||||
appContext.getPreferenceKey(R.string.pref_key_privacy_pop_window),
|
appContext.getPreferenceKey(R.string.pref_key_privacy_pop_window),
|
||||||
default = true
|
default = true,
|
||||||
)
|
)
|
||||||
|
|
||||||
var shouldUseLightTheme by booleanPreference(
|
var shouldUseLightTheme by booleanPreference(
|
||||||
appContext.getPreferenceKey(R.string.pref_key_light_theme),
|
appContext.getPreferenceKey(R.string.pref_key_light_theme),
|
||||||
default = false
|
default = false,
|
||||||
)
|
)
|
||||||
|
|
||||||
var shouldUseAutoSize by booleanPreference(
|
var shouldUseAutoSize by booleanPreference(
|
||||||
appContext.getPreferenceKey(R.string.pref_key_accessibility_auto_size),
|
appContext.getPreferenceKey(R.string.pref_key_accessibility_auto_size),
|
||||||
default = true
|
default = true,
|
||||||
)
|
)
|
||||||
|
|
||||||
var fontSizeFactor by floatPreference(
|
var fontSizeFactor by floatPreference(
|
||||||
appContext.getPreferenceKey(R.string.pref_key_accessibility_font_scale),
|
appContext.getPreferenceKey(R.string.pref_key_accessibility_font_scale),
|
||||||
default = 1f
|
default = 1f,
|
||||||
)
|
)
|
||||||
|
|
||||||
val shouldShowHistorySuggestions by booleanPreference(
|
val shouldShowHistorySuggestions by booleanPreference(
|
||||||
appContext.getPreferenceKey(R.string.pref_key_search_browsing_history),
|
appContext.getPreferenceKey(R.string.pref_key_search_browsing_history),
|
||||||
default = true
|
default = true,
|
||||||
)
|
)
|
||||||
|
|
||||||
val shouldShowBookmarkSuggestions by booleanPreference(
|
val shouldShowBookmarkSuggestions by booleanPreference(
|
||||||
appContext.getPreferenceKey(R.string.pref_key_search_bookmarks),
|
appContext.getPreferenceKey(R.string.pref_key_search_bookmarks),
|
||||||
default = true
|
default = true,
|
||||||
)
|
)
|
||||||
|
|
||||||
val shouldShowSyncedTabsSuggestions by booleanPreference(
|
val shouldShowSyncedTabsSuggestions by booleanPreference(
|
||||||
appContext.getPreferenceKey(R.string.pref_key_search_synced_tabs),
|
appContext.getPreferenceKey(R.string.pref_key_search_synced_tabs),
|
||||||
default = true
|
default = true,
|
||||||
)
|
)
|
||||||
|
|
||||||
val shouldShowClipboardSuggestions by booleanPreference(
|
val shouldShowClipboardSuggestions by booleanPreference(
|
||||||
appContext.getPreferenceKey(R.string.pref_key_show_clipboard_suggestions),
|
appContext.getPreferenceKey(R.string.pref_key_show_clipboard_suggestions),
|
||||||
default = true
|
default = true,
|
||||||
)
|
)
|
||||||
|
|
||||||
val shouldShowSearchShortcuts by booleanPreference(
|
val shouldShowSearchShortcuts by booleanPreference(
|
||||||
appContext.getPreferenceKey(R.string.pref_key_show_search_engine_shortcuts),
|
appContext.getPreferenceKey(R.string.pref_key_show_search_engine_shortcuts),
|
||||||
default = false
|
default = false,
|
||||||
)
|
)
|
||||||
|
|
||||||
var gridTabView by booleanPreference(
|
var gridTabView by booleanPreference(
|
||||||
appContext.getPreferenceKey(R.string.pref_key_tab_view_grid),
|
appContext.getPreferenceKey(R.string.pref_key_tab_view_grid),
|
||||||
default = true
|
default = true,
|
||||||
)
|
)
|
||||||
|
|
||||||
var manuallyCloseTabs by booleanPreference(
|
var manuallyCloseTabs by booleanPreference(
|
||||||
appContext.getPreferenceKey(R.string.pref_key_close_tabs_manually),
|
appContext.getPreferenceKey(R.string.pref_key_close_tabs_manually),
|
||||||
default = true
|
default = true,
|
||||||
)
|
)
|
||||||
|
|
||||||
var closeTabsAfterOneDay by booleanPreference(
|
var closeTabsAfterOneDay by booleanPreference(
|
||||||
appContext.getPreferenceKey(R.string.pref_key_close_tabs_after_one_day),
|
appContext.getPreferenceKey(R.string.pref_key_close_tabs_after_one_day),
|
||||||
default = false
|
default = false,
|
||||||
)
|
)
|
||||||
|
|
||||||
var closeTabsAfterOneWeek by booleanPreference(
|
var closeTabsAfterOneWeek by booleanPreference(
|
||||||
appContext.getPreferenceKey(R.string.pref_key_close_tabs_after_one_week),
|
appContext.getPreferenceKey(R.string.pref_key_close_tabs_after_one_week),
|
||||||
default = false
|
default = false,
|
||||||
)
|
)
|
||||||
|
|
||||||
var closeTabsAfterOneMonth by booleanPreference(
|
var closeTabsAfterOneMonth by booleanPreference(
|
||||||
appContext.getPreferenceKey(R.string.pref_key_close_tabs_after_one_month),
|
appContext.getPreferenceKey(R.string.pref_key_close_tabs_after_one_month),
|
||||||
default = false
|
default = false,
|
||||||
)
|
)
|
||||||
|
|
||||||
var allowThirdPartyRootCerts by booleanPreference(
|
var allowThirdPartyRootCerts by booleanPreference(
|
||||||
appContext.getPreferenceKey(R.string.pref_key_allow_third_party_root_certs),
|
appContext.getPreferenceKey(R.string.pref_key_allow_third_party_root_certs),
|
||||||
default = false
|
default = false,
|
||||||
)
|
)
|
||||||
|
|
||||||
var nimbusUsePreview by booleanPreference(
|
var nimbusUsePreview by booleanPreference(
|
||||||
appContext.getPreferenceKey(R.string.pref_key_nimbus_use_preview),
|
appContext.getPreferenceKey(R.string.pref_key_nimbus_use_preview),
|
||||||
default = false
|
default = false,
|
||||||
)
|
)
|
||||||
|
|
||||||
var isFirstNimbusRun: Boolean by booleanPreference(
|
var isFirstNimbusRun: Boolean by booleanPreference(
|
||||||
appContext.getPreferenceKey(R.string.pref_key_is_first_run),
|
appContext.getPreferenceKey(R.string.pref_key_is_first_run),
|
||||||
default = true
|
default = true,
|
||||||
)
|
)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -379,7 +380,7 @@ class Settings(private val appContext: Context) : PreferencesHolder {
|
||||||
*/
|
*/
|
||||||
var lastBrowseActivity by longPreference(
|
var lastBrowseActivity by longPreference(
|
||||||
appContext.getPreferenceKey(R.string.pref_key_last_browse_activity_time),
|
appContext.getPreferenceKey(R.string.pref_key_last_browse_activity_time),
|
||||||
default = timeNowInMillis()
|
default = timeNowInMillis(),
|
||||||
)
|
)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -388,7 +389,7 @@ class Settings(private val appContext: Context) : PreferencesHolder {
|
||||||
*/
|
*/
|
||||||
var openHomepageAfterFourHoursOfInactivity by booleanPreference(
|
var openHomepageAfterFourHoursOfInactivity by booleanPreference(
|
||||||
appContext.getPreferenceKey(R.string.pref_key_start_on_home_after_four_hours),
|
appContext.getPreferenceKey(R.string.pref_key_start_on_home_after_four_hours),
|
||||||
default = true
|
default = true,
|
||||||
)
|
)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -396,7 +397,7 @@ class Settings(private val appContext: Context) : PreferencesHolder {
|
||||||
*/
|
*/
|
||||||
var alwaysOpenTheHomepageWhenOpeningTheApp by booleanPreference(
|
var alwaysOpenTheHomepageWhenOpeningTheApp by booleanPreference(
|
||||||
appContext.getPreferenceKey(R.string.pref_key_start_on_home_always),
|
appContext.getPreferenceKey(R.string.pref_key_start_on_home_always),
|
||||||
default = false
|
default = false,
|
||||||
)
|
)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -405,7 +406,7 @@ class Settings(private val appContext: Context) : PreferencesHolder {
|
||||||
*/
|
*/
|
||||||
var alwaysOpenTheLastTabWhenOpeningTheApp by booleanPreference(
|
var alwaysOpenTheLastTabWhenOpeningTheApp by booleanPreference(
|
||||||
appContext.getPreferenceKey(R.string.pref_key_start_on_home_never),
|
appContext.getPreferenceKey(R.string.pref_key_start_on_home_never),
|
||||||
default = false
|
default = false,
|
||||||
)
|
)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -426,7 +427,7 @@ class Settings(private val appContext: Context) : PreferencesHolder {
|
||||||
var inactiveTabsAreEnabled by featureFlagPreference(
|
var inactiveTabsAreEnabled by featureFlagPreference(
|
||||||
appContext.getPreferenceKey(R.string.pref_key_inactive_tabs),
|
appContext.getPreferenceKey(R.string.pref_key_inactive_tabs),
|
||||||
default = FeatureFlags.inactiveTabs,
|
default = FeatureFlags.inactiveTabs,
|
||||||
featureFlag = FeatureFlags.inactiveTabs
|
featureFlag = FeatureFlags.inactiveTabs,
|
||||||
)
|
)
|
||||||
|
|
||||||
@VisibleForTesting
|
@VisibleForTesting
|
||||||
|
@ -481,32 +482,32 @@ class Settings(private val appContext: Context) : PreferencesHolder {
|
||||||
|
|
||||||
var shouldUseDarkTheme by booleanPreference(
|
var shouldUseDarkTheme by booleanPreference(
|
||||||
appContext.getPreferenceKey(R.string.pref_key_dark_theme),
|
appContext.getPreferenceKey(R.string.pref_key_dark_theme),
|
||||||
default = false
|
default = false,
|
||||||
)
|
)
|
||||||
|
|
||||||
var shouldFollowDeviceTheme by booleanPreference(
|
var shouldFollowDeviceTheme by booleanPreference(
|
||||||
appContext.getPreferenceKey(R.string.pref_key_follow_device_theme),
|
appContext.getPreferenceKey(R.string.pref_key_follow_device_theme),
|
||||||
default = false
|
default = false,
|
||||||
)
|
)
|
||||||
|
|
||||||
var shouldUseHttpsOnly by booleanPreference(
|
var shouldUseHttpsOnly by booleanPreference(
|
||||||
appContext.getPreferenceKey(R.string.pref_key_https_only),
|
appContext.getPreferenceKey(R.string.pref_key_https_only),
|
||||||
default = false
|
default = false,
|
||||||
)
|
)
|
||||||
|
|
||||||
var shouldUseHttpsOnlyInAllTabs by booleanPreference(
|
var shouldUseHttpsOnlyInAllTabs by booleanPreference(
|
||||||
appContext.getPreferenceKey(R.string.pref_key_https_only_in_all_tabs),
|
appContext.getPreferenceKey(R.string.pref_key_https_only_in_all_tabs),
|
||||||
default = true
|
default = true,
|
||||||
)
|
)
|
||||||
|
|
||||||
var shouldUseHttpsOnlyInPrivateTabsOnly by booleanPreference(
|
var shouldUseHttpsOnlyInPrivateTabsOnly by booleanPreference(
|
||||||
appContext.getPreferenceKey(R.string.pref_key_https_only_in_private_tabs),
|
appContext.getPreferenceKey(R.string.pref_key_https_only_in_private_tabs),
|
||||||
default = false
|
default = false,
|
||||||
)
|
)
|
||||||
|
|
||||||
var shouldUseTrackingProtection by booleanPreference(
|
var shouldUseTrackingProtection by booleanPreference(
|
||||||
appContext.getPreferenceKey(R.string.pref_key_tracking_protection),
|
appContext.getPreferenceKey(R.string.pref_key_tracking_protection),
|
||||||
default = true
|
default = true,
|
||||||
)
|
)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -518,7 +519,8 @@ class Settings(private val appContext: Context) : PreferencesHolder {
|
||||||
fun checkIfFenixIsDefaultBrowserOnAppResume(): Boolean {
|
fun checkIfFenixIsDefaultBrowserOnAppResume(): Boolean {
|
||||||
val prefKey = appContext.getPreferenceKey(R.string.pref_key_default_browser)
|
val prefKey = appContext.getPreferenceKey(R.string.pref_key_default_browser)
|
||||||
val isDefaultBrowserNow = isDefaultBrowserBlocking()
|
val isDefaultBrowserNow = isDefaultBrowserBlocking()
|
||||||
val wasDefaultBrowserOnLastResume = this.preferences.getBoolean(prefKey, isDefaultBrowserNow)
|
val wasDefaultBrowserOnLastResume =
|
||||||
|
this.preferences.getBoolean(prefKey, isDefaultBrowserNow)
|
||||||
this.preferences.edit().putBoolean(prefKey, isDefaultBrowserNow).apply()
|
this.preferences.edit().putBoolean(prefKey, isDefaultBrowserNow).apply()
|
||||||
return isDefaultBrowserNow && !wasDefaultBrowserOnLastResume
|
return isDefaultBrowserNow && !wasDefaultBrowserOnLastResume
|
||||||
}
|
}
|
||||||
|
@ -534,7 +536,7 @@ class Settings(private val appContext: Context) : PreferencesHolder {
|
||||||
|
|
||||||
var defaultBrowserNotificationDisplayed by booleanPreference(
|
var defaultBrowserNotificationDisplayed by booleanPreference(
|
||||||
appContext.getPreferenceKey(R.string.pref_key_should_show_default_browser_notification),
|
appContext.getPreferenceKey(R.string.pref_key_should_show_default_browser_notification),
|
||||||
default = false
|
default = false,
|
||||||
)
|
)
|
||||||
|
|
||||||
fun shouldShowDefaultBrowserNotification(): Boolean {
|
fun shouldShowDefaultBrowserNotification(): Boolean {
|
||||||
|
@ -543,33 +545,33 @@ class Settings(private val appContext: Context) : PreferencesHolder {
|
||||||
|
|
||||||
val shouldUseAutoBatteryTheme by booleanPreference(
|
val shouldUseAutoBatteryTheme by booleanPreference(
|
||||||
appContext.getPreferenceKey(R.string.pref_key_auto_battery_theme),
|
appContext.getPreferenceKey(R.string.pref_key_auto_battery_theme),
|
||||||
default = false
|
default = false,
|
||||||
)
|
)
|
||||||
|
|
||||||
val useStandardTrackingProtection by booleanPreference(
|
val useStandardTrackingProtection by booleanPreference(
|
||||||
appContext.getPreferenceKey(R.string.pref_key_tracking_protection_standard_option),
|
appContext.getPreferenceKey(R.string.pref_key_tracking_protection_standard_option),
|
||||||
true
|
true,
|
||||||
)
|
)
|
||||||
|
|
||||||
val useStrictTrackingProtection by booleanPreference(
|
val useStrictTrackingProtection by booleanPreference(
|
||||||
appContext.getPreferenceKey(R.string.pref_key_tracking_protection_strict_default),
|
appContext.getPreferenceKey(R.string.pref_key_tracking_protection_strict_default),
|
||||||
false
|
false,
|
||||||
)
|
)
|
||||||
|
|
||||||
val useCustomTrackingProtection by booleanPreference(
|
val useCustomTrackingProtection by booleanPreference(
|
||||||
appContext.getPreferenceKey(R.string.pref_key_tracking_protection_custom_option),
|
appContext.getPreferenceKey(R.string.pref_key_tracking_protection_custom_option),
|
||||||
false
|
false,
|
||||||
)
|
)
|
||||||
|
|
||||||
@VisibleForTesting(otherwise = PRIVATE)
|
@VisibleForTesting(otherwise = PRIVATE)
|
||||||
fun setStrictETP() {
|
fun setStrictETP() {
|
||||||
preferences.edit().putBoolean(
|
preferences.edit().putBoolean(
|
||||||
appContext.getPreferenceKey(R.string.pref_key_tracking_protection_strict_default),
|
appContext.getPreferenceKey(R.string.pref_key_tracking_protection_strict_default),
|
||||||
true
|
true,
|
||||||
).apply()
|
).apply()
|
||||||
preferences.edit().putBoolean(
|
preferences.edit().putBoolean(
|
||||||
appContext.getPreferenceKey(R.string.pref_key_tracking_protection_standard_option),
|
appContext.getPreferenceKey(R.string.pref_key_tracking_protection_standard_option),
|
||||||
false
|
false,
|
||||||
).apply()
|
).apply()
|
||||||
appContext.components.let {
|
appContext.components.let {
|
||||||
val policy = it.core.trackingProtectionPolicyFactory
|
val policy = it.core.trackingProtectionPolicyFactory
|
||||||
|
@ -581,7 +583,7 @@ class Settings(private val appContext: Context) : PreferencesHolder {
|
||||||
|
|
||||||
val blockCookiesInCustomTrackingProtection by booleanPreference(
|
val blockCookiesInCustomTrackingProtection by booleanPreference(
|
||||||
appContext.getPreferenceKey(R.string.pref_key_tracking_protection_custom_cookies),
|
appContext.getPreferenceKey(R.string.pref_key_tracking_protection_custom_cookies),
|
||||||
true
|
true,
|
||||||
)
|
)
|
||||||
|
|
||||||
val enabledTotalCookieProtectionSetting: Boolean
|
val enabledTotalCookieProtectionSetting: Boolean
|
||||||
|
@ -601,32 +603,32 @@ class Settings(private val appContext: Context) : PreferencesHolder {
|
||||||
appContext.getString(R.string.total_protection)
|
appContext.getString(R.string.total_protection)
|
||||||
} else {
|
} else {
|
||||||
appContext.getString(R.string.social)
|
appContext.getString(R.string.social)
|
||||||
}
|
},
|
||||||
)
|
)
|
||||||
|
|
||||||
val blockTrackingContentInCustomTrackingProtection by booleanPreference(
|
val blockTrackingContentInCustomTrackingProtection by booleanPreference(
|
||||||
appContext.getPreferenceKey(R.string.pref_key_tracking_protection_custom_tracking_content),
|
appContext.getPreferenceKey(R.string.pref_key_tracking_protection_custom_tracking_content),
|
||||||
true
|
true,
|
||||||
)
|
)
|
||||||
|
|
||||||
val blockTrackingContentSelectionInCustomTrackingProtection by stringPreference(
|
val blockTrackingContentSelectionInCustomTrackingProtection by stringPreference(
|
||||||
appContext.getPreferenceKey(R.string.pref_key_tracking_protection_custom_tracking_content_select),
|
appContext.getPreferenceKey(R.string.pref_key_tracking_protection_custom_tracking_content_select),
|
||||||
appContext.getString(R.string.all)
|
appContext.getString(R.string.all),
|
||||||
)
|
)
|
||||||
|
|
||||||
val blockCryptominersInCustomTrackingProtection by booleanPreference(
|
val blockCryptominersInCustomTrackingProtection by booleanPreference(
|
||||||
appContext.getPreferenceKey(R.string.pref_key_tracking_protection_custom_cryptominers),
|
appContext.getPreferenceKey(R.string.pref_key_tracking_protection_custom_cryptominers),
|
||||||
true
|
true,
|
||||||
)
|
)
|
||||||
|
|
||||||
val blockFingerprintersInCustomTrackingProtection by booleanPreference(
|
val blockFingerprintersInCustomTrackingProtection by booleanPreference(
|
||||||
appContext.getPreferenceKey(R.string.pref_key_tracking_protection_custom_fingerprinters),
|
appContext.getPreferenceKey(R.string.pref_key_tracking_protection_custom_fingerprinters),
|
||||||
true
|
true,
|
||||||
)
|
)
|
||||||
|
|
||||||
val blockRedirectTrackersInCustomTrackingProtection by booleanPreference(
|
val blockRedirectTrackersInCustomTrackingProtection by booleanPreference(
|
||||||
appContext.getPreferenceKey(R.string.pref_key_tracking_protection_redirect_trackers),
|
appContext.getPreferenceKey(R.string.pref_key_tracking_protection_redirect_trackers),
|
||||||
true
|
true,
|
||||||
)
|
)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -645,7 +647,7 @@ class Settings(private val appContext: Context) : PreferencesHolder {
|
||||||
get() {
|
get() {
|
||||||
val lastKnownModeWasPrivate = preferences.getBoolean(
|
val lastKnownModeWasPrivate = preferences.getBoolean(
|
||||||
appContext.getPreferenceKey(R.string.pref_key_last_known_mode_private),
|
appContext.getPreferenceKey(R.string.pref_key_last_known_mode_private),
|
||||||
false
|
false,
|
||||||
)
|
)
|
||||||
|
|
||||||
return if (lastKnownModeWasPrivate) {
|
return if (lastKnownModeWasPrivate) {
|
||||||
|
@ -660,7 +662,7 @@ class Settings(private val appContext: Context) : PreferencesHolder {
|
||||||
preferences.edit()
|
preferences.edit()
|
||||||
.putBoolean(
|
.putBoolean(
|
||||||
appContext.getPreferenceKey(R.string.pref_key_last_known_mode_private),
|
appContext.getPreferenceKey(R.string.pref_key_last_known_mode_private),
|
||||||
lastKnownModeWasPrivate
|
lastKnownModeWasPrivate,
|
||||||
)
|
)
|
||||||
.apply()
|
.apply()
|
||||||
|
|
||||||
|
@ -669,43 +671,43 @@ class Settings(private val appContext: Context) : PreferencesHolder {
|
||||||
|
|
||||||
var shouldDeleteBrowsingDataOnQuit by booleanPreference(
|
var shouldDeleteBrowsingDataOnQuit by booleanPreference(
|
||||||
appContext.getPreferenceKey(R.string.pref_key_delete_browsing_data_on_quit),
|
appContext.getPreferenceKey(R.string.pref_key_delete_browsing_data_on_quit),
|
||||||
default = false
|
default = false,
|
||||||
)
|
)
|
||||||
|
|
||||||
var deleteOpenTabs by booleanPreference(
|
var deleteOpenTabs by booleanPreference(
|
||||||
appContext.getPreferenceKey(R.string.pref_key_delete_open_tabs_now),
|
appContext.getPreferenceKey(R.string.pref_key_delete_open_tabs_now),
|
||||||
default = true
|
default = true,
|
||||||
)
|
)
|
||||||
|
|
||||||
var deleteBrowsingHistory by booleanPreference(
|
var deleteBrowsingHistory by booleanPreference(
|
||||||
appContext.getPreferenceKey(R.string.pref_key_delete_browsing_history_now),
|
appContext.getPreferenceKey(R.string.pref_key_delete_browsing_history_now),
|
||||||
default = true
|
default = true,
|
||||||
)
|
)
|
||||||
|
|
||||||
var deleteCookies by booleanPreference(
|
var deleteCookies by booleanPreference(
|
||||||
appContext.getPreferenceKey(R.string.pref_key_delete_cookies_now),
|
appContext.getPreferenceKey(R.string.pref_key_delete_cookies_now),
|
||||||
default = true
|
default = true,
|
||||||
)
|
)
|
||||||
|
|
||||||
var deleteCache by booleanPreference(
|
var deleteCache by booleanPreference(
|
||||||
appContext.getPreferenceKey(R.string.pref_key_delete_caches_now),
|
appContext.getPreferenceKey(R.string.pref_key_delete_caches_now),
|
||||||
default = true
|
default = true,
|
||||||
)
|
)
|
||||||
|
|
||||||
var deleteSitePermissions by booleanPreference(
|
var deleteSitePermissions by booleanPreference(
|
||||||
appContext.getPreferenceKey(R.string.pref_key_delete_permissions_now),
|
appContext.getPreferenceKey(R.string.pref_key_delete_permissions_now),
|
||||||
default = true
|
default = true,
|
||||||
)
|
)
|
||||||
|
|
||||||
var deleteDownloads by booleanPreference(
|
var deleteDownloads by booleanPreference(
|
||||||
appContext.getPreferenceKey(R.string.pref_key_delete_downloads_now),
|
appContext.getPreferenceKey(R.string.pref_key_delete_downloads_now),
|
||||||
default = true
|
default = true,
|
||||||
)
|
)
|
||||||
|
|
||||||
var shouldUseBottomToolbar by booleanPreference(
|
var shouldUseBottomToolbar by booleanPreference(
|
||||||
appContext.getPreferenceKey(R.string.pref_key_toolbar_bottom),
|
appContext.getPreferenceKey(R.string.pref_key_toolbar_bottom),
|
||||||
// Default accessibility users to top toolbar
|
// Default accessibility users to top toolbar
|
||||||
default = !touchExplorationIsEnabled && !switchServiceIsEnabled
|
default = !touchExplorationIsEnabled && !switchServiceIsEnabled,
|
||||||
)
|
)
|
||||||
|
|
||||||
val toolbarPosition: ToolbarPosition
|
val toolbarPosition: ToolbarPosition
|
||||||
|
@ -755,24 +757,24 @@ class Settings(private val appContext: Context) : PreferencesHolder {
|
||||||
|
|
||||||
val passwordsEncryptionKeyGenerated by booleanPreference(
|
val passwordsEncryptionKeyGenerated by booleanPreference(
|
||||||
appContext.getPreferenceKey(R.string.pref_key_encryption_key_generated),
|
appContext.getPreferenceKey(R.string.pref_key_encryption_key_generated),
|
||||||
false
|
false,
|
||||||
)
|
)
|
||||||
|
|
||||||
fun recordPasswordsEncryptionKeyGenerated() = preferences.edit().putBoolean(
|
fun recordPasswordsEncryptionKeyGenerated() = preferences.edit().putBoolean(
|
||||||
appContext.getPreferenceKey(R.string.pref_key_encryption_key_generated),
|
appContext.getPreferenceKey(R.string.pref_key_encryption_key_generated),
|
||||||
true
|
true,
|
||||||
).apply()
|
).apply()
|
||||||
|
|
||||||
@VisibleForTesting(otherwise = PRIVATE)
|
@VisibleForTesting(otherwise = PRIVATE)
|
||||||
internal val loginsSecureWarningSyncCount = counterPreference(
|
internal val loginsSecureWarningSyncCount = counterPreference(
|
||||||
appContext.getPreferenceKey(R.string.pref_key_logins_secure_warning_sync),
|
appContext.getPreferenceKey(R.string.pref_key_logins_secure_warning_sync),
|
||||||
maxCount = 1
|
maxCount = 1,
|
||||||
)
|
)
|
||||||
|
|
||||||
@VisibleForTesting(otherwise = PRIVATE)
|
@VisibleForTesting(otherwise = PRIVATE)
|
||||||
internal val secureWarningCount = counterPreference(
|
internal val secureWarningCount = counterPreference(
|
||||||
appContext.getPreferenceKey(R.string.pref_key_secure_warning),
|
appContext.getPreferenceKey(R.string.pref_key_secure_warning),
|
||||||
maxCount = 1
|
maxCount = 1,
|
||||||
)
|
)
|
||||||
|
|
||||||
fun incrementSecureWarningCount() = secureWarningCount.increment()
|
fun incrementSecureWarningCount() = secureWarningCount.increment()
|
||||||
|
@ -781,27 +783,27 @@ class Settings(private val appContext: Context) : PreferencesHolder {
|
||||||
|
|
||||||
val shouldShowSearchSuggestions by booleanPreference(
|
val shouldShowSearchSuggestions by booleanPreference(
|
||||||
appContext.getPreferenceKey(R.string.pref_key_show_search_suggestions),
|
appContext.getPreferenceKey(R.string.pref_key_show_search_suggestions),
|
||||||
default = true
|
default = true,
|
||||||
)
|
)
|
||||||
|
|
||||||
val shouldAutocompleteInAwesomebar by booleanPreference(
|
val shouldAutocompleteInAwesomebar by booleanPreference(
|
||||||
appContext.getPreferenceKey(R.string.pref_key_enable_autocomplete_urls),
|
appContext.getPreferenceKey(R.string.pref_key_enable_autocomplete_urls),
|
||||||
default = true
|
default = true,
|
||||||
)
|
)
|
||||||
|
|
||||||
var defaultTopSitesAdded by booleanPreference(
|
var defaultTopSitesAdded by booleanPreference(
|
||||||
appContext.getPreferenceKey(R.string.default_top_sites_added),
|
appContext.getPreferenceKey(R.string.default_top_sites_added),
|
||||||
default = false
|
default = false,
|
||||||
)
|
)
|
||||||
|
|
||||||
var shouldShowSearchSuggestionsInPrivate by booleanPreference(
|
var shouldShowSearchSuggestionsInPrivate by booleanPreference(
|
||||||
appContext.getPreferenceKey(R.string.pref_key_show_search_suggestions_in_private),
|
appContext.getPreferenceKey(R.string.pref_key_show_search_suggestions_in_private),
|
||||||
default = false
|
default = false,
|
||||||
)
|
)
|
||||||
|
|
||||||
var showSearchSuggestionsInPrivateOnboardingFinished by booleanPreference(
|
var showSearchSuggestionsInPrivateOnboardingFinished by booleanPreference(
|
||||||
appContext.getPreferenceKey(R.string.pref_key_show_search_suggestions_in_private_onboarding),
|
appContext.getPreferenceKey(R.string.pref_key_show_search_suggestions_in_private_onboarding),
|
||||||
default = false
|
default = false,
|
||||||
)
|
)
|
||||||
|
|
||||||
fun incrementVisitedInstallableCount() = pwaInstallableVisitCount.increment()
|
fun incrementVisitedInstallableCount() = pwaInstallableVisitCount.increment()
|
||||||
|
@ -809,7 +811,7 @@ class Settings(private val appContext: Context) : PreferencesHolder {
|
||||||
@VisibleForTesting(otherwise = PRIVATE)
|
@VisibleForTesting(otherwise = PRIVATE)
|
||||||
internal val pwaInstallableVisitCount = counterPreference(
|
internal val pwaInstallableVisitCount = counterPreference(
|
||||||
appContext.getPreferenceKey(R.string.pref_key_install_pwa_visits),
|
appContext.getPreferenceKey(R.string.pref_key_install_pwa_visits),
|
||||||
maxCount = 3
|
maxCount = 3,
|
||||||
)
|
)
|
||||||
|
|
||||||
private val userNeedsToVisitInstallableSites: Boolean
|
private val userNeedsToVisitInstallableSites: Boolean
|
||||||
|
@ -835,12 +837,12 @@ class Settings(private val appContext: Context) : PreferencesHolder {
|
||||||
|
|
||||||
var userKnowsAboutPwas by booleanPreference(
|
var userKnowsAboutPwas by booleanPreference(
|
||||||
appContext.getPreferenceKey(R.string.pref_key_user_knows_about_pwa),
|
appContext.getPreferenceKey(R.string.pref_key_user_knows_about_pwa),
|
||||||
default = false
|
default = false,
|
||||||
)
|
)
|
||||||
|
|
||||||
var shouldShowOpenInAppBanner by booleanPreference(
|
var shouldShowOpenInAppBanner by booleanPreference(
|
||||||
appContext.getPreferenceKey(R.string.pref_key_should_show_open_in_app_banner),
|
appContext.getPreferenceKey(R.string.pref_key_should_show_open_in_app_banner),
|
||||||
default = true
|
default = true,
|
||||||
)
|
)
|
||||||
|
|
||||||
val shouldShowOpenInAppCfr: Boolean
|
val shouldShowOpenInAppCfr: Boolean
|
||||||
|
@ -848,12 +850,12 @@ class Settings(private val appContext: Context) : PreferencesHolder {
|
||||||
|
|
||||||
var shouldShowAutoCloseTabsBanner by booleanPreference(
|
var shouldShowAutoCloseTabsBanner by booleanPreference(
|
||||||
appContext.getPreferenceKey(R.string.pref_key_should_show_auto_close_tabs_banner),
|
appContext.getPreferenceKey(R.string.pref_key_should_show_auto_close_tabs_banner),
|
||||||
default = true
|
default = true,
|
||||||
)
|
)
|
||||||
|
|
||||||
var shouldShowInactiveTabsOnboardingPopup by booleanPreference(
|
var shouldShowInactiveTabsOnboardingPopup by booleanPreference(
|
||||||
appContext.getPreferenceKey(R.string.pref_key_should_show_inactive_tabs_popup),
|
appContext.getPreferenceKey(R.string.pref_key_should_show_inactive_tabs_popup),
|
||||||
default = true
|
default = true,
|
||||||
)
|
)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -861,7 +863,7 @@ class Settings(private val appContext: Context) : PreferencesHolder {
|
||||||
*/
|
*/
|
||||||
var hasInactiveTabsAutoCloseDialogBeenDismissed by booleanPreference(
|
var hasInactiveTabsAutoCloseDialogBeenDismissed by booleanPreference(
|
||||||
appContext.getPreferenceKey(R.string.pref_key_has_inactive_tabs_auto_close_dialog_dismissed),
|
appContext.getPreferenceKey(R.string.pref_key_has_inactive_tabs_auto_close_dialog_dismissed),
|
||||||
default = false
|
default = false,
|
||||||
)
|
)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -887,7 +889,7 @@ class Settings(private val appContext: Context) : PreferencesHolder {
|
||||||
|
|
||||||
fun getSitePermissionsPhoneFeatureAction(
|
fun getSitePermissionsPhoneFeatureAction(
|
||||||
feature: PhoneFeature,
|
feature: PhoneFeature,
|
||||||
default: Action = Action.ASK_TO_ALLOW
|
default: Action = Action.ASK_TO_ALLOW,
|
||||||
) =
|
) =
|
||||||
preferences.getInt(feature.getPreferenceKey(appContext), default.toInt()).toAction()
|
preferences.getInt(feature.getPreferenceKey(appContext), default.toInt()).toAction()
|
||||||
|
|
||||||
|
@ -901,7 +903,7 @@ class Settings(private val appContext: Context) : PreferencesHolder {
|
||||||
* the user selected setting as well.
|
* the user selected setting as well.
|
||||||
*/
|
*/
|
||||||
fun setAutoplayUserSetting(
|
fun setAutoplayUserSetting(
|
||||||
autoplaySetting: Int
|
autoplaySetting: Int,
|
||||||
) {
|
) {
|
||||||
preferences.edit().putInt(AUTOPLAY_USER_SETTING, autoplaySetting).apply()
|
preferences.edit().putInt(AUTOPLAY_USER_SETTING, autoplaySetting).apply()
|
||||||
}
|
}
|
||||||
|
@ -919,12 +921,12 @@ class Settings(private val appContext: Context) : PreferencesHolder {
|
||||||
|
|
||||||
private fun getSitePermissionsPhoneFeatureAutoplayAction(
|
private fun getSitePermissionsPhoneFeatureAutoplayAction(
|
||||||
feature: PhoneFeature,
|
feature: PhoneFeature,
|
||||||
default: AutoplayAction = AutoplayAction.BLOCKED
|
default: AutoplayAction = AutoplayAction.BLOCKED,
|
||||||
) = preferences.getInt(feature.getPreferenceKey(appContext), default.toInt()).toAutoplayAction()
|
) = preferences.getInt(feature.getPreferenceKey(appContext), default.toInt()).toAutoplayAction()
|
||||||
|
|
||||||
fun setSitePermissionsPhoneFeatureAction(
|
fun setSitePermissionsPhoneFeatureAction(
|
||||||
feature: PhoneFeature,
|
feature: PhoneFeature,
|
||||||
value: Action
|
value: Action,
|
||||||
) {
|
) {
|
||||||
preferences.edit().putInt(feature.getPreferenceKey(appContext), value.toInt()).apply()
|
preferences.edit().putInt(feature.getPreferenceKey(appContext), value.toInt()).apply()
|
||||||
}
|
}
|
||||||
|
@ -937,15 +939,15 @@ class Settings(private val appContext: Context) : PreferencesHolder {
|
||||||
camera = getSitePermissionsPhoneFeatureAction(PhoneFeature.CAMERA),
|
camera = getSitePermissionsPhoneFeatureAction(PhoneFeature.CAMERA),
|
||||||
autoplayAudible = getSitePermissionsPhoneFeatureAutoplayAction(
|
autoplayAudible = getSitePermissionsPhoneFeatureAutoplayAction(
|
||||||
feature = PhoneFeature.AUTOPLAY_AUDIBLE,
|
feature = PhoneFeature.AUTOPLAY_AUDIBLE,
|
||||||
default = AutoplayAction.BLOCKED
|
default = AutoplayAction.BLOCKED,
|
||||||
),
|
),
|
||||||
autoplayInaudible = getSitePermissionsPhoneFeatureAutoplayAction(
|
autoplayInaudible = getSitePermissionsPhoneFeatureAutoplayAction(
|
||||||
feature = PhoneFeature.AUTOPLAY_INAUDIBLE,
|
feature = PhoneFeature.AUTOPLAY_INAUDIBLE,
|
||||||
default = AutoplayAction.ALLOWED
|
default = AutoplayAction.ALLOWED,
|
||||||
),
|
),
|
||||||
persistentStorage = getSitePermissionsPhoneFeatureAction(PhoneFeature.PERSISTENT_STORAGE),
|
persistentStorage = getSitePermissionsPhoneFeatureAction(PhoneFeature.PERSISTENT_STORAGE),
|
||||||
crossOriginStorageAccess = getSitePermissionsPhoneFeatureAction(PhoneFeature.CROSS_ORIGIN_STORAGE_ACCESS),
|
crossOriginStorageAccess = getSitePermissionsPhoneFeatureAction(PhoneFeature.CROSS_ORIGIN_STORAGE_ACCESS),
|
||||||
mediaKeySystemAccess = getSitePermissionsPhoneFeatureAction(PhoneFeature.MEDIA_KEY_SYSTEM_ACCESS)
|
mediaKeySystemAccess = getSitePermissionsPhoneFeatureAction(PhoneFeature.MEDIA_KEY_SYSTEM_ACCESS),
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -959,7 +961,7 @@ class Settings(private val appContext: Context) : PreferencesHolder {
|
||||||
PhoneFeature.AUTOPLAY_INAUDIBLE,
|
PhoneFeature.AUTOPLAY_INAUDIBLE,
|
||||||
PhoneFeature.PERSISTENT_STORAGE,
|
PhoneFeature.PERSISTENT_STORAGE,
|
||||||
PhoneFeature.CROSS_ORIGIN_STORAGE_ACCESS,
|
PhoneFeature.CROSS_ORIGIN_STORAGE_ACCESS,
|
||||||
PhoneFeature.MEDIA_KEY_SYSTEM_ACCESS
|
PhoneFeature.MEDIA_KEY_SYSTEM_ACCESS,
|
||||||
).map { it.getPreferenceKey(appContext) }
|
).map { it.getPreferenceKey(appContext) }
|
||||||
|
|
||||||
preferences.registerOnSharedPreferenceChangeListener(lifecycleOwner) { _, key ->
|
preferences.registerOnSharedPreferenceChangeListener(lifecycleOwner) { _, key ->
|
||||||
|
@ -969,7 +971,7 @@ class Settings(private val appContext: Context) : PreferencesHolder {
|
||||||
|
|
||||||
var shouldShowVoiceSearch by booleanPreference(
|
var shouldShowVoiceSearch by booleanPreference(
|
||||||
appContext.getPreferenceKey(R.string.pref_key_show_voice_search),
|
appContext.getPreferenceKey(R.string.pref_key_show_voice_search),
|
||||||
default = true
|
default = true,
|
||||||
)
|
)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -978,7 +980,7 @@ class Settings(private val appContext: Context) : PreferencesHolder {
|
||||||
*/
|
*/
|
||||||
var shouldShowCameraPermissionPrompt by booleanPreference(
|
var shouldShowCameraPermissionPrompt by booleanPreference(
|
||||||
appContext.getPreferenceKey(R.string.pref_key_camera_permissions_needed),
|
appContext.getPreferenceKey(R.string.pref_key_camera_permissions_needed),
|
||||||
default = true
|
default = true,
|
||||||
)
|
)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -987,22 +989,22 @@ class Settings(private val appContext: Context) : PreferencesHolder {
|
||||||
*/
|
*/
|
||||||
var setCameraPermissionNeededState by booleanPreference(
|
var setCameraPermissionNeededState by booleanPreference(
|
||||||
appContext.getPreferenceKey(R.string.pref_key_camera_permissions_needed),
|
appContext.getPreferenceKey(R.string.pref_key_camera_permissions_needed),
|
||||||
default = true
|
default = true,
|
||||||
)
|
)
|
||||||
|
|
||||||
var shouldPromptToSaveLogins by booleanPreference(
|
var shouldPromptToSaveLogins by booleanPreference(
|
||||||
appContext.getPreferenceKey(R.string.pref_key_save_logins),
|
appContext.getPreferenceKey(R.string.pref_key_save_logins),
|
||||||
default = true
|
default = true,
|
||||||
)
|
)
|
||||||
|
|
||||||
var shouldAutofillLogins by booleanPreference(
|
var shouldAutofillLogins by booleanPreference(
|
||||||
appContext.getPreferenceKey(R.string.pref_key_autofill_logins),
|
appContext.getPreferenceKey(R.string.pref_key_autofill_logins),
|
||||||
default = true
|
default = true,
|
||||||
)
|
)
|
||||||
|
|
||||||
var lastPlacesStorageMaintenance by longPreference(
|
var lastPlacesStorageMaintenance by longPreference(
|
||||||
appContext.getPreferenceKey(R.string.pref_key_last_maintenance),
|
appContext.getPreferenceKey(R.string.pref_key_last_maintenance),
|
||||||
default = 0
|
default = 0,
|
||||||
)
|
)
|
||||||
|
|
||||||
fun addSearchWidgetInstalled(count: Int) {
|
fun addSearchWidgetInstalled(count: Int) {
|
||||||
|
@ -1016,18 +1018,18 @@ class Settings(private val appContext: Context) : PreferencesHolder {
|
||||||
val searchWidgetInstalled: Boolean
|
val searchWidgetInstalled: Boolean
|
||||||
get() = 0 < preferences.getInt(
|
get() = 0 < preferences.getInt(
|
||||||
appContext.getPreferenceKey(R.string.pref_key_search_widget_installed),
|
appContext.getPreferenceKey(R.string.pref_key_search_widget_installed),
|
||||||
0
|
0,
|
||||||
)
|
)
|
||||||
|
|
||||||
fun incrementNumTimesPrivateModeOpened() = numTimesPrivateModeOpened.increment()
|
fun incrementNumTimesPrivateModeOpened() = numTimesPrivateModeOpened.increment()
|
||||||
|
|
||||||
var showedPrivateModeContextualFeatureRecommender by booleanPreference(
|
var showedPrivateModeContextualFeatureRecommender by booleanPreference(
|
||||||
appContext.getPreferenceKey(R.string.pref_key_showed_private_mode_cfr),
|
appContext.getPreferenceKey(R.string.pref_key_showed_private_mode_cfr),
|
||||||
default = false
|
default = false,
|
||||||
)
|
)
|
||||||
|
|
||||||
private val numTimesPrivateModeOpened = counterPreference(
|
private val numTimesPrivateModeOpened = counterPreference(
|
||||||
appContext.getPreferenceKey(R.string.pref_key_private_mode_opened)
|
appContext.getPreferenceKey(R.string.pref_key_private_mode_opened),
|
||||||
)
|
)
|
||||||
|
|
||||||
val shouldShowPrivateModeCfr: Boolean
|
val shouldShowPrivateModeCfr: Boolean
|
||||||
|
@ -1052,37 +1054,37 @@ class Settings(private val appContext: Context) : PreferencesHolder {
|
||||||
|
|
||||||
var openLinksInExternalApp by booleanPreference(
|
var openLinksInExternalApp by booleanPreference(
|
||||||
appContext.getPreferenceKey(R.string.pref_key_open_links_in_external_app),
|
appContext.getPreferenceKey(R.string.pref_key_open_links_in_external_app),
|
||||||
default = false
|
default = false,
|
||||||
)
|
)
|
||||||
|
|
||||||
var allowDomesticChinaFxaServer by booleanPreference(
|
var allowDomesticChinaFxaServer by booleanPreference(
|
||||||
appContext.getPreferenceKey(R.string.pref_key_allow_domestic_china_fxa_server),
|
appContext.getPreferenceKey(R.string.pref_key_allow_domestic_china_fxa_server),
|
||||||
default = true
|
default = true,
|
||||||
)
|
)
|
||||||
|
|
||||||
var overrideFxAServer by stringPreference(
|
var overrideFxAServer by stringPreference(
|
||||||
appContext.getPreferenceKey(R.string.pref_key_override_fxa_server),
|
appContext.getPreferenceKey(R.string.pref_key_override_fxa_server),
|
||||||
default = ""
|
default = "",
|
||||||
)
|
)
|
||||||
|
|
||||||
var overrideSyncTokenServer by stringPreference(
|
var overrideSyncTokenServer by stringPreference(
|
||||||
appContext.getPreferenceKey(R.string.pref_key_override_sync_tokenserver),
|
appContext.getPreferenceKey(R.string.pref_key_override_sync_tokenserver),
|
||||||
default = ""
|
default = "",
|
||||||
)
|
)
|
||||||
|
|
||||||
var overridePushServer by stringPreference(
|
var overridePushServer by stringPreference(
|
||||||
appContext.getPreferenceKey(R.string.pref_key_override_push_server),
|
appContext.getPreferenceKey(R.string.pref_key_override_push_server),
|
||||||
default = ""
|
default = "",
|
||||||
)
|
)
|
||||||
|
|
||||||
var overrideAmoUser by stringPreference(
|
var overrideAmoUser by stringPreference(
|
||||||
appContext.getPreferenceKey(R.string.pref_key_override_amo_user),
|
appContext.getPreferenceKey(R.string.pref_key_override_amo_user),
|
||||||
default = ""
|
default = "",
|
||||||
)
|
)
|
||||||
|
|
||||||
var overrideAmoCollection by stringPreference(
|
var overrideAmoCollection by stringPreference(
|
||||||
appContext.getPreferenceKey(R.string.pref_key_override_amo_collection),
|
appContext.getPreferenceKey(R.string.pref_key_override_amo_collection),
|
||||||
default = ""
|
default = "",
|
||||||
)
|
)
|
||||||
|
|
||||||
fun amoCollectionOverrideConfigured(): Boolean {
|
fun amoCollectionOverrideConfigured(): Boolean {
|
||||||
|
@ -1091,27 +1093,27 @@ class Settings(private val appContext: Context) : PreferencesHolder {
|
||||||
|
|
||||||
var topSitesSize by intPreference(
|
var topSitesSize by intPreference(
|
||||||
appContext.getPreferenceKey(R.string.pref_key_top_sites_size),
|
appContext.getPreferenceKey(R.string.pref_key_top_sites_size),
|
||||||
default = 0
|
default = 0,
|
||||||
)
|
)
|
||||||
|
|
||||||
val topSitesMaxLimit by intPreference(
|
val topSitesMaxLimit by intPreference(
|
||||||
appContext.getPreferenceKey(R.string.pref_key_top_sites_max_limit),
|
appContext.getPreferenceKey(R.string.pref_key_top_sites_max_limit),
|
||||||
default = TOP_SITES_MAX_COUNT
|
default = TOP_SITES_MAX_COUNT,
|
||||||
)
|
)
|
||||||
|
|
||||||
var openTabsCount by intPreference(
|
var openTabsCount by intPreference(
|
||||||
appContext.getPreferenceKey(R.string.pref_key_open_tabs_count),
|
appContext.getPreferenceKey(R.string.pref_key_open_tabs_count),
|
||||||
0
|
0,
|
||||||
)
|
)
|
||||||
|
|
||||||
var mobileBookmarksSize by intPreference(
|
var mobileBookmarksSize by intPreference(
|
||||||
appContext.getPreferenceKey(R.string.pref_key_mobile_bookmarks_size),
|
appContext.getPreferenceKey(R.string.pref_key_mobile_bookmarks_size),
|
||||||
0
|
0,
|
||||||
)
|
)
|
||||||
|
|
||||||
var desktopBookmarksSize by intPreference(
|
var desktopBookmarksSize by intPreference(
|
||||||
appContext.getPreferenceKey(R.string.pref_key_desktop_bookmarks_size),
|
appContext.getPreferenceKey(R.string.pref_key_desktop_bookmarks_size),
|
||||||
0
|
0,
|
||||||
)
|
)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -1119,7 +1121,7 @@ class Settings(private val appContext: Context) : PreferencesHolder {
|
||||||
*/
|
*/
|
||||||
var installedAddonsCount by intPreference(
|
var installedAddonsCount by intPreference(
|
||||||
appContext.getPreferenceKey(R.string.pref_key_installed_addons_count),
|
appContext.getPreferenceKey(R.string.pref_key_installed_addons_count),
|
||||||
0
|
0,
|
||||||
)
|
)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -1127,8 +1129,9 @@ class Settings(private val appContext: Context) : PreferencesHolder {
|
||||||
*/
|
*/
|
||||||
var installedAddonsList by stringPreference(
|
var installedAddonsList by stringPreference(
|
||||||
appContext.getPreferenceKey(R.string.pref_key_installed_addons_list),
|
appContext.getPreferenceKey(R.string.pref_key_installed_addons_list),
|
||||||
default = ""
|
default = "",
|
||||||
)
|
)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* URLs from the user's history that contain this search param will be hidden.
|
* URLs from the user's history that contain this search param will be hidden.
|
||||||
* The value is a string with one of the following forms:
|
* The value is a string with one of the following forms:
|
||||||
|
@ -1139,7 +1142,7 @@ class Settings(private val appContext: Context) : PreferencesHolder {
|
||||||
*/
|
*/
|
||||||
val frecencyFilterQuery by stringPreference(
|
val frecencyFilterQuery by stringPreference(
|
||||||
appContext.getPreferenceKey(R.string.pref_key_frecency_filter_query),
|
appContext.getPreferenceKey(R.string.pref_key_frecency_filter_query),
|
||||||
default = "mfadid=adm" // Parameter provided by adM
|
default = "mfadid=adm", // Parameter provided by adM
|
||||||
)
|
)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -1147,7 +1150,7 @@ class Settings(private val appContext: Context) : PreferencesHolder {
|
||||||
*/
|
*/
|
||||||
var enabledAddonsCount by intPreference(
|
var enabledAddonsCount by intPreference(
|
||||||
appContext.getPreferenceKey(R.string.pref_key_enabled_addons_count),
|
appContext.getPreferenceKey(R.string.pref_key_enabled_addons_count),
|
||||||
0
|
0,
|
||||||
)
|
)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -1155,12 +1158,12 @@ class Settings(private val appContext: Context) : PreferencesHolder {
|
||||||
*/
|
*/
|
||||||
var enabledAddonsList by stringPreference(
|
var enabledAddonsList by stringPreference(
|
||||||
appContext.getPreferenceKey(R.string.pref_key_enabled_addons_list),
|
appContext.getPreferenceKey(R.string.pref_key_enabled_addons_list),
|
||||||
default = ""
|
default = "",
|
||||||
)
|
)
|
||||||
|
|
||||||
private var savedLoginsSortingStrategyString by stringPreference(
|
private var savedLoginsSortingStrategyString by stringPreference(
|
||||||
appContext.getPreferenceKey(R.string.pref_key_saved_logins_sorting_strategy),
|
appContext.getPreferenceKey(R.string.pref_key_saved_logins_sorting_strategy),
|
||||||
default = SavedLoginsSortingStrategyMenu.Item.AlphabeticallySort.strategyString
|
default = SavedLoginsSortingStrategyMenu.Item.AlphabeticallySort.strategyString,
|
||||||
)
|
)
|
||||||
|
|
||||||
val savedLoginsMenuHighlightedItem: SavedLoginsSortingStrategyMenu.Item
|
val savedLoginsMenuHighlightedItem: SavedLoginsSortingStrategyMenu.Item
|
||||||
|
@ -1184,23 +1187,23 @@ class Settings(private val appContext: Context) : PreferencesHolder {
|
||||||
|
|
||||||
var isPullToRefreshEnabledInBrowser by booleanPreference(
|
var isPullToRefreshEnabledInBrowser by booleanPreference(
|
||||||
appContext.getPreferenceKey(R.string.pref_key_website_pull_to_refresh),
|
appContext.getPreferenceKey(R.string.pref_key_website_pull_to_refresh),
|
||||||
default = true
|
default = true,
|
||||||
)
|
)
|
||||||
|
|
||||||
var isDynamicToolbarEnabled by booleanPreference(
|
var isDynamicToolbarEnabled by booleanPreference(
|
||||||
appContext.getPreferenceKey(R.string.pref_key_dynamic_toolbar),
|
appContext.getPreferenceKey(R.string.pref_key_dynamic_toolbar),
|
||||||
default = true
|
default = true,
|
||||||
)
|
)
|
||||||
|
|
||||||
var isSwipeToolbarToSwitchTabsEnabled by booleanPreference(
|
var isSwipeToolbarToSwitchTabsEnabled by booleanPreference(
|
||||||
appContext.getPreferenceKey(R.string.pref_key_swipe_toolbar_switch_tabs),
|
appContext.getPreferenceKey(R.string.pref_key_swipe_toolbar_switch_tabs),
|
||||||
default = true
|
default = true,
|
||||||
)
|
)
|
||||||
|
|
||||||
var addressFeature by featureFlagPreference(
|
var addressFeature by featureFlagPreference(
|
||||||
appContext.getPreferenceKey(R.string.pref_key_show_address_feature),
|
appContext.getPreferenceKey(R.string.pref_key_show_address_feature),
|
||||||
default = true,
|
default = true,
|
||||||
featureFlag = isAddressFeatureEnabled(appContext)
|
featureFlag = isAddressFeatureEnabled(appContext),
|
||||||
)
|
)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -1212,25 +1215,27 @@ class Settings(private val appContext: Context) : PreferencesHolder {
|
||||||
return listOf(
|
return listOf(
|
||||||
"en-US",
|
"en-US",
|
||||||
"en-CA",
|
"en-CA",
|
||||||
"fr-CA"
|
"fr-CA",
|
||||||
).contains(langTag)
|
).contains(langTag)
|
||||||
}
|
}
|
||||||
|
|
||||||
private var isHistoryMetadataEnabled by booleanPreference(
|
private var isHistoryMetadataEnabled by booleanPreference(
|
||||||
appContext.getPreferenceKey(R.string.pref_key_history_metadata_feature),
|
appContext.getPreferenceKey(R.string.pref_key_history_metadata_feature),
|
||||||
default = false
|
default = false,
|
||||||
)
|
)
|
||||||
|
|
||||||
private val mr2022Sections: Map<Mr2022Section, Boolean> get() =
|
private val mr2022Sections: Map<Mr2022Section, Boolean>
|
||||||
|
get() =
|
||||||
FxNimbus.features.mr2022.value().sectionsEnabled
|
FxNimbus.features.mr2022.value().sectionsEnabled
|
||||||
|
|
||||||
private val homescreenSections: Map<HomeScreenSection, Boolean> get() =
|
private val homescreenSections: Map<HomeScreenSection, Boolean>
|
||||||
|
get() =
|
||||||
FxNimbus.features.homescreen.value().sectionsEnabled
|
FxNimbus.features.homescreen.value().sectionsEnabled
|
||||||
|
|
||||||
var historyMetadataUIFeature by lazyFeatureFlagPreference(
|
var historyMetadataUIFeature by lazyFeatureFlagPreference(
|
||||||
appContext.getPreferenceKey(R.string.pref_key_history_metadata_feature),
|
appContext.getPreferenceKey(R.string.pref_key_history_metadata_feature),
|
||||||
default = { homescreenSections[HomeScreenSection.RECENT_EXPLORATIONS] == true },
|
default = { homescreenSections[HomeScreenSection.RECENT_EXPLORATIONS] == true },
|
||||||
featureFlag = FeatureFlags.historyMetadataUIFeature || isHistoryMetadataEnabled
|
featureFlag = FeatureFlags.historyMetadataUIFeature || isHistoryMetadataEnabled,
|
||||||
)
|
)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -1269,7 +1274,7 @@ class Settings(private val appContext: Context) : PreferencesHolder {
|
||||||
var showRecentBookmarksFeature by lazyFeatureFlagPreference(
|
var showRecentBookmarksFeature by lazyFeatureFlagPreference(
|
||||||
appContext.getPreferenceKey(R.string.pref_key_recent_bookmarks),
|
appContext.getPreferenceKey(R.string.pref_key_recent_bookmarks),
|
||||||
default = { homescreenSections[HomeScreenSection.RECENTLY_SAVED] == true },
|
default = { homescreenSections[HomeScreenSection.RECENTLY_SAVED] == true },
|
||||||
featureFlag = FeatureFlags.recentBookmarksFeature
|
featureFlag = FeatureFlags.recentBookmarksFeature,
|
||||||
)
|
)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -1278,12 +1283,12 @@ class Settings(private val appContext: Context) : PreferencesHolder {
|
||||||
*/
|
*/
|
||||||
var openNextTabInDesktopMode by booleanPreference(
|
var openNextTabInDesktopMode by booleanPreference(
|
||||||
appContext.getPreferenceKey(R.string.pref_key_open_next_tab_desktop_mode),
|
appContext.getPreferenceKey(R.string.pref_key_open_next_tab_desktop_mode),
|
||||||
default = false
|
default = false,
|
||||||
)
|
)
|
||||||
|
|
||||||
var signedInFxaAccount by booleanPreference(
|
var signedInFxaAccount by booleanPreference(
|
||||||
appContext.getPreferenceKey(R.string.pref_key_fxa_signed_in),
|
appContext.getPreferenceKey(R.string.pref_key_fxa_signed_in),
|
||||||
default = false
|
default = false,
|
||||||
)
|
)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -1294,7 +1299,7 @@ class Settings(private val appContext: Context) : PreferencesHolder {
|
||||||
*/
|
*/
|
||||||
var shouldAutofillCreditCardDetails by booleanPreference(
|
var shouldAutofillCreditCardDetails by booleanPreference(
|
||||||
appContext.getPreferenceKey(R.string.pref_key_credit_cards_save_and_autofill_cards),
|
appContext.getPreferenceKey(R.string.pref_key_credit_cards_save_and_autofill_cards),
|
||||||
default = true
|
default = true,
|
||||||
)
|
)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -1305,7 +1310,7 @@ class Settings(private val appContext: Context) : PreferencesHolder {
|
||||||
*/
|
*/
|
||||||
var shouldAutofillAddressDetails by booleanPreference(
|
var shouldAutofillAddressDetails by booleanPreference(
|
||||||
appContext.getPreferenceKey(R.string.pref_key_addresses_save_and_autofill_addresses),
|
appContext.getPreferenceKey(R.string.pref_key_addresses_save_and_autofill_addresses),
|
||||||
default = true
|
default = true,
|
||||||
)
|
)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -1323,7 +1328,7 @@ class Settings(private val appContext: Context) : PreferencesHolder {
|
||||||
val showPocketSponsoredStories by lazyFeatureFlagPreference(
|
val showPocketSponsoredStories by lazyFeatureFlagPreference(
|
||||||
key = appContext.getPreferenceKey(R.string.pref_key_pocket_sponsored_stories),
|
key = appContext.getPreferenceKey(R.string.pref_key_pocket_sponsored_stories),
|
||||||
default = { homescreenSections[HomeScreenSection.POCKET_SPONSORED_STORIES] == true },
|
default = { homescreenSections[HomeScreenSection.POCKET_SPONSORED_STORIES] == true },
|
||||||
featureFlag = FeatureFlags.isPocketSponsoredStoriesFeatureEnabled(appContext)
|
featureFlag = FeatureFlags.isPocketSponsoredStoriesFeatureEnabled(appContext),
|
||||||
)
|
)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -1332,7 +1337,7 @@ class Settings(private val appContext: Context) : PreferencesHolder {
|
||||||
val pocketSponsoredStoriesProfileId by stringPreference(
|
val pocketSponsoredStoriesProfileId by stringPreference(
|
||||||
appContext.getPreferenceKey(R.string.pref_key_pocket_sponsored_stories_profile),
|
appContext.getPreferenceKey(R.string.pref_key_pocket_sponsored_stories_profile),
|
||||||
default = UUID.randomUUID().toString(),
|
default = UUID.randomUUID().toString(),
|
||||||
persistDefaultIfNotExists = true
|
persistDefaultIfNotExists = true,
|
||||||
)
|
)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -1358,7 +1363,7 @@ class Settings(private val appContext: Context) : PreferencesHolder {
|
||||||
var showUnifiedSearchFeature by lazyFeatureFlagPreference(
|
var showUnifiedSearchFeature by lazyFeatureFlagPreference(
|
||||||
key = appContext.getPreferenceKey(R.string.pref_key_show_unified_search),
|
key = appContext.getPreferenceKey(R.string.pref_key_show_unified_search),
|
||||||
default = { FxNimbus.features.unifiedSearch.value(appContext).enabled },
|
default = { FxNimbus.features.unifiedSearch.value(appContext).enabled },
|
||||||
featureFlag = FeatureFlags.unifiedSearchFeature
|
featureFlag = FeatureFlags.unifiedSearchFeature,
|
||||||
)
|
)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -1366,7 +1371,7 @@ class Settings(private val appContext: Context) : PreferencesHolder {
|
||||||
*/
|
*/
|
||||||
var homescreenBlocklist by stringSetPreference(
|
var homescreenBlocklist by stringSetPreference(
|
||||||
appContext.getPreferenceKey(R.string.pref_key_home_blocklist),
|
appContext.getPreferenceKey(R.string.pref_key_home_blocklist),
|
||||||
default = setOf()
|
default = setOf(),
|
||||||
)
|
)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -50,7 +50,7 @@ class TrackingProtectionPolicyFactoryTest {
|
||||||
|
|
||||||
val factory = TrackingProtectionPolicyFactory(
|
val factory = TrackingProtectionPolicyFactory(
|
||||||
mockSettings(useStrict = true),
|
mockSettings(useStrict = true),
|
||||||
testContext.resources
|
testContext.resources,
|
||||||
)
|
)
|
||||||
|
|
||||||
val privateOnly =
|
val privateOnly =
|
||||||
|
@ -72,7 +72,7 @@ class TrackingProtectionPolicyFactoryTest {
|
||||||
|
|
||||||
val factory = TrackingProtectionPolicyFactory(
|
val factory = TrackingProtectionPolicyFactory(
|
||||||
mockSettings(useStrict = false, useCustom = false),
|
mockSettings(useStrict = false, useCustom = false),
|
||||||
testContext.resources
|
testContext.resources,
|
||||||
)
|
)
|
||||||
|
|
||||||
val privateOnly =
|
val privateOnly =
|
||||||
|
@ -92,12 +92,12 @@ class TrackingProtectionPolicyFactoryTest {
|
||||||
fun `GIVEN custom policy WHEN should not block cookies THEN tracking policy should not block cookies`() {
|
fun `GIVEN custom policy WHEN should not block cookies THEN tracking policy should not block cookies`() {
|
||||||
val expected = TrackingProtectionPolicy.select(
|
val expected = TrackingProtectionPolicy.select(
|
||||||
cookiePolicy = TrackingProtectionPolicy.CookiePolicy.ACCEPT_ALL,
|
cookiePolicy = TrackingProtectionPolicy.CookiePolicy.ACCEPT_ALL,
|
||||||
trackingCategories = allTrackingCategories
|
trackingCategories = allTrackingCategories,
|
||||||
)
|
)
|
||||||
|
|
||||||
val factory = TrackingProtectionPolicyFactory(
|
val factory = TrackingProtectionPolicyFactory(
|
||||||
settingsForCustom(shouldBlockCookiesInCustom = false),
|
settingsForCustom(shouldBlockCookiesInCustom = false),
|
||||||
testContext.resources
|
testContext.resources,
|
||||||
)
|
)
|
||||||
|
|
||||||
val privateOnly =
|
val privateOnly =
|
||||||
|
@ -115,15 +115,15 @@ class TrackingProtectionPolicyFactoryTest {
|
||||||
fun `GIVEN custom policy WHEN cookie policy block all THEN tracking policy should have cookie policy allow none`() {
|
fun `GIVEN custom policy WHEN cookie policy block all THEN tracking policy should have cookie policy allow none`() {
|
||||||
val expected = TrackingProtectionPolicy.select(
|
val expected = TrackingProtectionPolicy.select(
|
||||||
cookiePolicy = TrackingProtectionPolicy.CookiePolicy.ACCEPT_NONE,
|
cookiePolicy = TrackingProtectionPolicy.CookiePolicy.ACCEPT_NONE,
|
||||||
trackingCategories = allTrackingCategories
|
trackingCategories = allTrackingCategories,
|
||||||
)
|
)
|
||||||
|
|
||||||
val factory = TrackingProtectionPolicyFactory(
|
val factory = TrackingProtectionPolicyFactory(
|
||||||
settingsForCustom(
|
settingsForCustom(
|
||||||
shouldBlockCookiesInCustom = true,
|
shouldBlockCookiesInCustom = true,
|
||||||
blockCookiesSelection = all
|
blockCookiesSelection = all,
|
||||||
),
|
),
|
||||||
testContext.resources
|
testContext.resources,
|
||||||
)
|
)
|
||||||
|
|
||||||
val privateOnly =
|
val privateOnly =
|
||||||
|
@ -141,15 +141,15 @@ class TrackingProtectionPolicyFactoryTest {
|
||||||
fun `GIVEN custom policy WHEN cookie policy social THEN tracking policy should have cookie policy allow non-trackers`() {
|
fun `GIVEN custom policy WHEN cookie policy social THEN tracking policy should have cookie policy allow non-trackers`() {
|
||||||
val expected = TrackingProtectionPolicy.select(
|
val expected = TrackingProtectionPolicy.select(
|
||||||
cookiePolicy = TrackingProtectionPolicy.CookiePolicy.ACCEPT_NON_TRACKERS,
|
cookiePolicy = TrackingProtectionPolicy.CookiePolicy.ACCEPT_NON_TRACKERS,
|
||||||
trackingCategories = allTrackingCategories
|
trackingCategories = allTrackingCategories,
|
||||||
)
|
)
|
||||||
|
|
||||||
val factory = TrackingProtectionPolicyFactory(
|
val factory = TrackingProtectionPolicyFactory(
|
||||||
settingsForCustom(
|
settingsForCustom(
|
||||||
shouldBlockCookiesInCustom = true,
|
shouldBlockCookiesInCustom = true,
|
||||||
blockCookiesSelection = social
|
blockCookiesSelection = social,
|
||||||
),
|
),
|
||||||
testContext.resources
|
testContext.resources,
|
||||||
)
|
)
|
||||||
|
|
||||||
val privateOnly =
|
val privateOnly =
|
||||||
|
@ -167,15 +167,15 @@ class TrackingProtectionPolicyFactoryTest {
|
||||||
fun `GIVEN custom policy WHEN cookie policy accept visited THEN tracking policy should have cookie policy allow visited`() {
|
fun `GIVEN custom policy WHEN cookie policy accept visited THEN tracking policy should have cookie policy allow visited`() {
|
||||||
val expected = TrackingProtectionPolicy.select(
|
val expected = TrackingProtectionPolicy.select(
|
||||||
cookiePolicy = TrackingProtectionPolicy.CookiePolicy.ACCEPT_VISITED,
|
cookiePolicy = TrackingProtectionPolicy.CookiePolicy.ACCEPT_VISITED,
|
||||||
trackingCategories = allTrackingCategories
|
trackingCategories = allTrackingCategories,
|
||||||
)
|
)
|
||||||
|
|
||||||
val factory = TrackingProtectionPolicyFactory(
|
val factory = TrackingProtectionPolicyFactory(
|
||||||
settingsForCustom(
|
settingsForCustom(
|
||||||
shouldBlockCookiesInCustom = true,
|
shouldBlockCookiesInCustom = true,
|
||||||
blockCookiesSelection = unvisited
|
blockCookiesSelection = unvisited,
|
||||||
),
|
),
|
||||||
testContext.resources
|
testContext.resources,
|
||||||
)
|
)
|
||||||
|
|
||||||
val privateOnly =
|
val privateOnly =
|
||||||
|
@ -193,15 +193,15 @@ class TrackingProtectionPolicyFactoryTest {
|
||||||
fun `GIVEN custom policy WHEN cookie policy block third party THEN tracking policy should have cookie policy allow first party`() {
|
fun `GIVEN custom policy WHEN cookie policy block third party THEN tracking policy should have cookie policy allow first party`() {
|
||||||
val expected = TrackingProtectionPolicy.select(
|
val expected = TrackingProtectionPolicy.select(
|
||||||
cookiePolicy = TrackingProtectionPolicy.CookiePolicy.ACCEPT_ONLY_FIRST_PARTY,
|
cookiePolicy = TrackingProtectionPolicy.CookiePolicy.ACCEPT_ONLY_FIRST_PARTY,
|
||||||
trackingCategories = allTrackingCategories
|
trackingCategories = allTrackingCategories,
|
||||||
)
|
)
|
||||||
|
|
||||||
val factory = TrackingProtectionPolicyFactory(
|
val factory = TrackingProtectionPolicyFactory(
|
||||||
settingsForCustom(
|
settingsForCustom(
|
||||||
shouldBlockCookiesInCustom = true,
|
shouldBlockCookiesInCustom = true,
|
||||||
blockCookiesSelection = thirdParty
|
blockCookiesSelection = thirdParty,
|
||||||
),
|
),
|
||||||
testContext.resources
|
testContext.resources,
|
||||||
)
|
)
|
||||||
|
|
||||||
val privateOnly =
|
val privateOnly =
|
||||||
|
@ -219,19 +219,21 @@ class TrackingProtectionPolicyFactoryTest {
|
||||||
fun `GIVEN custom policy WHEN cookie policy is total protection THEN tracking policy should have cookie policy to block cross-site cookies`() {
|
fun `GIVEN custom policy WHEN cookie policy is total protection THEN tracking policy should have cookie policy to block cross-site cookies`() {
|
||||||
val expected = TrackingProtectionPolicy.select(
|
val expected = TrackingProtectionPolicy.select(
|
||||||
cookiePolicy = TrackingProtectionPolicy.CookiePolicy.ACCEPT_FIRST_PARTY_AND_ISOLATE_OTHERS,
|
cookiePolicy = TrackingProtectionPolicy.CookiePolicy.ACCEPT_FIRST_PARTY_AND_ISOLATE_OTHERS,
|
||||||
trackingCategories = allTrackingCategories
|
trackingCategories = allTrackingCategories,
|
||||||
)
|
)
|
||||||
|
|
||||||
val factory = TrackingProtectionPolicyFactory(
|
val factory = TrackingProtectionPolicyFactory(
|
||||||
settingsForCustom(
|
settingsForCustom(
|
||||||
shouldBlockCookiesInCustom = true,
|
shouldBlockCookiesInCustom = true,
|
||||||
blockCookiesSelection = "total-protection"
|
blockCookiesSelection = "total-protection",
|
||||||
),
|
),
|
||||||
testContext.resources
|
testContext.resources,
|
||||||
)
|
)
|
||||||
|
|
||||||
val privateOnly = factory.createTrackingProtectionPolicy(normalMode = false, privateMode = true)
|
val privateOnly =
|
||||||
val normalOnly = factory.createTrackingProtectionPolicy(normalMode = true, privateMode = false)
|
factory.createTrackingProtectionPolicy(normalMode = false, privateMode = true)
|
||||||
|
val normalOnly =
|
||||||
|
factory.createTrackingProtectionPolicy(normalMode = true, privateMode = false)
|
||||||
val always = factory.createTrackingProtectionPolicy(normalMode = true, privateMode = true)
|
val always = factory.createTrackingProtectionPolicy(normalMode = true, privateMode = true)
|
||||||
|
|
||||||
expected.assertPolicyEquals(privateOnly, checkPrivacy = false)
|
expected.assertPolicyEquals(privateOnly, checkPrivacy = false)
|
||||||
|
@ -243,15 +245,15 @@ class TrackingProtectionPolicyFactoryTest {
|
||||||
fun `GIVEN custom policy WHEN cookie policy unrecognized THEN tracking policy should have cookie policy block all`() {
|
fun `GIVEN custom policy WHEN cookie policy unrecognized THEN tracking policy should have cookie policy block all`() {
|
||||||
val expected = TrackingProtectionPolicy.select(
|
val expected = TrackingProtectionPolicy.select(
|
||||||
cookiePolicy = TrackingProtectionPolicy.CookiePolicy.ACCEPT_NONE,
|
cookiePolicy = TrackingProtectionPolicy.CookiePolicy.ACCEPT_NONE,
|
||||||
trackingCategories = allTrackingCategories
|
trackingCategories = allTrackingCategories,
|
||||||
)
|
)
|
||||||
|
|
||||||
val factory = TrackingProtectionPolicyFactory(
|
val factory = TrackingProtectionPolicyFactory(
|
||||||
settingsForCustom(
|
settingsForCustom(
|
||||||
shouldBlockCookiesInCustom = true,
|
shouldBlockCookiesInCustom = true,
|
||||||
blockCookiesSelection = "some text!"
|
blockCookiesSelection = "some text!",
|
||||||
),
|
),
|
||||||
testContext.resources
|
testContext.resources,
|
||||||
)
|
)
|
||||||
|
|
||||||
val privateOnly =
|
val privateOnly =
|
||||||
|
@ -271,9 +273,9 @@ class TrackingProtectionPolicyFactoryTest {
|
||||||
TrackingProtectionPolicyFactory(
|
TrackingProtectionPolicyFactory(
|
||||||
settingsForCustom(
|
settingsForCustom(
|
||||||
shouldBlockCookiesInCustom = true,
|
shouldBlockCookiesInCustom = true,
|
||||||
blockCookiesSelection = it
|
blockCookiesSelection = it,
|
||||||
),
|
),
|
||||||
testContext.resources
|
testContext.resources,
|
||||||
)
|
)
|
||||||
.createTrackingProtectionPolicy(normalMode = true, privateMode = true)
|
.createTrackingProtectionPolicy(normalMode = true, privateMode = true)
|
||||||
}
|
}
|
||||||
|
@ -284,12 +286,12 @@ class TrackingProtectionPolicyFactoryTest {
|
||||||
val allFactories = listOf(
|
val allFactories = listOf(
|
||||||
TrackingProtectionPolicyFactory(
|
TrackingProtectionPolicyFactory(
|
||||||
mockSettings(useStrict = true),
|
mockSettings(useStrict = true),
|
||||||
testContext.resources
|
testContext.resources,
|
||||||
),
|
),
|
||||||
TrackingProtectionPolicyFactory(
|
TrackingProtectionPolicyFactory(
|
||||||
mockSettings(useStrict = false, useCustom = false),
|
mockSettings(useStrict = false, useCustom = false),
|
||||||
testContext.resources
|
testContext.resources,
|
||||||
)
|
),
|
||||||
)
|
)
|
||||||
|
|
||||||
allFactories.map {
|
allFactories.map {
|
||||||
|
@ -320,7 +322,7 @@ class TrackingProtectionPolicyFactoryTest {
|
||||||
fun `factory should follow global ETP settings by default`() {
|
fun `factory should follow global ETP settings by default`() {
|
||||||
var useETPFactory = TrackingProtectionPolicyFactory(
|
var useETPFactory = TrackingProtectionPolicyFactory(
|
||||||
mockSettings(useTrackingProtection = true),
|
mockSettings(useTrackingProtection = true),
|
||||||
testContext.resources
|
testContext.resources,
|
||||||
)
|
)
|
||||||
var policy = useETPFactory.createTrackingProtectionPolicy()
|
var policy = useETPFactory.createTrackingProtectionPolicy()
|
||||||
assertTrue(policy.useForPrivateSessions)
|
assertTrue(policy.useForPrivateSessions)
|
||||||
|
@ -328,7 +330,7 @@ class TrackingProtectionPolicyFactoryTest {
|
||||||
|
|
||||||
useETPFactory = TrackingProtectionPolicyFactory(
|
useETPFactory = TrackingProtectionPolicyFactory(
|
||||||
mockSettings(useTrackingProtection = false),
|
mockSettings(useTrackingProtection = false),
|
||||||
testContext.resources
|
testContext.resources,
|
||||||
)
|
)
|
||||||
policy = useETPFactory.createTrackingProtectionPolicy()
|
policy = useETPFactory.createTrackingProtectionPolicy()
|
||||||
assertEquals(policy, TrackingProtectionPolicy.none())
|
assertEquals(policy, TrackingProtectionPolicy.none())
|
||||||
|
@ -339,74 +341,74 @@ class TrackingProtectionPolicyFactoryTest {
|
||||||
val allSettings = listOf(
|
val allSettings = listOf(
|
||||||
settingsForCustom(
|
settingsForCustom(
|
||||||
shouldBlockCookiesInCustom = false,
|
shouldBlockCookiesInCustom = false,
|
||||||
blockTrackingContentInCustom = all
|
blockTrackingContentInCustom = all,
|
||||||
),
|
),
|
||||||
settingsForCustom(
|
settingsForCustom(
|
||||||
shouldBlockCookiesInCustom = true,
|
shouldBlockCookiesInCustom = true,
|
||||||
blockCookiesSelection = all,
|
blockCookiesSelection = all,
|
||||||
blockTrackingContentInCustom = all
|
blockTrackingContentInCustom = all,
|
||||||
),
|
),
|
||||||
settingsForCustom(
|
settingsForCustom(
|
||||||
shouldBlockCookiesInCustom = true,
|
shouldBlockCookiesInCustom = true,
|
||||||
blockCookiesSelection = all,
|
blockCookiesSelection = all,
|
||||||
blockTrackingContentInCustom = all
|
blockTrackingContentInCustom = all,
|
||||||
),
|
),
|
||||||
settingsForCustom(
|
settingsForCustom(
|
||||||
shouldBlockCookiesInCustom = true,
|
shouldBlockCookiesInCustom = true,
|
||||||
blockCookiesSelection = unvisited,
|
blockCookiesSelection = unvisited,
|
||||||
blockTrackingContentInCustom = all
|
blockTrackingContentInCustom = all,
|
||||||
),
|
),
|
||||||
settingsForCustom(
|
settingsForCustom(
|
||||||
shouldBlockCookiesInCustom = true,
|
shouldBlockCookiesInCustom = true,
|
||||||
blockCookiesSelection = thirdParty,
|
blockCookiesSelection = thirdParty,
|
||||||
blockTrackingContentInCustom = all
|
blockTrackingContentInCustom = all,
|
||||||
),
|
),
|
||||||
settingsForCustom(
|
settingsForCustom(
|
||||||
shouldBlockCookiesInCustom = true,
|
shouldBlockCookiesInCustom = true,
|
||||||
blockCookiesSelection = "some text!",
|
blockCookiesSelection = "some text!",
|
||||||
blockTrackingContentInCustom = all
|
blockTrackingContentInCustom = all,
|
||||||
)
|
),
|
||||||
)
|
)
|
||||||
|
|
||||||
val privateSettings = listOf(
|
val privateSettings = listOf(
|
||||||
settingsForCustom(
|
settingsForCustom(
|
||||||
shouldBlockCookiesInCustom = false,
|
shouldBlockCookiesInCustom = false,
|
||||||
blockTrackingContentInCustom = private
|
blockTrackingContentInCustom = private,
|
||||||
),
|
),
|
||||||
settingsForCustom(
|
settingsForCustom(
|
||||||
shouldBlockCookiesInCustom = true,
|
shouldBlockCookiesInCustom = true,
|
||||||
blockCookiesSelection = all,
|
blockCookiesSelection = all,
|
||||||
blockTrackingContentInCustom = private
|
blockTrackingContentInCustom = private,
|
||||||
),
|
),
|
||||||
settingsForCustom(
|
settingsForCustom(
|
||||||
shouldBlockCookiesInCustom = true,
|
shouldBlockCookiesInCustom = true,
|
||||||
blockCookiesSelection = all,
|
blockCookiesSelection = all,
|
||||||
blockTrackingContentInCustom = private
|
blockTrackingContentInCustom = private,
|
||||||
),
|
),
|
||||||
settingsForCustom(
|
settingsForCustom(
|
||||||
shouldBlockCookiesInCustom = true,
|
shouldBlockCookiesInCustom = true,
|
||||||
blockCookiesSelection = unvisited,
|
blockCookiesSelection = unvisited,
|
||||||
blockTrackingContentInCustom = private
|
blockTrackingContentInCustom = private,
|
||||||
),
|
),
|
||||||
settingsForCustom(
|
settingsForCustom(
|
||||||
shouldBlockCookiesInCustom = true,
|
shouldBlockCookiesInCustom = true,
|
||||||
blockCookiesSelection = thirdParty,
|
blockCookiesSelection = thirdParty,
|
||||||
blockTrackingContentInCustom = private
|
blockTrackingContentInCustom = private,
|
||||||
),
|
),
|
||||||
settingsForCustom(
|
settingsForCustom(
|
||||||
shouldBlockCookiesInCustom = true,
|
shouldBlockCookiesInCustom = true,
|
||||||
blockCookiesSelection = "some text!",
|
blockCookiesSelection = "some text!",
|
||||||
blockTrackingContentInCustom = private
|
blockTrackingContentInCustom = private,
|
||||||
)
|
),
|
||||||
)
|
)
|
||||||
|
|
||||||
allSettings.map {
|
allSettings.map {
|
||||||
TrackingProtectionPolicyFactory(
|
TrackingProtectionPolicyFactory(
|
||||||
it,
|
it,
|
||||||
testContext.resources
|
testContext.resources,
|
||||||
).createTrackingProtectionPolicy(
|
).createTrackingProtectionPolicy(
|
||||||
normalMode = true,
|
normalMode = true,
|
||||||
privateMode = true
|
privateMode = true,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
.forEach {
|
.forEach {
|
||||||
|
@ -417,10 +419,10 @@ class TrackingProtectionPolicyFactoryTest {
|
||||||
privateSettings.map {
|
privateSettings.map {
|
||||||
TrackingProtectionPolicyFactory(
|
TrackingProtectionPolicyFactory(
|
||||||
it,
|
it,
|
||||||
testContext.resources
|
testContext.resources,
|
||||||
).createTrackingProtectionPolicy(
|
).createTrackingProtectionPolicy(
|
||||||
normalMode = true,
|
normalMode = true,
|
||||||
privateMode = true
|
privateMode = true,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
.forEach {
|
.forEach {
|
||||||
|
@ -435,12 +437,12 @@ class TrackingProtectionPolicyFactoryTest {
|
||||||
TrackingProtectionPolicy.TrackingCategory.AD,
|
TrackingProtectionPolicy.TrackingCategory.AD,
|
||||||
TrackingProtectionPolicy.TrackingCategory.ANALYTICS,
|
TrackingProtectionPolicy.TrackingCategory.ANALYTICS,
|
||||||
TrackingProtectionPolicy.TrackingCategory.SOCIAL,
|
TrackingProtectionPolicy.TrackingCategory.SOCIAL,
|
||||||
TrackingProtectionPolicy.TrackingCategory.MOZILLA_SOCIAL
|
TrackingProtectionPolicy.TrackingCategory.MOZILLA_SOCIAL,
|
||||||
)
|
)
|
||||||
|
|
||||||
val expected = TrackingProtectionPolicy.select(
|
val expected = TrackingProtectionPolicy.select(
|
||||||
cookiePolicy = TrackingProtectionPolicy.CookiePolicy.ACCEPT_NONE,
|
cookiePolicy = TrackingProtectionPolicy.CookiePolicy.ACCEPT_NONE,
|
||||||
trackingCategories = defaultTrackingCategories
|
trackingCategories = defaultTrackingCategories,
|
||||||
)
|
)
|
||||||
|
|
||||||
val factory = TrackingProtectionPolicyFactory(
|
val factory = TrackingProtectionPolicyFactory(
|
||||||
|
@ -448,9 +450,9 @@ class TrackingProtectionPolicyFactoryTest {
|
||||||
shouldBlockCookiesInCustom = true,
|
shouldBlockCookiesInCustom = true,
|
||||||
blockTrackingContent = false,
|
blockTrackingContent = false,
|
||||||
blockFingerprinters = false,
|
blockFingerprinters = false,
|
||||||
blockCryptominers = false
|
blockCryptominers = false,
|
||||||
),
|
),
|
||||||
testContext.resources
|
testContext.resources,
|
||||||
)
|
)
|
||||||
val actual = factory.createTrackingProtectionPolicy(normalMode = true, privateMode = true)
|
val actual = factory.createTrackingProtectionPolicy(normalMode = true, privateMode = true)
|
||||||
|
|
||||||
|
@ -461,7 +463,7 @@ class TrackingProtectionPolicyFactoryTest {
|
||||||
fun `GIVEN custom policy WHEN all tracking policies THEN tracking policies should match all`() {
|
fun `GIVEN custom policy WHEN all tracking policies THEN tracking policies should match all`() {
|
||||||
val expected = TrackingProtectionPolicy.select(
|
val expected = TrackingProtectionPolicy.select(
|
||||||
cookiePolicy = TrackingProtectionPolicy.CookiePolicy.ACCEPT_NONE,
|
cookiePolicy = TrackingProtectionPolicy.CookiePolicy.ACCEPT_NONE,
|
||||||
trackingCategories = allTrackingCategories
|
trackingCategories = allTrackingCategories,
|
||||||
)
|
)
|
||||||
|
|
||||||
val factory = TrackingProtectionPolicyFactory(
|
val factory = TrackingProtectionPolicyFactory(
|
||||||
|
@ -469,9 +471,9 @@ class TrackingProtectionPolicyFactoryTest {
|
||||||
shouldBlockCookiesInCustom = true,
|
shouldBlockCookiesInCustom = true,
|
||||||
blockTrackingContent = true,
|
blockTrackingContent = true,
|
||||||
blockFingerprinters = true,
|
blockFingerprinters = true,
|
||||||
blockCryptominers = true
|
blockCryptominers = true,
|
||||||
),
|
),
|
||||||
testContext.resources
|
testContext.resources,
|
||||||
)
|
)
|
||||||
val actual = factory.createTrackingProtectionPolicy(normalMode = true, privateMode = true)
|
val actual = factory.createTrackingProtectionPolicy(normalMode = true, privateMode = true)
|
||||||
|
|
||||||
|
@ -485,12 +487,12 @@ class TrackingProtectionPolicyFactoryTest {
|
||||||
TrackingProtectionPolicy.TrackingCategory.ANALYTICS,
|
TrackingProtectionPolicy.TrackingCategory.ANALYTICS,
|
||||||
TrackingProtectionPolicy.TrackingCategory.SOCIAL,
|
TrackingProtectionPolicy.TrackingCategory.SOCIAL,
|
||||||
TrackingProtectionPolicy.TrackingCategory.MOZILLA_SOCIAL,
|
TrackingProtectionPolicy.TrackingCategory.MOZILLA_SOCIAL,
|
||||||
TrackingProtectionPolicy.TrackingCategory.FINGERPRINTING
|
TrackingProtectionPolicy.TrackingCategory.FINGERPRINTING,
|
||||||
)
|
)
|
||||||
|
|
||||||
val expected = TrackingProtectionPolicy.select(
|
val expected = TrackingProtectionPolicy.select(
|
||||||
cookiePolicy = TrackingProtectionPolicy.CookiePolicy.ACCEPT_NONE,
|
cookiePolicy = TrackingProtectionPolicy.CookiePolicy.ACCEPT_NONE,
|
||||||
trackingCategories = someTrackingCategories
|
trackingCategories = someTrackingCategories,
|
||||||
)
|
)
|
||||||
|
|
||||||
val factory = TrackingProtectionPolicyFactory(
|
val factory = TrackingProtectionPolicyFactory(
|
||||||
|
@ -499,9 +501,9 @@ class TrackingProtectionPolicyFactoryTest {
|
||||||
blockTrackingContent = false,
|
blockTrackingContent = false,
|
||||||
blockFingerprinters = true,
|
blockFingerprinters = true,
|
||||||
blockCryptominers = false,
|
blockCryptominers = false,
|
||||||
blockRedirectTrackers = true
|
blockRedirectTrackers = true,
|
||||||
),
|
),
|
||||||
testContext.resources
|
testContext.resources,
|
||||||
)
|
)
|
||||||
val actual = factory.createTrackingProtectionPolicy(normalMode = true, privateMode = true)
|
val actual = factory.createTrackingProtectionPolicy(normalMode = true, privateMode = true)
|
||||||
|
|
||||||
|
@ -513,12 +515,12 @@ class TrackingProtectionPolicyFactoryTest {
|
||||||
val expected = TrackingProtectionPolicy.select(
|
val expected = TrackingProtectionPolicy.select(
|
||||||
cookiePolicy = TrackingProtectionPolicy.CookiePolicy.ACCEPT_NONE,
|
cookiePolicy = TrackingProtectionPolicy.CookiePolicy.ACCEPT_NONE,
|
||||||
trackingCategories = allTrackingCategories,
|
trackingCategories = allTrackingCategories,
|
||||||
cookiePurging = true
|
cookiePurging = true,
|
||||||
)
|
)
|
||||||
|
|
||||||
val factory = TrackingProtectionPolicyFactory(
|
val factory = TrackingProtectionPolicyFactory(
|
||||||
settingsForCustom(shouldBlockCookiesInCustom = true),
|
settingsForCustom(shouldBlockCookiesInCustom = true),
|
||||||
testContext.resources
|
testContext.resources,
|
||||||
)
|
)
|
||||||
|
|
||||||
val privateOnly =
|
val privateOnly =
|
||||||
|
@ -539,9 +541,9 @@ class TrackingProtectionPolicyFactoryTest {
|
||||||
val factory = TrackingProtectionPolicyFactory(
|
val factory = TrackingProtectionPolicyFactory(
|
||||||
mockSettings(
|
mockSettings(
|
||||||
useStrict = true,
|
useStrict = true,
|
||||||
useTrackingProtection = true
|
useTrackingProtection = true,
|
||||||
),
|
),
|
||||||
testContext.resources
|
testContext.resources,
|
||||||
)
|
)
|
||||||
|
|
||||||
val privateOnly =
|
val privateOnly =
|
||||||
|
@ -563,9 +565,9 @@ class TrackingProtectionPolicyFactoryTest {
|
||||||
mockSettings(
|
mockSettings(
|
||||||
useStrict = false,
|
useStrict = false,
|
||||||
useCustom = false,
|
useCustom = false,
|
||||||
useTrackingProtection = true
|
useTrackingProtection = true,
|
||||||
),
|
),
|
||||||
testContext.resources
|
testContext.resources,
|
||||||
)
|
)
|
||||||
|
|
||||||
val privateOnly =
|
val privateOnly =
|
||||||
|
@ -582,9 +584,8 @@ class TrackingProtectionPolicyFactoryTest {
|
||||||
private fun mockSettings(
|
private fun mockSettings(
|
||||||
useStrict: Boolean = false,
|
useStrict: Boolean = false,
|
||||||
useCustom: Boolean = false,
|
useCustom: Boolean = false,
|
||||||
useTrackingProtection: Boolean = false
|
useTrackingProtection: Boolean = false,
|
||||||
): Settings = mockk {
|
): Settings = mockk {
|
||||||
every { enabledTotalCookieProtection } returns false
|
|
||||||
every { useStrictTrackingProtection } returns useStrict
|
every { useStrictTrackingProtection } returns useStrict
|
||||||
every { useCustomTrackingProtection } returns useCustom
|
every { useCustomTrackingProtection } returns useCustom
|
||||||
every { shouldUseTrackingProtection } returns useTrackingProtection
|
every { shouldUseTrackingProtection } returns useTrackingProtection
|
||||||
|
@ -598,9 +599,8 @@ class TrackingProtectionPolicyFactoryTest {
|
||||||
blockTrackingContent: Boolean = true,
|
blockTrackingContent: Boolean = true,
|
||||||
blockFingerprinters: Boolean = true,
|
blockFingerprinters: Boolean = true,
|
||||||
blockCryptominers: Boolean = true,
|
blockCryptominers: Boolean = true,
|
||||||
blockRedirectTrackers: Boolean = true
|
blockRedirectTrackers: Boolean = true,
|
||||||
): Settings = mockSettings(useStrict = false, useCustom = true).apply {
|
): Settings = mockSettings(useStrict = false, useCustom = true).apply {
|
||||||
|
|
||||||
every { blockTrackingContentSelectionInCustomTrackingProtection } returns blockTrackingContentInCustom
|
every { blockTrackingContentSelectionInCustomTrackingProtection } returns blockTrackingContentInCustom
|
||||||
|
|
||||||
every { blockCookiesInCustomTrackingProtection } returns shouldBlockCookiesInCustom
|
every { blockCookiesInCustomTrackingProtection } returns shouldBlockCookiesInCustom
|
||||||
|
@ -613,7 +613,7 @@ class TrackingProtectionPolicyFactoryTest {
|
||||||
|
|
||||||
private fun TrackingProtectionPolicy.assertPolicyEquals(
|
private fun TrackingProtectionPolicy.assertPolicyEquals(
|
||||||
actual: TrackingProtectionPolicy,
|
actual: TrackingProtectionPolicy,
|
||||||
checkPrivacy: Boolean
|
checkPrivacy: Boolean,
|
||||||
) {
|
) {
|
||||||
assertEquals(this.cookiePolicy, actual.cookiePolicy)
|
assertEquals(this.cookiePolicy, actual.cookiePolicy)
|
||||||
assertEquals(this.strictSocialTrackingProtection, actual.strictSocialTrackingProtection)
|
assertEquals(this.strictSocialTrackingProtection, actual.strictSocialTrackingProtection)
|
||||||
|
@ -640,6 +640,6 @@ class TrackingProtectionPolicyFactoryTest {
|
||||||
TrackingProtectionPolicy.TrackingCategory.MOZILLA_SOCIAL,
|
TrackingProtectionPolicy.TrackingCategory.MOZILLA_SOCIAL,
|
||||||
TrackingProtectionPolicy.TrackingCategory.SCRIPTS_AND_SUB_RESOURCES,
|
TrackingProtectionPolicy.TrackingCategory.SCRIPTS_AND_SUB_RESOURCES,
|
||||||
TrackingProtectionPolicy.TrackingCategory.FINGERPRINTING,
|
TrackingProtectionPolicy.TrackingCategory.FINGERPRINTING,
|
||||||
TrackingProtectionPolicy.TrackingCategory.CRYPTOMINING
|
TrackingProtectionPolicy.TrackingCategory.CRYPTOMINING,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
|
@ -219,13 +219,6 @@ features:
|
||||||
value:
|
value:
|
||||||
enabled: false
|
enabled: false
|
||||||
|
|
||||||
engine-settings:
|
|
||||||
description: Contains a set of settings for controlling the web engine configurations.
|
|
||||||
variables:
|
|
||||||
tabs-prioritization-enabled:
|
|
||||||
description: If true, enables tabs prioritization feature.
|
|
||||||
type: Boolean
|
|
||||||
default: true
|
|
||||||
types:
|
types:
|
||||||
objects:
|
objects:
|
||||||
MessageData:
|
MessageData:
|
||||||
|
|
Loading…
Reference in New Issue