From 929ec88e840619e4caaedf96906d6d4336a1de23 Mon Sep 17 00:00:00 2001 From: nyne Date: Wed, 18 Dec 2024 17:58:18 +0800 Subject: [PATCH] Fixed issue where deleting a download caused favourites to be deleted. --- lib/foundation/local.dart | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/lib/foundation/local.dart b/lib/foundation/local.dart index 865849e..b1d0601 100644 --- a/lib/foundation/local.dart +++ b/lib/foundation/local.dart @@ -473,13 +473,15 @@ class LocalManager with ChangeNotifier { var dir = Directory(FilePath.join(path, c.directory)); dir.deleteIgnoreError(recursive: true); } - //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) { - HistoryManager().remove(c.id, c.comicType); - } - var folders = LocalFavoritesManager().find(c.id, c.comicType); - for (var f in folders) { - LocalFavoritesManager().deleteComicWithId(f, c.id, c.comicType); + // Deleting a local comic means that it's nolonger available, thus both favorite and history should be deleted. + if(c.comicType == ComicType.local) { + 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) { + LocalFavoritesManager().deleteComicWithId(f, c.id, c.comicType); + } } remove(c.id, c.comicType); notifyListeners();