improved preference and tracking protection handling
This commit is contained in:
+10
-2
@@ -67,8 +67,16 @@ object EngineProvider {
|
||||
}
|
||||
)
|
||||
|
||||
contentBlocking.queryParameterStrippingAllowList(components.contentBlocking.queryParameterStrippingAllowList)
|
||||
contentBlocking.queryParameterStrippingStripList(components.contentBlocking.queryParameterStrippingStripList)
|
||||
if (components.contentBlocking.queryParameterStrippingAllowList.isNotEmpty()) {
|
||||
contentBlocking.queryParameterStrippingAllowList(
|
||||
components.contentBlocking.queryParameterStrippingAllowList,
|
||||
)
|
||||
}
|
||||
if (components.contentBlocking.queryParameterStrippingStripList.isNotEmpty()) {
|
||||
contentBlocking.queryParameterStrippingStripList(
|
||||
components.contentBlocking.queryParameterStrippingStripList,
|
||||
)
|
||||
}
|
||||
|
||||
// if (isCrashReportActive) {
|
||||
// builder.crashHandler(CrashHandlerService::class.java)
|
||||
|
||||
+5
-3
@@ -44,6 +44,8 @@ import java.io.File
|
||||
import java.util.concurrent.TimeUnit
|
||||
|
||||
private const val HISTORY_METADATA_MAX_AGE_IN_MS = 14L * 24 * 60 * 60 * 1000 // 14 days
|
||||
private const val DEFAULT_QUERY_PARAMETER_STRIPPING_STRIP_LIST =
|
||||
"__hsfp __hssc __hstc __s _bhlid _branch_match_id _branch_referrer _gl _hsenc _kx _openstat at_recipient_id at_recipient_list bbeml bsft_clkid bsft_uid dclid et_rid fb_action_ids fb_comment_id fbclid gbraid gclid guce_referrer guce_referrer_sig hsCtaTracking igshid irclickid mc_eid mkt_tok ml_subscriber ml_subscriber_hash msclkid mtm_cid oft_c oft_ck oft_d oft_id oft_ids oft_k oft_lk oft_sk oly_anon_id oly_enc_id pk_cid rb_clickid s_cid sc_customer sc_eh sc_uid sms_click sms_source sms_uph srsltid ss_email_id syclid ttclid twclid unicorn_click_id vero_conv vero_id vgo_ee wbraid wickedid yclid ymclid ysclid"
|
||||
|
||||
object GlobalComponents {
|
||||
private var _components: Components? = null
|
||||
@@ -281,10 +283,10 @@ object GlobalComponents {
|
||||
}
|
||||
|
||||
val contentBlocking = ContentBlocking(
|
||||
queryParameterStripping = QueryParameterStripping.DISABLED,
|
||||
queryParameterStripping = QueryParameterStripping.ENABLED,
|
||||
queryParameterStrippingAllowList = "",
|
||||
queryParameterStrippingStripList = "",
|
||||
bounceTrackingProtectionMode = BounceTrackingProtectionMode.DISABLED,
|
||||
queryParameterStrippingStripList = DEFAULT_QUERY_PARAMETER_STRIPPING_STRIP_LIST,
|
||||
bounceTrackingProtectionMode = BounceTrackingProtectionMode.ENABLED,
|
||||
)
|
||||
|
||||
setUp(
|
||||
|
||||
+41
-2
@@ -11,6 +11,7 @@ import androidx.preference.PreferenceManager
|
||||
import eu.weblibre.flutter_mozilla_components.GlobalComponents
|
||||
import eu.weblibre.flutter_mozilla_components.R
|
||||
import eu.weblibre.flutter_mozilla_components.pigeons.AppLinksMode
|
||||
import eu.weblibre.flutter_mozilla_components.pigeons.BounceTrackingProtectionMode as PigeonBounceTrackingProtectionMode
|
||||
import eu.weblibre.flutter_mozilla_components.pigeons.ColorScheme
|
||||
import eu.weblibre.flutter_mozilla_components.pigeons.CookieBannerHandlingMode
|
||||
import eu.weblibre.flutter_mozilla_components.pigeons.CustomCookiePolicy
|
||||
@@ -31,6 +32,41 @@ import mozilla.components.feature.addons.logger
|
||||
import mozilla.components.feature.session.SettingsUseCases
|
||||
import mozilla.components.feature.session.TrackingProtectionUseCases
|
||||
|
||||
internal fun PigeonBounceTrackingProtectionMode.toEngineBounceTrackingProtectionMode():
|
||||
EngineSession.BounceTrackingProtectionMode =
|
||||
when (this) {
|
||||
PigeonBounceTrackingProtectionMode.ENABLED ->
|
||||
EngineSession.BounceTrackingProtectionMode.ENABLED
|
||||
PigeonBounceTrackingProtectionMode.DISABLED ->
|
||||
EngineSession.BounceTrackingProtectionMode.DISABLED
|
||||
PigeonBounceTrackingProtectionMode.ENABLED_STANDBY ->
|
||||
EngineSession.BounceTrackingProtectionMode.ENABLED_STANDBY
|
||||
PigeonBounceTrackingProtectionMode.ENABLED_DRY_RUN ->
|
||||
EngineSession.BounceTrackingProtectionMode.ENABLED_DRY_RUN
|
||||
}
|
||||
|
||||
internal fun TrackingProtectionPolicy.withBounceTrackingProtectionMode(
|
||||
bounceTrackingProtectionMode: PigeonBounceTrackingProtectionMode,
|
||||
): TrackingProtectionPolicy {
|
||||
val updatedPolicy = TrackingProtectionPolicy.select(
|
||||
trackingCategories = trackingCategories,
|
||||
cookiePolicy = cookiePolicy,
|
||||
cookiePolicyPrivateMode = cookiePolicyPrivateMode,
|
||||
strictSocialTrackingProtection = strictSocialTrackingProtection,
|
||||
cookiePurging = cookiePurging,
|
||||
bounceTrackingProtectionMode =
|
||||
bounceTrackingProtectionMode.toEngineBounceTrackingProtectionMode(),
|
||||
allowListBaselineTrackingProtection = allowListBaselineTrackingProtection,
|
||||
allowListConvenienceTrackingProtection = allowListConvenienceTrackingProtection,
|
||||
)
|
||||
|
||||
return when {
|
||||
useForPrivateSessions && !useForRegularSessions -> updatedPolicy.forPrivateSessionsOnly()
|
||||
!useForPrivateSessions && useForRegularSessions -> updatedPolicy.forRegularSessionsOnly()
|
||||
else -> updatedPolicy
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Implementation of GeckoEngineSettingsApi that manages engine-specific settings
|
||||
*/
|
||||
@@ -218,8 +254,11 @@ class GeckoEngineSettingsApiImpl : GeckoEngineSettingsApi {
|
||||
}
|
||||
components.core.engineSettings.queryParameterStrippingAllowList = settings.contentBlocking.queryParameterStrippingAllowList
|
||||
components.core.engineSettings.queryParameterStrippingStripList = settings.contentBlocking.queryParameterStrippingStripList
|
||||
|
||||
//TODO: Add bounce tracking protection when available
|
||||
components.core.engineSettings.trackingProtectionPolicy =
|
||||
(components.core.engineSettings.trackingProtectionPolicy
|
||||
?: TrackingProtectionPolicy.select()).withBounceTrackingProtectionMode(
|
||||
settings.contentBlocking.bounceTrackingProtectionMode,
|
||||
)
|
||||
}
|
||||
if(settings.enterpriseRootsEnabled != null) {
|
||||
components.core.engineSettings.enterpriseRootsEnabled = settings.enterpriseRootsEnabled;
|
||||
|
||||
Reference in New Issue
Block a user