This commit is contained in:
len 2016-11-23 21:43:24 +01:00
parent 4d4b9c0d6d
commit 2a531f1a1e
2 changed files with 9 additions and 1 deletions

View File

@ -61,6 +61,13 @@ class DownloadStore(context: Context) {
preferences.edit().remove(getKey(download)).apply() 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. * 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. // Clear the store, downloads will be added again immediately.
preferences.edit().clear().apply() clear()
return downloads return downloads
} }

View File

@ -45,6 +45,7 @@ class DownloadQueue(
download.setStatusSubject(null) download.setStatusSubject(null)
} }
queue.clear() queue.clear()
store.clear()
updatedRelay.call(Unit) updatedRelay.call(Unit)
} }