Fixed issue where deleting a download caused favourites to be deleted.

This commit is contained in:
2024-12-18 17:58:18 +08:00
parent abaeaf4f77
commit 929ec88e84

View File

@@ -473,13 +473,15 @@ class LocalManager with ChangeNotifier {
var dir = Directory(FilePath.join(path, c.directory)); var dir = Directory(FilePath.join(path, c.directory));
dir.deleteIgnoreError(recursive: true); dir.deleteIgnoreError(recursive: true);
} }
//Deleting a local comic means that it's nolonger available, thus both favorite and history should be deleted. // Deleting a local comic means that it's nolonger available, thus both favorite and history should be deleted.
if(HistoryManager().findSync(c.id, c.comicType) != null) { if(c.comicType == ComicType.local) {
HistoryManager().remove(c.id, c.comicType); if(HistoryManager().findSync(c.id, c.comicType) != null) {
} HistoryManager().remove(c.id, c.comicType);
var folders = LocalFavoritesManager().find(c.id, c.comicType); }
for (var f in folders) { var folders = LocalFavoritesManager().find(c.id, c.comicType);
LocalFavoritesManager().deleteComicWithId(f, c.id, c.comicType); for (var f in folders) {
LocalFavoritesManager().deleteComicWithId(f, c.id, c.comicType);
}
} }
remove(c.id, c.comicType); remove(c.id, c.comicType);
notifyListeners(); notifyListeners();