Closed starry-shivam closed 5 months ago
So, After trying a bunch of libraries and WebView (see issue-152 branch), I couldn't really find a single EPUB parsing library that isn't decades old since its last update, or documentation and implementation for modern Jetpack Compose apps that is not very hard or even possible. I don't really have time right now to build yet another EPUB parser of my own and test 50 different edge cases. I guess I'll just try to improve the current implementation for now.
Currently, the app renders EPUB files by parsing the contents inside the
OEBPS
directory. However, parsing EPUB files is never entirely reliable because many EPUB files out there do not follow the standard EPUB structure and may not include a table of contents (toc.ncx
) file ornavMap
properties. Fortunately, Gutenberg's books do follow proper EPUB 3 structure and include atoc.ncx
file, which is why the EPUB reader works well for books available within Myne. However, due to the aforementioned reasons, it's not reliable at all and often breaks when opening some random EPUB file that is poorly built and doesn't follow proper file structure or lacks navigation-related properties.The only solution to this issue is switching to a WebView for rendering EPUB files. This solves all of the parsing-related problems because then we skip parsing entirely and directly render the
xhtml
/html
files in the WebView.