1
0
Fork 0

For #5679: Hides autoplay behind feature flag (#5685)

master
Sawyer Blatz 2019-09-30 12:01:04 -07:00 committed by GitHub
parent 9729fd494e
commit c8af16bd47
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 24 additions and 3 deletions

View File

@ -55,4 +55,9 @@ object FeatureFlags {
* Gives option in Settings to Delete Browsing Data on new menu option Quit
*/
val deleteDataOnQuit = nightly or debug
/**
* Gives option in Settings to disable auto play media
*/
val autoPlayMedia = nightly or debug
}

View File

@ -10,6 +10,7 @@ import androidx.navigation.Navigation
import androidx.preference.Preference
import androidx.preference.Preference.OnPreferenceClickListener
import androidx.preference.PreferenceFragmentCompat
import org.mozilla.fenix.FeatureFlags
import org.mozilla.fenix.R
import org.mozilla.fenix.ext.getPreferenceKey
import org.mozilla.fenix.ext.settings
@ -36,6 +37,18 @@ class SitePermissionsFragment : PreferenceFragmentCompat() {
private fun setupPreferences() {
bindCategoryPhoneFeatures()
bindExceptions()
if (FeatureFlags.autoPlayMedia) {
displayAutoplayPreference()
}
}
private fun displayAutoplayPreference() {
findPreference<Preference>(
getPreferenceKey(R.string.pref_key_browser_feature_autoplay)
)?.apply {
isVisible = true
}
}
private fun bindExceptions() {

View File

@ -20,6 +20,7 @@ import mozilla.components.support.ktx.android.content.longPreference
import mozilla.components.support.ktx.android.content.stringPreference
import org.mozilla.fenix.BuildConfig
import org.mozilla.fenix.Config
import org.mozilla.fenix.FeatureFlags
import org.mozilla.fenix.R
import org.mozilla.fenix.components.metrics.MozillaProductDetector
import org.mozilla.fenix.ext.getPreferenceKey
@ -118,9 +119,10 @@ class Settings private constructor(
default = true
)
// If autoPlayMedia is flagged OFF, default to true here
val isAutoPlayEnabled = getSitePermissionsPhoneFeatureAction(
PhoneFeature.AUTOPLAY, Action.BLOCKED
) != Action.BLOCKED
) != Action.BLOCKED || !FeatureFlags.autoPlayMedia
private var trackingProtectionOnboardingShownThisSession = false

View File

@ -9,7 +9,8 @@
android:icon="@drawable/ic_autoplay_enabled"
android:key="@string/pref_key_browser_feature_autoplay"
android:title="@string/preference_browser_feature_autoplay"
android:summary="@string/preference_option_autoplay_blocked"/>
android:summary="@string/preference_option_autoplay_blocked"
app:isPreferenceVisible="false"/>
<androidx.preference.Preference
android:icon="@drawable/ic_camera_enabled"

File diff suppressed because one or more lines are too long