Skip to content

Commit

Permalink
fix: 漫画小说非上次阅读也恢复上次的位置
Browse files Browse the repository at this point in the history
  • Loading branch information
MiaoMint committed Jul 31, 2023
1 parent 334b2d2 commit d724679
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 4 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ Miru App
- [x] 扩展设置
- [x] 影视播放进度
- [x] 漫画小说设置
- [ ] 漫画小说历史记录
- [x] 漫画小说历史记录
- [ ] TMDB 元数据
- [ ] 字幕
- [ ] BT 种子播放
Expand Down
5 changes: 4 additions & 1 deletion lib/pages/watch/widgets/reader/comic/controller.dart
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,10 @@ class ComicController extends ReaderController<ExtensionMangaWatch> {
super.runtime.extension.package,
super.detailUrl,
);
if (history == null) {
if (history == null ||
history.progress.isEmpty ||
episodeGroupId != history.episodeGroupId ||
history.episodeId != index.value) {
return;
}
currentPage.value = int.parse(history.progress);
Expand Down
9 changes: 8 additions & 1 deletion lib/pages/watch/widgets/reader/novel/controller.dart
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,10 @@ class NovelController extends ReaderController<ExtensionFikushonWatch> {
fontSize,
(callback) => MiruStorage.setSetting(SettingKey.novelFontSize, callback),
);

// 切换章节时重置页码
ever(index, (callback) => positions.value = 0);

ever(super.watchData, (callback) async {
if (isRecover.value || callback == null) {
return;
Expand All @@ -48,7 +52,10 @@ class NovelController extends ReaderController<ExtensionFikushonWatch> {
super.runtime.extension.package,
super.detailUrl,
);
if (history == null) {
if (history == null ||
history.progress.isEmpty ||
episodeGroupId != history.episodeGroupId ||
history.episodeId != index.value) {
return;
}
positions.value = int.parse(history.progress);
Expand Down
2 changes: 1 addition & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name: miru_app
description: A new Flutter project.
publish_to: "none"
version: 1.5.1+16
version: 1.5.2+17

environment:
sdk: ">=3.0.3 <4.0.0"
Expand Down

0 comments on commit d724679

Please sign in to comment.