Page MenuHomePhabricator

Add share option at the library screen for each book
Closed, ResolvedPublic

Description

Currently at the library screen, there are options to read and delete a book. We can add a small share icon to directly share the Epub file to external apps or other places.

Event Timeline

@Bodhisattwa Thanks. For the Share option, should I add it as a button like Read and Delete, or just use a share icon next to Delete?

@Bodhisattwa Thanks. For the Share option, should I add it as a button like Read and Delete, or just use a share icon next to Delete?

A share icon should be fine.

Hi @Bodhisattwa, I managed to share the EPUB file and send it to Kindle successfully. But I’m not sure if I’m doing it the right way.
To make sharing work, I edited the provider_paths.xml and allowed access to all internal files. Earlier, it was only pointing to the ebooks/ folder.
While sharing, I used book.href, but I noticed that the href path doesn’t include the ebooks/ directory—it directly shows something like files/____.epub.
While testing, I also noticed something else:

  • When a book is downloaded, it ends up in two locations:
    • files/<original_filename>
    • files/ebooks/<renamed_file> (with title change)
  • But when the book is deleted, only the one under files/ is removed—the copy in files/ebooks/ stays back.

So I’m a bit unsure about two things:

  1. Is it fine that I changed provider_paths.xml to allow all internal files?
  2. Since the file in ebooks/ has a different path and filename, do we need to update the href after the download so that sharing uses the ebooks/ location?
    WhatsApp Image 2025-10-17 at 14.17.01.jpeg (1×540 px, 30 KB)

Thanks for noticing this @Janice.jf This arises because in an earlier version of the app, we did not have Readium integrated and only used Myne for everything like Library management, reading, etc. Once we integrated Readium, we still had to rely on books downloading functionality from Myne since Readium's Download file from web function had a shortcoming. see T384803. We will have to rework this entire thing in the future but for now we should be sharing files from files/ebooks/ since we plan to use Readium for library management and do away with Myne. I think the existing sharing access to ebooks folder is good enough for sharing? Do we still have to allow all internal files?

Thanks for the explanation @Saiphani02. I was allowing access to all internal files because the book.href in the Library lazy column item points to the file without the ebooks/ folder, e.g.: file:///data/user/0/org.cis_india.wsreader/files/1ac8a7ed-5f0b-45d5-81c8-f9a4d87c89f5.epub

If we’re going to use files/ebooks/, should we update book.href in db after the download so it points to the file there?

Yes, it looks like the right way to go forward

I’ll proceed with that. Thanks!

@Janice.jf , please take a note that T407687 has implemented a new percentage indicator for book completion at the same library screen for each book, where you are working.

@Saiphani02 @Bodhisattwa PR is ready for review. Implementation is complete and tested. [[ URL | https://github.com/cis-india/Wikisource-Reader/pull/50 ]]

Also I want to mention that if an ebook is already downloaded, we are able to download it again. And it causes duplicate entries in the ebooks/ as well as the room db. If its already downloaded then we should show "go to library" directly. Maybe we can use the identifier from the room db to check if its already downloaded?

@Saiphani02 @Bodhisattwa PR is ready for review. Implementation is complete and tested. [[ URL | https://github.com/cis-india/Wikisource-Reader/pull/50 ]]

Thanks for the PR, which has been merged by @Saiphani02 . Closing this ticket.

Also I want to mention that if an ebook is already downloaded, we are able to download it again. And it causes duplicate entries in the ebooks/ as well as the room db. If its already downloaded then we should show "go to library" directly. Maybe we can use the identifier from the room db to check if its already downloaded?

Noted with thanks. Every time, if there is a slight change in the actual text content on Wikisource, the texts in the Epub file also changes.. That's why, even if we have downloaded a book, we still get an option to download the book again and have duplicate entries, although they may or may not be entirely duplicate files. We will discuss on this on a separate ticket.

Encountering some issues when clicking on the Share icon. Most probably due to file identifiers/titles changes done in recent updates