mirror of
https://github.com/venera-app/venera.git
synced 2025-09-27 07:47:24 +00:00
delete cached favorite cover after deleting a local favorite
This commit is contained in:
@@ -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 == ?;
|
||||
|
@@ -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<Uint8List> load(StreamController<ImageChunkEvent> chunkEvents) async {
|
||||
var sourceKey = ComicSource.fromIntKey(intKey)?.key;
|
||||
|
Reference in New Issue
Block a user