feat: unify reader chrome state management

- Add RDEPUBReaderUIState struct for centralized UI state model
- Refactor RDEPUBReaderChromeCoordinator with makeUIState() and applyUIState()
- Remove direct UI updates from RDEPUBReaderAnnotationCoordinator
- Consolidate updateBookmarkChrome() into updateReaderChrome()
- Update RDEPUBReaderContext, Runtime, and LocationCoordinator
- Add reader problem fix development checklist documentation

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
shenlei
2026-06-12 17:51:08 +08:00
co-authored by Claude Opus 4.7
parent d15187b730
commit ed390da147
12 changed files with 908 additions and 47 deletions
@@ -38,9 +38,7 @@ final class RDEPUBReaderAnnotationCoordinator {
controller.readerView.isShowToolView == false {
controller.readerView.tapCenter()
}
controller.bottomToolView.setAddHighlightEnabled(
controller.configuration.allowsHighlights && controller.currentSelection != nil
)
controller.updateReaderChrome()
controller.delegate?.epubReader(controller, didChangeSelection: controller.currentSelection)
}
@@ -321,13 +319,6 @@ final class RDEPUBReaderAnnotationCoordinator {
return controller.restoreReadingLocation(bookmark.location, animated: animated)
}
/// UI
func updateBookmarkChrome() {
guard let controller else { return }
controller.topToolView.setBookmarkSelected(currentBookmark() != nil)
controller.bottomToolView.setBookmarksEnabled(!controller.activeBookmarks.isEmpty)
}
///
func presentBookmarksManager() {
guard let controller else { return }
@@ -468,10 +459,10 @@ final class RDEPUBReaderAnnotationCoordinator {
guard let currentBookIdentifier = controller.currentBookIdentifier else { return }
controller.persistence?.saveBookmarks(controller.activeBookmarks, for: currentBookIdentifier)
controller.delegate?.epubReader(controller, didUpdateBookmarks: controller.activeBookmarks)
updateBookmarkChrome()
controller.updateReaderChrome()
}
private func currentBookmark() -> RDEPUBBookmark? {
func currentBookmark() -> RDEPUBBookmark? {
guard let controller else { return nil }
guard let location = scopedBookmarkLocation(controller.currentVisibleLocation()) else {
return nil