add favorites option to importing comic dialog

This commit is contained in:
nyne
2024-10-29 09:40:34 +08:00
parent e81f58afc1
commit ca15a641a4
3 changed files with 56 additions and 17 deletions

View File

@@ -59,7 +59,7 @@ class ComicChapter {
}
abstract class CBZ {
static Future<void> import(File file) async {
static Future<LocalComic> import(File file) async {
var cache = Directory(FilePath.join(App.cachePath, 'cbz_import'));
if (cache.existsSync()) cache.deleteSync(recursive: true);
cache.createSync();
@@ -130,20 +130,21 @@ abstract class CBZ {
}
}
}
LocalManager().add(
LocalComic(
id: LocalManager().findValidId(ComicType.local),
title: metaData.title,
subtitle: metaData.author,
tags: metaData.tags,
comicType: ComicType.local,
directory: dest.name,
chapters: cpMap,
downloadedChapters: cpMap?.keys.toList() ?? [],
cover: 'cover.${coverFile.path.split('.').last}',
createdAt: DateTime.now(),
),
var comic = LocalComic(
id: LocalManager().findValidId(ComicType.local),
title: metaData.title,
subtitle: metaData.author,
tags: metaData.tags,
comicType: ComicType.local,
directory: dest.name,
chapters: cpMap,
downloadedChapters: cpMap?.keys.toList() ?? [],
cover: 'cover.${coverFile.path.split('.').last}',
createdAt: DateTime.now(),
);
LocalManager().add(comic);
await cache.delete(recursive: true);
return comic;
}
static Future<File> export(LocalComic comic) async {