feat: chapter runtime refactoring and related updates
- Refactor chapter runtime: replace window coordinator/snapshot with warmup orchestrator - Update EPUB core: parser, reading session, JS bridge, navigator layout - Update reader controller: data source, location resolution, persistence - Update chapter runtime: data cache, loader, runtime store, disk cache, warmup orchestrator - Remove deprecated navigation state machine and pagination state - Update text rendering: book cache, HTML normalizer - Update UI: text content view, dark image adjuster, text selection controller - Update settings and reader configuration - Add CODE_REVIEW.md and AUDIT_FINAL.md documentation - Update pod dependencies (remove SSAlertSwift, SnapKit) - Update podspec and pod configuration files Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -7,18 +7,10 @@ public final class RDEPUBReadingSession {
|
||||
|
||||
public let publication: RDEPUBPublication
|
||||
|
||||
public private(set) var navigatorState: RDEPUBNavigatorState = .initializing
|
||||
|
||||
public private(set) var activePages: [EPUBPage] = []
|
||||
|
||||
public private(set) var activeChapters: [EPUBChapterInfo] = []
|
||||
|
||||
public private(set) var stagedPages: [EPUBPage]?
|
||||
|
||||
public private(set) var stagedChapters: [EPUBChapterInfo]?
|
||||
|
||||
public private(set) var stagedRestoreLocation: RDEPUBLocation?
|
||||
|
||||
public private(set) var pendingNavigationLocation: RDEPUBLocation?
|
||||
|
||||
public private(set) var pendingNavigationPageNum: Int?
|
||||
@@ -37,16 +29,10 @@ public final class RDEPUBReadingSession {
|
||||
publication.resourceResolver
|
||||
}
|
||||
|
||||
public func transition(to state: RDEPUBNavigatorState) {
|
||||
navigatorState = state
|
||||
}
|
||||
|
||||
public func resetRuntimeState() {
|
||||
navigatorState = .initializing
|
||||
activePages = []
|
||||
activeChapters = []
|
||||
clearPendingNavigation()
|
||||
clearStagedSnapshot()
|
||||
currentViewport = nil
|
||||
currentReadingContext = nil
|
||||
}
|
||||
@@ -56,36 +42,6 @@ public final class RDEPUBReadingSession {
|
||||
activeChapters = snapshot.chapters
|
||||
}
|
||||
|
||||
public func stageSnapshot(_ snapshot: PaginationSnapshot, restoreLocation: RDEPUBLocation?) {
|
||||
stagedPages = snapshot.pages
|
||||
stagedChapters = snapshot.chapters
|
||||
stagedRestoreLocation = restoreLocation
|
||||
}
|
||||
|
||||
public func stagedSnapshot() -> PaginationSnapshot? {
|
||||
guard let stagedPages, let stagedChapters else {
|
||||
return nil
|
||||
}
|
||||
return (stagedPages, stagedChapters)
|
||||
}
|
||||
|
||||
public func consumeStagedSnapshotIfAllowed() -> (snapshot: PaginationSnapshot, restoreLocation: RDEPUBLocation?)? {
|
||||
guard navigatorState.isStableForSnapshotApplication,
|
||||
let stagedPages,
|
||||
let stagedChapters else {
|
||||
return nil
|
||||
}
|
||||
let restoreLocation = stagedRestoreLocation
|
||||
clearStagedSnapshot()
|
||||
return ((stagedPages, stagedChapters), restoreLocation)
|
||||
}
|
||||
|
||||
public func clearStagedSnapshot() {
|
||||
stagedPages = nil
|
||||
stagedChapters = nil
|
||||
stagedRestoreLocation = nil
|
||||
}
|
||||
|
||||
public func clearPendingNavigation() {
|
||||
pendingNavigationLocation = nil
|
||||
pendingNavigationPageNum = nil
|
||||
@@ -241,7 +197,6 @@ public final class RDEPUBReadingSession {
|
||||
pendingNavigationLocation = shouldKeepPendingNavigation ? normalizedLocation : nil
|
||||
pendingNavigationPageNum = shouldKeepPendingNavigation ? pageIndex + 1 : nil
|
||||
pendingNavigationHighlightRangeInfo = hasTargetHighlightRangeInfo ? targetHighlightRangeInfo : nil
|
||||
transition(to: .jumping)
|
||||
return pageIndex + 1
|
||||
}
|
||||
|
||||
@@ -292,9 +247,6 @@ public final class RDEPUBReadingSession {
|
||||
if pendingNavigationPageNum == pageNumber {
|
||||
clearPendingNavigation()
|
||||
}
|
||||
if navigatorState == .jumping || navigatorState == .moving {
|
||||
transition(to: .idle)
|
||||
}
|
||||
}
|
||||
|
||||
public func currentReadingLocation(bookIdentifier: String?) -> RDEPUBLocation? {
|
||||
|
||||
Reference in New Issue
Block a user