From b5b0dc85e3aeb206a2e9dcb7cdc051ee937f9525 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=A7=92=E7=A0=82=E7=B3=96?= <90336521+lings03@users.noreply.github.com> Date: Mon, 23 Jun 2025 19:03:24 +0800 Subject: [PATCH] Show group in last read and history when group existing. (#419) --- assets/translation.json | 2 ++ lib/foundation/history.dart | 5 ++++ lib/pages/comic_details_page/comic_page.dart | 24 ++++++++++++-------- 3 files changed, 22 insertions(+), 9 deletions(-) diff --git a/assets/translation.json b/assets/translation.json index a2a5063..fedb50f 100644 --- a/assets/translation.json +++ b/assets/translation.json @@ -234,6 +234,7 @@ "Please add some sources": "请添加一些源", "Please check your settings": "请检查您的设置", "No Category Pages": "没有分类页面", + "Group @group": "第 @group 组", "Chapter @ep": "第 @ep 章", "Page @page": "第 @page 页", "Also remove files on disk": "同时删除磁盘上的文件", @@ -633,6 +634,7 @@ "Please add some sources": "請添加一些源", "Please check your settings": "請檢查您的設定", "No Category Pages": "沒有分類頁面", + "Group @group": "第 @group 組", "Chapter @ep": "第 @ep 章", "Page @page": "第 @page 頁", "Also remove files on disk": "同時刪除磁碟上的文件", diff --git a/lib/foundation/history.dart b/lib/foundation/history.dart index 4ea0892..06920b7 100644 --- a/lib/foundation/history.dart +++ b/lib/foundation/history.dart @@ -133,6 +133,11 @@ class History implements Comic { @override String get description { var res = ""; + if (group != null){ + res += "${"Group @group".tlParams({ + "group": group!, + })} - "; + } if (ep >= 1) { res += "Chapter @ep".tlParams({ "ep": ep, diff --git a/lib/pages/comic_details_page/comic_page.dart b/lib/pages/comic_details_page/comic_page.dart index aa05355..ce01090 100644 --- a/lib/pages/comic_details_page/comic_page.dart +++ b/lib/pages/comic_details_page/comic_page.dart @@ -410,20 +410,26 @@ class _ComicPageState extends LoadingState String text; if (haveChapter) { var epName = "E$ep"; + String? groupName; try { - epName = group == null - ? comic.chapters!.titles.elementAt( - math.min(ep - 1, comic.chapters!.length - 1), - ) - : comic.chapters! - .getGroupByIndex(group - 1) - .values - .elementAt(ep - 1); + if (group == null){ + epName = comic.chapters!.titles.elementAt( + math.min(ep - 1, comic.chapters!.length - 1), + ); + } else { + groupName = comic.chapters!.groups.elementAt(group - 1); + epName = comic.chapters! + .getGroupByIndex(group - 1) + .values + .elementAt(ep - 1); + } } catch(e) { // ignore } - text = "${"Last Reading".tl}: $epName P$page"; + text = groupName == null + ? "${"Last Reading".tl}: $epName P$page" + : "${"Last Reading".tl}: $groupName $epName P$page"; } else { text = "${"Last Reading".tl}: P$page"; }