Reorganize docs and update reader search flows
This commit is contained in:
@@ -53,8 +53,20 @@ final class RDEPUBReaderLocationCoordinator {
|
||||
let readerView = context.readerView else {
|
||||
return nil
|
||||
}
|
||||
let pageNumber = readerView.currentPage + 1
|
||||
if (context.textBook != nil || context.bookPageMap != nil), readerView.currentPage >= 0 {
|
||||
return controller.resolvedTextLocation(forPageNumber: readerView.currentPage + 1)
|
||||
if let location = controller.resolvedTextLocation(forPageNumber: pageNumber) {
|
||||
return location
|
||||
}
|
||||
// resolvedTextLocation 可能因章节数据未加载而返回 nil,
|
||||
// 通过 readingSession 的 activePages 构建回退位置
|
||||
if let readingSession = context.readingSession,
|
||||
readingSession.activePages.indices.contains(readerView.currentPage) {
|
||||
return readingSession.fallbackLocation(
|
||||
for: readingSession.activePages[readerView.currentPage],
|
||||
bookIdentifier: context.currentBookIdentifier
|
||||
)
|
||||
}
|
||||
}
|
||||
return context.readingSession?.currentReadingLocation(bookIdentifier: context.currentBookIdentifier)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user