|
|
|
@ -4,8 +4,10 @@
|
|
|
|
|
|
|
|
|
|
package org.mozilla.fenix.helpers
|
|
|
|
|
|
|
|
|
|
import android.util.Log
|
|
|
|
|
import org.mozilla.fenix.R
|
|
|
|
|
import org.mozilla.fenix.ext.getPreferenceKey
|
|
|
|
|
import org.mozilla.fenix.helpers.Constants.TAG
|
|
|
|
|
import org.mozilla.fenix.helpers.ETPPolicy.CUSTOM
|
|
|
|
|
import org.mozilla.fenix.helpers.ETPPolicy.STANDARD
|
|
|
|
|
import org.mozilla.fenix.helpers.ETPPolicy.STRICT
|
|
|
|
@ -68,11 +70,15 @@ class FeatureSettingsHelperDelegate() : FeatureSettingsHelper {
|
|
|
|
|
override var composeTopSitesEnabled: Boolean by updatedFeatureFlags::composeTopSitesEnabled
|
|
|
|
|
|
|
|
|
|
override fun applyFlagUpdates() {
|
|
|
|
|
Log.i(TAG, "applyFlagUpdates: Trying to apply the updated feature flags: $updatedFeatureFlags")
|
|
|
|
|
applyFeatureFlags(updatedFeatureFlags)
|
|
|
|
|
Log.i(TAG, "applyFlagUpdates: Applied the updated feature flags: $updatedFeatureFlags")
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
override fun resetAllFeatureFlags() {
|
|
|
|
|
Log.i(TAG, "resetAllFeatureFlags: Trying to reset the feature flags to: $initialFeatureFlags")
|
|
|
|
|
applyFeatureFlags(initialFeatureFlags)
|
|
|
|
|
Log.i(TAG, "resetAllFeatureFlags: Performed feature flags reset to: $initialFeatureFlags")
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
override var isDeleteSitePermissionsEnabled: Boolean by updatedFeatureFlags::isDeleteSitePermissionsEnabled
|
|
|
|
@ -122,9 +128,14 @@ internal fun getETPPolicy(settings: Settings): ETPPolicy {
|
|
|
|
|
|
|
|
|
|
private fun setETPPolicy(policy: ETPPolicy) {
|
|
|
|
|
when (policy) {
|
|
|
|
|
STRICT -> settings.setStrictETP()
|
|
|
|
|
STRICT -> {
|
|
|
|
|
Log.i(TAG, "setETPPolicy: Trying to set ETP policy to: \"Strict\"")
|
|
|
|
|
settings.setStrictETP()
|
|
|
|
|
Log.i(TAG, "setETPPolicy: ETP policy was set to: \"Strict\"")
|
|
|
|
|
}
|
|
|
|
|
// The following two cases update ETP in the same way "setStrictETP" does.
|
|
|
|
|
STANDARD -> {
|
|
|
|
|
Log.i(TAG, "setETPPolicy: Trying to set ETP policy to: \"Standard\"")
|
|
|
|
|
settings.preferences.edit()
|
|
|
|
|
.putBoolean(
|
|
|
|
|
appContext.getPreferenceKey(R.string.pref_key_tracking_protection_strict_default),
|
|
|
|
@ -139,8 +150,10 @@ private fun setETPPolicy(policy: ETPPolicy) {
|
|
|
|
|
true,
|
|
|
|
|
)
|
|
|
|
|
.commit()
|
|
|
|
|
Log.i(TAG, "setETPPolicy: ETP policy was set to: \"Standard\"")
|
|
|
|
|
}
|
|
|
|
|
CUSTOM -> {
|
|
|
|
|
Log.i(TAG, "setETPPolicy: Trying to set ETP policy to: \"Custom\"")
|
|
|
|
|
settings.preferences.edit()
|
|
|
|
|
.putBoolean(
|
|
|
|
|
appContext.getPreferenceKey(R.string.pref_key_tracking_protection_strict_default),
|
|
|
|
@ -155,19 +168,23 @@ private fun setETPPolicy(policy: ETPPolicy) {
|
|
|
|
|
true,
|
|
|
|
|
)
|
|
|
|
|
.commit()
|
|
|
|
|
Log.i(TAG, "setETPPolicy: ETP policy was set to: \"Custom\"")
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private fun getHomeOnboardingVersion(): Int {
|
|
|
|
|
Log.i(TAG, "getHomeOnboardingVersion: Trying to get the onboarding version")
|
|
|
|
|
return FenixOnboarding(appContext)
|
|
|
|
|
.preferences
|
|
|
|
|
.getInt(FenixOnboarding.LAST_VERSION_ONBOARDING_KEY, 0)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private fun setHomeOnboardingVersion(version: Int) {
|
|
|
|
|
Log.i(TAG, "setHomeOnboardingVersion: Trying to set the onboarding version to: $version")
|
|
|
|
|
FenixOnboarding(appContext)
|
|
|
|
|
.preferences.edit()
|
|
|
|
|
.putInt(FenixOnboarding.LAST_VERSION_ONBOARDING_KEY, version)
|
|
|
|
|
.commit()
|
|
|
|
|
Log.i(TAG, "setHomeOnboardingVersion: Onboarding version was set to: $version")
|
|
|
|
|
}
|
|
|
|
|