From cc08445f138908ab01f8159ce3c5b76fe748794f Mon Sep 17 00:00:00 2001 From: nyne Date: Tue, 17 Jun 2025 17:36:13 +0800 Subject: [PATCH] Set initial chapter to first downloaded chapter if there is no history when starting to read a local comic. Close #405 --- lib/foundation/local.dart | 31 +++++++++++++++++++++++++++++-- 1 file changed, 29 insertions(+), 2 deletions(-) diff --git a/lib/foundation/local.dart b/lib/foundation/local.dart index eee529f..9a0c100 100644 --- a/lib/foundation/local.dart +++ b/lib/foundation/local.dart @@ -109,15 +109,42 @@ class LocalComic with HistoryMixin implements Comic { void read() { var history = HistoryManager().find(id, comicType); + int? firstDownloadedChapter; + int? firstDownloadedChapterGroup; + if (downloadedChapters.isNotEmpty && chapters != null) { + final chapters = this.chapters!; + if (chapters.isGrouped) { + for (int i=0; i Reader( type: comicType, cid: id, name: title, chapters: chapters, - initialChapter: history?.ep, + initialChapter: history?.ep ?? firstDownloadedChapter, initialPage: history?.page, - initialChapterGroup: history?.group, + initialChapterGroup: history?.group ?? firstDownloadedChapterGroup, history: history ?? History.fromModel( model: this,