Allow user to keep favorite and history when delete local comic. Close #420

This commit is contained in:
角砂糖
2025-06-22 19:49:09 +08:00
parent 8eda8adcc8
commit 01acc4f9de
3 changed files with 31 additions and 11 deletions

View File

@@ -611,7 +611,7 @@ class LocalManager with ChangeNotifier {
notifyListeners();
}
void batchDeleteComics(List<LocalComic> comics, [bool removeFileOnDisk = true]) {
void batchDeleteComics(List<LocalComic> comics, [bool removeFileOnDisk = true, bool removeFavoriteAndHistory = true]) {
if (comics.isEmpty) {
return;
}
@@ -640,8 +640,11 @@ class LocalManager with ChangeNotifier {
_db.execute('COMMIT;');
var comicIDs = comics.map((e) => ComicID(e.comicType, e.id)).toList();
LocalFavoritesManager().batchDeleteComicsInAllFolders(comicIDs);
HistoryManager().batchDeleteHistories(comicIDs);
if (removeFavoriteAndHistory) {
LocalFavoritesManager().batchDeleteComicsInAllFolders(comicIDs);
HistoryManager().batchDeleteHistories(comicIDs);
}
notifyListeners();