* For #13522: Also remove history entries from tab history. * For #13522: Test that deleting history also removes it from tab history.
This commit is contained in:
parent
fc964862e0
commit
3bb074b133
|
@ -26,7 +26,9 @@ import kotlinx.coroutines.Dispatchers.IO
|
||||||
import kotlinx.coroutines.Dispatchers.Main
|
import kotlinx.coroutines.Dispatchers.Main
|
||||||
import kotlinx.coroutines.ExperimentalCoroutinesApi
|
import kotlinx.coroutines.ExperimentalCoroutinesApi
|
||||||
import kotlinx.coroutines.launch
|
import kotlinx.coroutines.launch
|
||||||
|
import mozilla.components.browser.state.action.EngineAction
|
||||||
import mozilla.components.browser.state.action.RecentlyClosedAction
|
import mozilla.components.browser.state.action.RecentlyClosedAction
|
||||||
|
import mozilla.components.browser.state.store.BrowserStore
|
||||||
import mozilla.components.concept.engine.prompt.ShareData
|
import mozilla.components.concept.engine.prompt.ShareData
|
||||||
import mozilla.components.lib.state.ext.consumeFrom
|
import mozilla.components.lib.state.ext.consumeFrom
|
||||||
import mozilla.components.service.fxa.sync.SyncReason
|
import mozilla.components.service.fxa.sync.SyncReason
|
||||||
|
@ -94,7 +96,7 @@ class HistoryFragment : LibraryPageFragment<HistoryItem>(), UserInteractionHandl
|
||||||
::deleteHistoryItems,
|
::deleteHistoryItems,
|
||||||
::syncHistory,
|
::syncHistory,
|
||||||
requireComponents.analytics.metrics
|
requireComponents.analytics.metrics
|
||||||
)
|
)
|
||||||
historyInteractor = HistoryInteractor(
|
historyInteractor = HistoryInteractor(
|
||||||
historyController
|
historyController
|
||||||
)
|
)
|
||||||
|
@ -271,6 +273,7 @@ class HistoryFragment : LibraryPageFragment<HistoryItem>(), UserInteractionHandl
|
||||||
requireComponents.analytics.metrics.track(Event.HistoryAllItemsRemoved)
|
requireComponents.analytics.metrics.track(Event.HistoryAllItemsRemoved)
|
||||||
requireComponents.core.store.dispatch(RecentlyClosedAction.RemoveAllClosedTabAction)
|
requireComponents.core.store.dispatch(RecentlyClosedAction.RemoveAllClosedTabAction)
|
||||||
requireComponents.core.historyStorage.deleteEverything()
|
requireComponents.core.historyStorage.deleteEverything()
|
||||||
|
deleteOpenTabsEngineHistory(requireComponents.core.store)
|
||||||
launch(Main) {
|
launch(Main) {
|
||||||
viewModel.invalidate()
|
viewModel.invalidate()
|
||||||
historyStore.dispatch(HistoryFragmentAction.ExitDeletionMode)
|
historyStore.dispatch(HistoryFragmentAction.ExitDeletionMode)
|
||||||
|
@ -288,6 +291,10 @@ class HistoryFragment : LibraryPageFragment<HistoryItem>(), UserInteractionHandl
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private suspend fun deleteOpenTabsEngineHistory(store: BrowserStore) {
|
||||||
|
store.dispatch(EngineAction.PurgeHistoryAction).join()
|
||||||
|
}
|
||||||
|
|
||||||
private fun share(data: List<ShareData>) {
|
private fun share(data: List<ShareData>) {
|
||||||
requireComponents.analytics.metrics.track(Event.HistoryItemShared)
|
requireComponents.analytics.metrics.track(Event.HistoryItemShared)
|
||||||
val directions = HistoryFragmentDirections.actionGlobalShareFragment(
|
val directions = HistoryFragmentDirections.actionGlobalShareFragment(
|
||||||
|
|
|
@ -7,6 +7,7 @@ package org.mozilla.fenix.settings.deletebrowsingdata
|
||||||
import kotlinx.coroutines.Dispatchers
|
import kotlinx.coroutines.Dispatchers
|
||||||
import kotlinx.coroutines.withContext
|
import kotlinx.coroutines.withContext
|
||||||
import mozilla.components.browser.icons.BrowserIcons
|
import mozilla.components.browser.icons.BrowserIcons
|
||||||
|
import mozilla.components.browser.state.action.EngineAction
|
||||||
import mozilla.components.browser.state.action.RecentlyClosedAction
|
import mozilla.components.browser.state.action.RecentlyClosedAction
|
||||||
import mozilla.components.browser.state.store.BrowserStore
|
import mozilla.components.browser.state.store.BrowserStore
|
||||||
import mozilla.components.concept.engine.Engine
|
import mozilla.components.concept.engine.Engine
|
||||||
|
@ -43,6 +44,7 @@ class DefaultDeleteBrowsingDataController(
|
||||||
withContext(coroutineContext) {
|
withContext(coroutineContext) {
|
||||||
engine.clearData(Engine.BrowsingData.select(Engine.BrowsingData.DOM_STORAGES))
|
engine.clearData(Engine.BrowsingData.select(Engine.BrowsingData.DOM_STORAGES))
|
||||||
historyStorage.deleteEverything()
|
historyStorage.deleteEverything()
|
||||||
|
store.dispatch(EngineAction.PurgeHistoryAction)
|
||||||
iconsStorage.clear()
|
iconsStorage.clear()
|
||||||
store.dispatch(RecentlyClosedAction.RemoveAllClosedTabAction)
|
store.dispatch(RecentlyClosedAction.RemoveAllClosedTabAction)
|
||||||
}
|
}
|
||||||
|
|
|
@ -13,6 +13,7 @@ import kotlinx.coroutines.GlobalScope.coroutineContext
|
||||||
import kotlinx.coroutines.test.TestCoroutineDispatcher
|
import kotlinx.coroutines.test.TestCoroutineDispatcher
|
||||||
import kotlinx.coroutines.test.runBlockingTest
|
import kotlinx.coroutines.test.runBlockingTest
|
||||||
import mozilla.components.browser.icons.BrowserIcons
|
import mozilla.components.browser.icons.BrowserIcons
|
||||||
|
import mozilla.components.browser.state.action.EngineAction
|
||||||
import mozilla.components.browser.state.action.RecentlyClosedAction
|
import mozilla.components.browser.state.action.RecentlyClosedAction
|
||||||
import mozilla.components.browser.state.store.BrowserStore
|
import mozilla.components.browser.state.store.BrowserStore
|
||||||
import mozilla.components.concept.engine.Engine
|
import mozilla.components.concept.engine.Engine
|
||||||
|
@ -77,6 +78,7 @@ class DefaultDeleteBrowsingDataControllerTest {
|
||||||
coVerify {
|
coVerify {
|
||||||
engine.clearData(Engine.BrowsingData.select(Engine.BrowsingData.DOM_STORAGES))
|
engine.clearData(Engine.BrowsingData.select(Engine.BrowsingData.DOM_STORAGES))
|
||||||
historyStorage.deleteEverything()
|
historyStorage.deleteEverything()
|
||||||
|
store.dispatch(EngineAction.PurgeHistoryAction)
|
||||||
store.dispatch(RecentlyClosedAction.RemoveAllClosedTabAction)
|
store.dispatch(RecentlyClosedAction.RemoveAllClosedTabAction)
|
||||||
iconsStorage.clear()
|
iconsStorage.clear()
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user