Skip to content

Add the ability to share downloaded attachments. #205

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

adityaruplaha
Copy link
Contributor

@adityaruplaha adityaruplaha commented Dec 29, 2024

Looking at:

This PR adds the ability to share downloaded attachment files (and technically text URLs, though this is unused) with other apps. Currently, one must long press the attachment in the Item Details view, or one can share all downloaded attachments for a library item by long pressing the item. More "findable" options can be implemented as desired.

This PR also rewords the AllItems "Remove Download" option to be more clear.

Screenshots:
screenshots

@adityaruplaha
Copy link
Contributor Author

@Dima-Android could you please have a look at this when you get the time? Shouldn't be too much of a major change, small QoL improvement.

@dstillman
Copy link
Member

Thanks for the contribution!

Initially, we'll want to mirror the iOS functionality: a share button in the reader that opens a menu with strings pdf.export.export ("Export PDF") and, when the PDF has annotations, pdf.export.export_annotated ("Export Annotated PDF"):

IMG_F2A8035D2CB7-1

(@Dima-Android, can you reimport iOS strings? The current file only has an outdated "Export" option.)

This will probably make more sense in a separate PR.

As for the changes in this PR:

  • We could consider adding share options to the context menu of the attachments list in the details pane, but it won't really be necessary for files that can be opened within the app, and there you'll be able to actually see what you're sharing. The context menu would let you share files that can't be opened within the app, though. If we did it, we'd probably want the same options for raw/annotated PDFs that we had in the reader and then another option for non-openable file types.
  • Adding this to the items list would let you share multiple files at once, but regular items can have multiple child attachments, so it's a bit imprecise. Is it only sharing the primary attachment for each item? I don't think we've actually had any requests for this on iOS, for what it's worth.

So let's hold off on this PR for now. But if you're open to working on a PR for the reader toolbar, we'd happily accept that. @Dima-Android might be able to provide pointers for determining whether a PDF has annotations and how to get an annotated copy.

@adityaruplaha
Copy link
Contributor Author

Thanks for the feedback. I'll address your comments one by one:

  1. I agree, the option for sharing PDFs is better placed in the reader. I'd be happy to work on that, sometime mid-April.
  2. As I currently understand it, a single library entry (Item) can have multiple attachments (AttachmentItem). However, a single Attachment can point to (at most) one file, correct?

To elaborate on (2): Suppose I have an article with both the open-access PDF and the submitted arXiv PDF, both of which are download locally. Sharing from the Items view (instead of opening and viewing details) allows me to share both files at once. I added this to more easily export entire items (as opposed to a single Attachment) from Zotero, something I have watched professors wish for. In particular, their usecase is sharing a research paper (often part of course material), with their own notes and explanations on the matter, with ease. Screenshots are attached below.

Screenshot_20250325_132406_Zotero Debug.png

Screenshot_20250325_132426_Zotero Debug.png

Screenshot_20250325_132539_IntentResolver.png

@adityaruplaha
Copy link
Contributor Author

Here's how I plan to proceed:

  1. An initial PR laying the groundwork for sharing files on Android (i.e. AttachmentFileShareController).
  2. A PR implementing the share functionality into the reader (of course, reimporting the strings).
  3. For non-openable file types, sharing from the context menu (at the attachment and/or the item level).

@Dima-Android might be able to provide pointers for determining whether a PDF has annotations and how to get an annotated copy.

Is there any dedicated channel (like Discord, IRC, etc.) for development related communication?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants