...
The current version of Readium 2 parses navigation document without decrypting it. As a result, the table of contents appears blank in the app. To show table of contents in the app, additional decryption was required, and LibraryService.swift parsePublication(at url: URL) function was modified (added code is bold):
Code Block | ||
---|---|---|
| ||
private func parsePublication(at url: URL) -> PubBox? {
do {
guard let (pubBox, parsingCallback) = try Publication.parse(at: url) else {
return nil
}
let (publication, container) = pubBox
// TODO: SIMPLY-2840
// Parse .ncx document to update TOC and page list if publication doesn't contain TOC
// -- the code below should be removed as described in SIMPLY-2840 --
if publication.tableOfContents.isEmpty {
publication.otherCollections.append(contentsOf: parseNCXDocument(in: container, links: publication.links))
}
// -- end of cleanup --
items[url.lastPathComponent] = (container, parsingCallback)
return (publication, container)
} catch {
log(.error, "Error parsing publication at '\(url.absoluteString)': \(error.localizedDescription)")
return nil
}
}
} |
private func parsePublication(at url: URL) -> PubBox? {
...