diff --git a/app/src/main/java/eu/kanade/tachiyomi/data/download/DownloadStore.kt b/app/src/main/java/eu/kanade/tachiyomi/data/download/DownloadStore.kt index 48253865f8..72d79c10b0 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/data/download/DownloadStore.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/data/download/DownloadStore.kt @@ -61,6 +61,13 @@ class DownloadStore(context: Context) { preferences.edit().remove(getKey(download)).apply() } + /** + * Removes all the downloads from the store. + */ + fun clear() { + preferences.edit().clear().apply() + } + /** * Returns the preference's key for the given download. * @@ -93,7 +100,7 @@ class DownloadStore(context: Context) { } // Clear the store, downloads will be added again immediately. - preferences.edit().clear().apply() + clear() return downloads } diff --git a/app/src/main/java/eu/kanade/tachiyomi/data/download/model/DownloadQueue.kt b/app/src/main/java/eu/kanade/tachiyomi/data/download/model/DownloadQueue.kt index 7bf190feb3..2bb7febd2c 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/data/download/model/DownloadQueue.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/data/download/model/DownloadQueue.kt @@ -45,6 +45,7 @@ class DownloadQueue( download.setStatusSubject(null) } queue.clear() + store.clear() updatedRelay.call(Unit) }