r2-testapp-kotlin
r2-testapp-kotlin copied to clipboard
Develop services/APIs for FileStorage and Importing books
Per @mickael-menu, I think we could benefit from having a FileStorageService to wrap the R2DIRECTORY and generate the paths (covers, thumbnails, book) when requested. There are a couple of places where logic is duplicated for dealing with files and could really help. See https://github.com/readium/r2-testapp-kotlin/pull/403#discussion_r617440499 and https://github.com/readium/r2-testapp-kotlin/pull/403#discussion_r618282956.
There are also a couple of places where the import logic is duplicated, specifically on the bookshelf fragment where you enter a URL or select a file on your device and from downloading a publication from the catalogs view (currently just OPDS feeds). Having a service for that will also help. This might be a good use case for the new WorkManager, although that might also be overdoing things. I put together a POC for using it, found here: https://github.com/stevenzeck/r2-testapp-kotlin/commit/904565b2ec378d8efa75097c3697d43a1f33f385.