This commit is contained in:
kodjomoustapha 2023-06-04 20:36:33 +01:00
parent 4f0df88bc2
commit 17cd6575f4
4 changed files with 13 additions and 8 deletions

View file

@ -1066,4 +1066,4 @@ class _MangaDetailViewState extends ConsumerState<MangaDetailView>
);
});
}
}
}

View file

@ -101,7 +101,7 @@ class _MangaDetailsViewState extends ConsumerState<MangaDetailsView> {
children: [
Icon(
getMangaStatusIcon(widget.manga.status),
size: 12,
size: 14,
),
const SizedBox(
width: 4,

View file

@ -117,8 +117,9 @@ Future<List<String>> downloadChapter(
}
}
}
if (tasks.isEmpty && pageUrls.isNotEmpty) {
bool cbzFileExist =
await File("${mangaDir!.path}${chapter.name}.cbz").exists();
if (tasks.isEmpty && pageUrls.isNotEmpty || cbzFileExist) {
final model = Download(
succeeded: 0,
failed: 0,
@ -127,9 +128,12 @@ Future<List<String>> downloadChapter(
taskIds: pageUrls,
isStartDownload: false,
chapterId: chapter.id);
await ref.watch(convertToCBZProvider(
path.path, mangaDir!.path, chapter.name!, pageUrls)
.future);
if (!cbzFileExist) {
await ref.watch(convertToCBZProvider(
path.path, mangaDir.path, chapter.name!, pageUrls)
.future);
}
isar.writeTxnSync(() {
isar.downloads.putSync(model..chapter.value = chapter);
});
@ -139,7 +143,7 @@ Future<List<String>> downloadChapter(
batchProgressCallback: (succeeded, failed) async {
if (succeeded == tasks.length) {
await ref.watch(convertToCBZProvider(
path!.path, mangaDir!.path, chapter.name!, pageUrls)
path!.path, mangaDir.path, chapter.name!, pageUrls)
.future);
}
bool isEmpty = isar.downloads

View file

@ -124,6 +124,7 @@ class ReaderController extends _$ReaderController {
if (!incognitoMode) {
final chap = chapter;
isar.writeTxnSync(() {
chap.isRead = (pageIndex + 1) == getPageLength([]);
chap.lastPageRead = (pageIndex + 1).toString();
isar.chapters.putSync(chap);
});