mirror of
https://github.com/wgh136/pixes.git
synced 2025-09-27 12:57:24 +00:00
fix & improve DownloadedPage
This commit is contained in:
@@ -368,6 +368,26 @@ class DownloadManager {
|
||||
}
|
||||
}
|
||||
|
||||
Future<void> checkAndClearInvalidItems() async{
|
||||
var illusts = listAll();
|
||||
var shouldDelete = <DownloadedIllust>[];
|
||||
for(var item in illusts) {
|
||||
var paths = getImagePaths(item.illustId);
|
||||
var validPaths = <String>[];
|
||||
for(var path in paths) {
|
||||
if(await File(path).exists()) {
|
||||
validPaths.add(path);
|
||||
}
|
||||
}
|
||||
if(validPaths.isEmpty) {
|
||||
shouldDelete.add(item);
|
||||
}
|
||||
}
|
||||
for(var item in shouldDelete) {
|
||||
delete(item);
|
||||
}
|
||||
}
|
||||
|
||||
void resume() {
|
||||
_paused = false;
|
||||
}
|
||||
|
Reference in New Issue
Block a user