2
0
mirror of https://github.com/fork-maintainers/iceraven-browser synced 2024-11-11 13:11:01 +00:00

No issue: Removes feature flags for delete data (#5738)

This commit is contained in:
Sawyer Blatz 2019-10-02 10:43:37 -07:00 committed by GitHub
parent 060e915d2b
commit eb3c9f86e2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 6 additions and 59 deletions

View File

@ -45,17 +45,6 @@ object FeatureFlags {
*/
val etpCategories = nightly or debug
/**
* Granular data deletion provides additional choices on the Delete Browsing Data
* setting screen for cookies, cached images and files, and site permissions.
*/
val granularDataDeletion = nightly or debug
/**
* 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
*/

View File

@ -30,7 +30,6 @@ import mozilla.components.concept.sync.OAuthAccount
import mozilla.components.concept.sync.Profile
import org.mozilla.fenix.BrowserDirection
import org.mozilla.fenix.Config
import org.mozilla.fenix.FeatureFlags
import org.mozilla.fenix.FenixApplication
import org.mozilla.fenix.HomeActivity
import org.mozilla.fenix.R
@ -105,14 +104,6 @@ class SettingsFragment : PreferenceFragmentCompat(), AccountObserver {
isVisible = false
}
}
if (FeatureFlags.deleteDataOnQuit) {
findPreference<Preference>(
getPreferenceKey(R.string.pref_key_delete_browsing_data_on_quit_preference)
)?.apply {
isVisible = true
}
}
}
override fun onCreatePreferences(savedInstanceState: Bundle?, rootKey: String?) {

View File

@ -10,7 +10,6 @@ import kotlinx.coroutines.delay
import kotlinx.coroutines.withContext
import mozilla.components.concept.engine.Engine
import mozilla.components.feature.tab.collections.TabCollection
import org.mozilla.fenix.FeatureFlags
import org.mozilla.fenix.ext.components
import kotlin.coroutines.CoroutineContext
@ -36,14 +35,7 @@ class DefaultDeleteBrowsingDataController(
}
override suspend fun deleteBrowsingData() {
if (FeatureFlags.granularDataDeletion) {
deleteHistoryAndDOMStorages()
} else {
withContext(coroutineContext) {
context.components.core.engine.clearData(Engine.BrowsingData.all())
}
context.components.core.historyStorage.deleteEverything()
}
deleteHistoryAndDOMStorages()
}
override suspend fun deleteHistoryAndDOMStorages() {

View File

@ -22,7 +22,6 @@ import kotlinx.coroutines.launch
import mozilla.components.browser.session.Session
import mozilla.components.browser.session.SessionManager
import mozilla.components.feature.tab.collections.TabCollection
import org.mozilla.fenix.FeatureFlags
import org.mozilla.fenix.R
import org.mozilla.fenix.components.FenixSnackbar
import org.mozilla.fenix.components.metrics.Event
@ -61,16 +60,7 @@ class DeleteBrowsingDataFragment : Fragment() {
})
}
if (!FeatureFlags.granularDataDeletion) {
// Disabling the disabled state until we have APIs to decide
// if there is data to delete for all categories
getCheckboxes().forEach {
it.onCheckListener = { _ -> updateCheckboxState() }
}
} else {
// Otherwise, all checkboxes should default to checked state
getCheckboxes().forEach { it.isChecked = true }
}
getCheckboxes().forEach { it.isChecked = true }
view.delete_data?.setOnClickListener {
askToDelete()
@ -161,7 +151,7 @@ class DeleteBrowsingDataFragment : Fragment() {
.setText(resources.getString(R.string.preferences_delete_browsing_data_snackbar))
.show()
if (popAfter || FeatureFlags.granularDataDeletion) viewLifecycleOwner.lifecycleScope.launch(
if (popAfter) viewLifecycleOwner.lifecycleScope.launch(
Dispatchers.Main
) {
findNavController().popBackStack(R.id.homeFragment, false)
@ -177,13 +167,6 @@ class DeleteBrowsingDataFragment : Fragment() {
updateSitePermissions()
}
private fun updateCheckboxState() {
val enabled = getCheckboxes().any { it.isChecked }
view?.delete_data?.isEnabled = enabled
view?.delete_data?.alpha = if (enabled) ENABLED_ALPHA else DISABLED_ALPHA
}
private fun updateTabCount() {
view?.open_tabs_item?.apply {
val openTabs = requireComponents.core.sessionManager.sessions.size
@ -191,7 +174,6 @@ class DeleteBrowsingDataFragment : Fragment() {
R.string.preferences_delete_browsing_data_tabs_subtitle,
openTabs
)
if (!FeatureFlags.granularDataDeletion) isEnabled = openTabs > 0
}
}
@ -207,7 +189,6 @@ class DeleteBrowsingDataFragment : Fragment() {
R.string.preferences_delete_browsing_data_browsing_data_subtitle,
historyCount
)
if (!FeatureFlags.granularDataDeletion) isEnabled = historyCount > 0
}
}
}
@ -226,7 +207,6 @@ class DeleteBrowsingDataFragment : Fragment() {
R.string.preferences_delete_browsing_data_collections_subtitle,
collectionsCount
)
if (!FeatureFlags.granularDataDeletion) isEnabled = collectionsCount > 0
}
}
}
@ -246,18 +226,14 @@ class DeleteBrowsingDataFragment : Fragment() {
private fun getCheckboxes(): List<DeleteBrowsingDataItem> {
val fragmentView = view!!
val originalList = listOf(
return listOf(
fragmentView.open_tabs_item,
fragmentView.browsing_data_item,
fragmentView.collections_item
)
@Suppress("ConstantConditionIf")
val granularList = if (FeatureFlags.granularDataDeletion) listOf(
fragmentView.collections_item,
fragmentView.cookies_item,
fragmentView.cached_files_item,
fragmentView.site_permissions_item
) else emptyList()
return originalList + granularList
)
}
companion object {

View File

@ -75,7 +75,6 @@
android:key="@string/pref_key_delete_browsing_data"
android:title="@string/preferences_delete_browsing_data" />
<androidx.preference.Preference
app:isPreferenceVisible="false"
android:icon="@drawable/ic_exit"
android:key="@string/pref_key_delete_browsing_data_on_quit_preference"
android:title="@string/preferences_delete_browsing_data_on_quit" />