Commit 08cce8cf authored by Kaaira Gupta's avatar Kaaira Gupta Committed by Emily Kager
Browse files

for #7421 :removed collection from clear browsing history

parent ffc441f1
......@@ -6,10 +6,8 @@ package org.mozilla.fenix.settings.deletebrowsingdata
import android.content.Context
import kotlinx.coroutines.Dispatchers
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.ext.components
import kotlin.coroutines.CoroutineContext
......@@ -17,7 +15,6 @@ interface DeleteBrowsingDataController {
suspend fun deleteTabs()
suspend fun deleteBrowsingData()
suspend fun deleteHistoryAndDOMStorages()
suspend fun deleteCollections(collections: List<TabCollection>)
suspend fun deleteCookies()
suspend fun deleteCachedFiles()
suspend fun deleteSitePermissions()
......@@ -45,14 +42,6 @@ class DefaultDeleteBrowsingDataController(
context.components.core.historyStorage.deleteEverything()
}
override suspend fun deleteCollections(collections: List<TabCollection>) {
while (context.components.core.tabCollectionStorage.getTabCollectionsCount() != collections.size) {
delay(DELAY_IN_MILLIS)
}
collections.forEach { context.components.core.tabCollectionStorage.removeCollection(it) }
}
override suspend fun deleteCookies() {
withContext(coroutineContext) {
context.components.core.engine.clearData(
......@@ -80,8 +69,4 @@ class DefaultDeleteBrowsingDataController(
}
context.components.core.permissionStorage.deleteAllSitePermissions()
}
companion object {
private const val DELAY_IN_MILLIS = 500L
}
}
......@@ -9,7 +9,6 @@ import android.os.Bundle
import android.view.View
import androidx.appcompat.app.AlertDialog
import androidx.fragment.app.Fragment
import androidx.lifecycle.Observer
import androidx.lifecycle.lifecycleScope
import androidx.navigation.fragment.findNavController
import kotlinx.android.synthetic.main.fragment_delete_browsing_data.*
......@@ -18,7 +17,6 @@ import kotlinx.coroutines.Dispatchers
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.R
import org.mozilla.fenix.components.FenixSnackbar
import org.mozilla.fenix.components.metrics.Event
......@@ -28,7 +26,6 @@ import org.mozilla.fenix.ext.showToolbar
@SuppressWarnings("TooManyFunctions")
class DeleteBrowsingDataFragment : Fragment(R.layout.fragment_delete_browsing_data) {
private lateinit var sessionObserver: SessionManager.Observer
private var tabCollections: List<TabCollection> = listOf()
private lateinit var controller: DeleteBrowsingDataController
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
......@@ -45,12 +42,6 @@ class DeleteBrowsingDataFragment : Fragment(R.layout.fragment_delete_browsing_da
}
requireComponents.core.sessionManager.register(sessionObserver, owner = this)
requireComponents.core.tabCollectionStorage.apply {
getCollections().observe(this@DeleteBrowsingDataFragment, Observer {
this@DeleteBrowsingDataFragment.tabCollections = it
})
}
getCheckboxes().forEach {
it.onCheckListener = { _ -> updateDeleteButton() }
}
......@@ -111,7 +102,6 @@ class DeleteBrowsingDataFragment : Fragment(R.layout.fragment_delete_browsing_da
when (i) {
OPEN_TABS_INDEX -> controller.deleteTabs()
HISTORY_INDEX -> controller.deleteBrowsingData()
COLLECTIONS_INDEX -> controller.deleteCollections(tabCollections)
COOKIES_INDEX -> controller.deleteCookies()
CACHED_INDEX -> controller.deleteCachedFiles()
PERMS_INDEX -> controller.deleteSitePermissions()
......@@ -165,7 +155,6 @@ class DeleteBrowsingDataFragment : Fragment(R.layout.fragment_delete_browsing_da
private fun updateItemCounts() {
updateTabCount()
updateHistoryCount()
updateCollectionsCount()
updateCookies()
updateCachedImagesAndFiles()
updateSitePermissions()
......@@ -198,24 +187,6 @@ class DeleteBrowsingDataFragment : Fragment(R.layout.fragment_delete_browsing_da
}
}
private fun updateCollectionsCount() {
view?.browsing_data_item?.subtitleView?.text = ""
viewLifecycleOwner.lifecycleScope.launch(Dispatchers.IO) {
val collectionsCount =
requireComponents.core.tabCollectionStorage.getTabCollectionsCount()
launch(Dispatchers.Main) {
view?.collections_item?.apply {
subtitleView.text =
resources.getString(
R.string.preferences_delete_browsing_data_collections_subtitle,
collectionsCount
)
}
}
}
}
private fun updateCookies() {
// NO OP until we have GeckoView methods to count cookies
}
......@@ -233,12 +204,12 @@ class DeleteBrowsingDataFragment : Fragment(R.layout.fragment_delete_browsing_da
return listOf(
fragmentView.open_tabs_item,
fragmentView.browsing_data_item,
fragmentView.collections_item,
fragmentView.cookies_item,
fragmentView.cached_files_item,
fragmentView.site_permissions_item
)
}
// If coming from Open Tab -> Settings, pop back to Home
// If coming from Home -> Settings, pop back to Settings
private fun returnToDeletionOrigin() {
......@@ -286,9 +257,8 @@ class DeleteBrowsingDataFragment : Fragment(R.layout.fragment_delete_browsing_da
private const val OPEN_TABS_INDEX = 0
private const val HISTORY_INDEX = 1
private const val COLLECTIONS_INDEX = 2
private const val COOKIES_INDEX = 3
private const val CACHED_INDEX = 4
private const val PERMS_INDEX = 5
private const val COOKIES_INDEX = 2
private const val CACHED_INDEX = 3
private const val PERMS_INDEX = 4
}
}
......@@ -51,17 +51,6 @@
android:focusable="true"
app:deleteBrowsingDataItemTitle="@string/preferences_delete_browsing_data_browsing_data_title"
app:deleteBrowsingDataItemSubtitle="@string/preferences_delete_browsing_data_browsing_data_subtitle" />
<org.mozilla.fenix.settings.deletebrowsingdata.DeleteBrowsingDataItem
android:id="@+id/collections_item"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="8dp"
android:layout_marginBottom="8dp"
android:background="?android:attr/selectableItemBackground"
android:clickable="true"
android:focusable="true"
app:deleteBrowsingDataItemTitle="@string/preferences_delete_browsing_data_collections_title"
app:deleteBrowsingDataItemSubtitle="@string/preferences_delete_browsing_data_collections_subtitle" />
<org.mozilla.fenix.settings.deletebrowsingdata.DeleteBrowsingDataItem
android:id="@+id/cookies_item"
android:layout_width="match_parent"
......
......@@ -738,11 +738,6 @@
<!-- Subtitle for the history items in delete browsing data, parameter will be replaced with the
number of history pages the user has -->
<string name="preferences_delete_browsing_data_browsing_history_subtitle">%d pàgines</string>
<!-- Title for the collections item in Delete browsing data -->
<string name="preferences_delete_browsing_data_collections_title">Col·leccions</string>
<!-- Subtitle for the collections item in Delete browsing data, parameter will be replaced with the
number of collections that will be deleted -->
<string name="preferences_delete_browsing_data_collections_subtitle">%d col·leccions</string>
<!-- Title for the cookies item in Delete browsing data -->
<string name="preferences_delete_browsing_data_cookies">Galetes</string>
<!-- Subtitle for the cookies item in Delete browsing data -->
......
......@@ -752,11 +752,6 @@
<!-- Subtitle for the history items in delete browsing data, parameter will be replaced with the
number of history pages the user has -->
<string name="preferences_delete_browsing_data_browsing_history_subtitle">%d pagine</string>
<!-- Title for the collections item in Delete browsing data -->
<string name="preferences_delete_browsing_data_collections_title">Cullezzioni</string>
<!-- Subtitle for the collections item in Delete browsing data, parameter will be replaced with the
number of collections that will be deleted -->
<string name="preferences_delete_browsing_data_collections_subtitle">%d cullezzioni</string>
<!-- Title for the cookies item in Delete browsing data -->
<string name="preferences_delete_browsing_data_cookies">Canistrelli</string>
<!-- Subtitle for the cookies item in Delete browsing data -->
......
......@@ -774,11 +774,6 @@
<!-- Subtitle for the history items in delete browsing data, parameter will be replaced with the
number of history pages the user has -->
<string name="preferences_delete_browsing_data_browsing_history_subtitle">Počet stránek: %d</string>
<!-- Title for the collections item in Delete browsing data -->
<string name="preferences_delete_browsing_data_collections_title">Sbírky</string>
<!-- Subtitle for the collections item in Delete browsing data, parameter will be replaced with the
number of collections that will be deleted -->
<string name="preferences_delete_browsing_data_collections_subtitle">Počet sbírek: %d</string>
<!-- Title for the cookies item in Delete browsing data -->
<string name="preferences_delete_browsing_data_cookies">Cookies</string>
<!-- Subtitle for the cookies item in Delete browsing data -->
......
......@@ -748,11 +748,6 @@
<!-- Subtitle for the history items in delete browsing data, parameter will be replaced with the
number of history pages the user has -->
<string name="preferences_delete_browsing_data_browsing_history_subtitle">%d tudalen</string>
<!-- Title for the collections item in Delete browsing data -->
<string name="preferences_delete_browsing_data_collections_title">Casgliadau</string>
<!-- Subtitle for the collections item in Delete browsing data, parameter will be replaced with the
number of collections that will be deleted -->
<string name="preferences_delete_browsing_data_collections_subtitle">%d casgliad</string>
<!-- Title for the cookies item in Delete browsing data -->
<string name="preferences_delete_browsing_data_cookies">Cwcis</string>
<!-- Subtitle for the cookies item in Delete browsing data -->
......
......@@ -784,11 +784,6 @@
<!-- Subtitle for the history items in delete browsing data, parameter will be replaced with the
number of history pages the user has -->
<string name="preferences_delete_browsing_data_browsing_history_subtitle">%d Seiten</string>
<!-- Title for the collections item in Delete browsing data -->
<string name="preferences_delete_browsing_data_collections_title">Sammlungen</string>
<!-- Subtitle for the collections item in Delete browsing data, parameter will be replaced with the
number of collections that will be deleted -->
<string name="preferences_delete_browsing_data_collections_subtitle">%d Sammlungen</string>
<!-- Title for the cookies item in Delete browsing data -->
<string name="preferences_delete_browsing_data_cookies">Cookies</string>
<!-- Subtitle for the cookies item in Delete browsing data -->
......
......@@ -774,11 +774,6 @@
<!-- Subtitle for the history items in delete browsing data, parameter will be replaced with the
number of history pages the user has -->
<string name="preferences_delete_browsing_data_browsing_history_subtitle">%d páginas</string>
<!-- Title for the collections item in Delete browsing data -->
<string name="preferences_delete_browsing_data_collections_title">Colecciones</string>
<!-- Subtitle for the collections item in Delete browsing data, parameter will be replaced with the
number of collections that will be deleted -->
<string name="preferences_delete_browsing_data_collections_subtitle">%d colecciones</string>
<!-- Title for the cookies item in Delete browsing data -->
<string name="preferences_delete_browsing_data_cookies">Cookies</string>
<!-- Subtitle for the cookies item in Delete browsing data -->
......
......@@ -784,11 +784,6 @@
<!-- Subtitle for the history items in delete browsing data, parameter will be replaced with the
number of history pages the user has -->
<string name="preferences_delete_browsing_data_browsing_history_subtitle">%d páginas</string>
<!-- Title for the collections item in Delete browsing data -->
<string name="preferences_delete_browsing_data_collections_title">Colecciones</string>
<!-- Subtitle for the collections item in Delete browsing data, parameter will be replaced with the
number of collections that will be deleted -->
<string name="preferences_delete_browsing_data_collections_subtitle">%d colecciones</string>
<!-- Title for the cookies item in Delete browsing data -->
<string name="preferences_delete_browsing_data_cookies">Cookies</string>
<!-- Subtitle for the cookies item in Delete browsing data -->
......
......@@ -712,11 +712,6 @@
<!-- Subtitle for the history items in delete browsing data, parameter will be replaced with the
number of history pages the user has -->
<string name="preferences_delete_browsing_data_browsing_history_subtitle">%d páginas</string>
<!-- Title for the collections item in Delete browsing data -->
<string name="preferences_delete_browsing_data_collections_title">Colecciones</string>
<!-- Subtitle for the collections item in Delete browsing data, parameter will be replaced with the
number of collections that will be deleted -->
<string name="preferences_delete_browsing_data_collections_subtitle">%d colecciones</string>
<!-- Title for the cookies item in Delete browsing data -->
<string name="preferences_delete_browsing_data_cookies">Cookies</string>
<!-- Subtitle for the cookies item in Delete browsing data -->
......
......@@ -762,11 +762,6 @@
<!-- Subtitle for the history items in delete browsing data, parameter will be replaced with the
number of history pages the user has -->
<string name="preferences_delete_browsing_data_browsing_history_subtitle">%d orri</string>
<!-- Title for the collections item in Delete browsing data -->
<string name="preferences_delete_browsing_data_collections_title">Bildumak</string>
<!-- Subtitle for the collections item in Delete browsing data, parameter will be replaced with the
number of collections that will be deleted -->
<string name="preferences_delete_browsing_data_collections_subtitle">%d bilduma</string>
<!-- Title for the cookies item in Delete browsing data -->
<string name="preferences_delete_browsing_data_cookies">Cookieak</string>
<!-- Subtitle for the cookies item in Delete browsing data -->
......
......@@ -766,11 +766,6 @@
<!-- Subtitle for the history items in delete browsing data, parameter will be replaced with the
number of history pages the user has -->
<string name="preferences_delete_browsing_data_browsing_history_subtitle">%d sivua</string>
<!-- Title for the collections item in Delete browsing data -->
<string name="preferences_delete_browsing_data_collections_title">Kokoelmat</string>
<!-- Subtitle for the collections item in Delete browsing data, parameter will be replaced with the
number of collections that will be deleted -->
<string name="preferences_delete_browsing_data_collections_subtitle">%d kokoelmaa</string>
<!-- Title for the cookies item in Delete browsing data -->
<string name="preferences_delete_browsing_data_cookies">Evästeet</string>
<!-- Subtitle for the cookies item in Delete browsing data -->
......
......@@ -784,11 +784,6 @@
<!-- Subtitle for the history items in delete browsing data, parameter will be replaced with the
number of history pages the user has -->
<string name="preferences_delete_browsing_data_browsing_history_subtitle">%d pages</string>
<!-- Title for the collections item in Delete browsing data -->
<string name="preferences_delete_browsing_data_collections_title">Collections</string>
<!-- Subtitle for the collections item in Delete browsing data, parameter will be replaced with the
number of collections that will be deleted -->
<string name="preferences_delete_browsing_data_collections_subtitle">%d collections</string>
<!-- Title for the cookies item in Delete browsing data -->
<string name="preferences_delete_browsing_data_cookies">Cookies</string>
<!-- Subtitle for the cookies item in Delete browsing data -->
......
......@@ -750,11 +750,6 @@
<!-- Subtitle for the history items in delete browsing data, parameter will be replaced with the
number of history pages the user has -->
<string name="preferences_delete_browsing_data_browsing_history_subtitle">%d siden</string>
<!-- Title for the collections item in Delete browsing data -->
<string name="preferences_delete_browsing_data_collections_title">Kolleksjes</string>
<!-- Subtitle for the collections item in Delete browsing data, parameter will be replaced with the
number of collections that will be deleted -->
<string name="preferences_delete_browsing_data_collections_subtitle">%d kolleksjes</string>
<!-- Title for the cookies item in Delete browsing data -->
<string name="preferences_delete_browsing_data_cookies">Cookies</string>
<!-- Subtitle for the cookies item in Delete browsing data -->
......
......@@ -759,11 +759,6 @@
<!-- Subtitle for the history items in delete browsing data, parameter will be replaced with the
number of history pages the user has -->
<string name="preferences_delete_browsing_data_browsing_history_subtitle">%d lap</string>
<!-- Title for the collections item in Delete browsing data -->
<string name="preferences_delete_browsing_data_collections_title">Gyűjtemények</string>
<!-- Subtitle for the collections item in Delete browsing data, parameter will be replaced with the
number of collections that will be deleted -->
<string name="preferences_delete_browsing_data_collections_subtitle">%d gyűjtemény</string>
<!-- Title for the cookies item in Delete browsing data -->
<string name="preferences_delete_browsing_data_cookies">Sütik</string>
<!-- Subtitle for the cookies item in Delete browsing data -->
......
......@@ -771,12 +771,6 @@
<!-- Subtitle for the history items in delete browsing data, parameter will be replaced with the
number of history pages the user has -->
<string name="preferences_delete_browsing_data_browsing_history_subtitle">%d laman</string>
<!-- Title for the collections item in Delete browsing data -->
<string name="preferences_delete_browsing_data_collections_title">Koleksi</string>
<!-- Subtitle for the collections item in Delete browsing data, parameter will be replaced with the
number of collections that will be deleted -->
<string name="preferences_delete_browsing_data_collections_subtitle">%d koleksi</string>
<!-- Title for the cookies item in Delete browsing data -->
<string name="preferences_delete_browsing_data_cookies">Kuki</string>
<!-- Subtitle for the cookies item in Delete browsing data -->
......
......@@ -787,11 +787,6 @@
<!-- Subtitle for the history items in delete browsing data, parameter will be replaced with the
number of history pages the user has -->
<string name="preferences_delete_browsing_data_browsing_history_subtitle">%d pagine</string>
<!-- Title for the collections item in Delete browsing data -->
<string name="preferences_delete_browsing_data_collections_title">Raccolte</string>
<!-- Subtitle for the collections item in Delete browsing data, parameter will be replaced with the
number of collections that will be deleted -->
<string name="preferences_delete_browsing_data_collections_subtitle">%d raccolte</string>
<!-- Title for the cookies item in Delete browsing data -->
<string name="preferences_delete_browsing_data_cookies">Cookie</string>
<!-- Subtitle for the cookies item in Delete browsing data -->
......
......@@ -638,11 +638,6 @@
<!-- Subtitle for the history items in delete browsing data, parameter will be replaced with the
number of history pages the user has -->
<string name="preferences_delete_browsing_data_browsing_history_subtitle">%d דפים</string>
<!-- Title for the collections item in Delete browsing data -->
<string name="preferences_delete_browsing_data_collections_title">אוספים</string>
<!-- Subtitle for the collections item in Delete browsing data, parameter will be replaced with the
number of collections that will be deleted -->
<string name="preferences_delete_browsing_data_collections_subtitle">%d אוספים</string>
<!-- Title for the cookies item in Delete browsing data -->
<string name="preferences_delete_browsing_data_cookies">עוגיות</string>
<!-- Title for the cached images and files item in Delete browsing data -->
......
......@@ -760,11 +760,6 @@
<!-- Subtitle for the history items in delete browsing data, parameter will be replaced with the
number of history pages the user has -->
<string name="preferences_delete_browsing_data_browsing_history_subtitle">%d ページ</string>
<!-- Title for the collections item in Delete browsing data -->
<string name="preferences_delete_browsing_data_collections_title">コレクション</string>
<!-- Subtitle for the collections item in Delete browsing data, parameter will be replaced with the
number of collections that will be deleted -->
<string name="preferences_delete_browsing_data_collections_subtitle">%d 件のコレクション</string>
<!-- Title for the cookies item in Delete browsing data -->
<string name="preferences_delete_browsing_data_cookies">Cookie</string>
<!-- Subtitle for the cookies item in Delete browsing data -->
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment