diff --git a/lib/foundation/favorites.dart b/lib/foundation/favorites.dart index 97423b8..b237e99 100644 --- a/lib/foundation/favorites.dart +++ b/lib/foundation/favorites.dart @@ -2,6 +2,7 @@ import 'dart:convert'; import 'package:sqlite3/sqlite3.dart'; import 'package:venera/foundation/appdata.dart'; +import 'package:venera/foundation/image_provider/local_favorite_image.dart'; import 'package:venera/foundation/log.dart'; import 'dart:io'; @@ -403,6 +404,7 @@ class LocalFavoritesManager { void deleteComicWithId(String folder, String id, ComicType type) { _modifiedAfterLastCache = true; + LocalFavoriteImageProvider.delete(id, type.value); _db.execute(""" delete from "$folder" where id == ? and type == ?; diff --git a/lib/foundation/image_provider/local_favorite_image.dart b/lib/foundation/image_provider/local_favorite_image.dart index f2d5ab4..ade4a7b 100644 --- a/lib/foundation/image_provider/local_favorite_image.dart +++ b/lib/foundation/image_provider/local_favorite_image.dart @@ -19,6 +19,14 @@ class LocalFavoriteImageProvider final int intKey; + static void delete(String id, int intKey) { + var fileName = (id + intKey.toString()).hashCode.toString(); + var file = File(FilePath.join(App.dataPath, 'favorite_cover', fileName)); + if(file.existsSync()) { + file.delete(); + } + } + @override Future load(StreamController chunkEvents) async { var sourceKey = ComicSource.fromIntKey(intKey)?.key;