CatimaLoyalty / Android

Catima, a Loyalty Card & Ticket Manager for Android
https://catima.app
GNU General Public License v3.0
818 stars 150 forks source link

Add an attached document (PDF) #1889

Open docjyJ opened 4 months ago

docjyJ commented 4 months ago

It would be practical to be able to add the original document.

Currently, it is possible to reach photos of the original card.

But, some virtual gift card are in PDF format, and it is not possible to join them. It is useful because perfecting the original document must be presented, there is supplementary info or confidential code.

Some Issue is about it but they are closing :

https://github.com/CatimaLoyalty/Android/issues/1196#issuecomment-1407416115 It may be better to just use a third-party app to convert one PDF page into an image?

It's true but it's not the best solution

https://github.com/CatimaLoyalty/Android/issues/496#issuecomment-1484569223 maybe we can just use an "attach" option, for any kind of document, wich opens a new app.

I think it's the better way to implement this functionality

Summary:

Thank you, your app is great!

TheLastProject commented 4 months ago

I think I've seen this request come up before. Back then there was no PDF scan support, but given there is now it might be reasonable to extend it.

I basically see two different features here, which may or may not be connected and I'm wondering what the correct UI flow for them would be. Getting these things right is quite challenging :sweat_smile:

Feature 1: Adding non-image attachments

Right now, the edit screen has 3 tabs: Card, Options and Photos. Given how attachments are a bit more power-usery, "Card" is probably not the right place to put them. "Options" also doesn't feel very sensible (those are currently more advanced "card options" like grouping, notes, etc.). So, the most logical place would be either "Photos" or a new tab, but adding a 4th tab might make the screen very busy.

Right now the "Photos" tab has a "Front image" and "Back image". Obviously, random attachments like PDFs are not images.

Image of the Photos tab in the edit view

I see several options here:

  1. Rename it to "Front side" and "Back side": This has the clear downside that we're losing the logical connection to a real-life loyalty card, as in real-life you can't have a document on the front side.
  2. Rename the tab to "Attachments" and add a list of one or more attachments below that, so you can have both images and attachments: This has the downside that people may not look under "Attachments" to manage the front and back image (may cause confusion) and makes it impossible to sort attachments before photos.
  3. Something else altogether?

For displaying, we again have several options:

  1. Display the PDF inline with an image of the first page: Either a bit more storage-heavy (as we'll have to create a PNG copy of the first page) or slow while switching (as we'll have to render the first page of the PDF in real time). Rendering the first page and storing a PNG copy during saving is probably the only realistic option here.
  2. Display the PDF inline with a generic "PDF file" image with the file name below it: Less user-friendly.
  3. Display the PDF somewhere on the info screen.
Displaying a PDF inline Displaying in the info screen
Inline PDF example Info screen example

For opening, we can reuse the existing image logic to open a system PDF reader instead.

Feature 2: Automatically add source image/file on scan

This could either be saved and displayed as a generic attachment, using the "Feature 1" logic (although we probably do want new fields then) or perhaps we want to more explicitly state this is the import source below the barcode or in the info screen? That way we prevent showing users what may very well be the exact same image twice when they press next (both the generated barcode and the scanned original)

A mock-up of the view screen with the text "Imported from PDF" below the barcode, indicating the barcode was generated from a PDF file

docjyJ commented 4 months ago

I think the best way is simplicity.

You do an excellent job on this application! Thank you so much!

Rename the tab to "Attachments" and add a list of one or more attachments below that, so you can have both images and attachments

I think this is the simplest way.

may cause confusio

It is possible to add a placeholder.

Display the PDF inline with a generic "PDF file" image with the file name below it

The option to generate an image can be done later

we want to more explicitly state this is the import source

By adding a title to each file, it is possible to put a title by default “original imported”. image image
placeholder displaying

These are just examples, made as you want.

I think it's the simplest and intuitive way.

Do something as generic as possible to simplify the code and give the most liberty to the user.

I hope my English is not too bad. Thank :heart:

TheLastProject commented 4 months ago

I see we both lean towards updating the "photos" tab. I do worry about things being confusing to users when they can't set a PDF for the first two images but can for the others so maybe we should just change "Front image" and "Back image" to "Attachment 1" and "Attachment 2" and allow more attachments.

Your suggestion of putting the image type below the image when you're not viewing the barcode is very good, I implemented that in #1894. (I already know people are going to ask to reorder their attachments next, but well, that can be later).

docjyJ commented 4 months ago

I do worry about things being confusing to users when they can't set a PDF for the first two images but can for the others so maybe we should just change "Front image" and "Back image" to "Attachment 1" and "Attachment 2" and allow more attachments.

Yes, it needs to be done in a more logical way. Maybe adding hints can help show the usefulness of the feature:

image

BrilliantTrees commented 4 months ago

This looks like a fantastic idea I've been playing with both Catima and Google Wallet to test the storage of loyalty cards and MUCH prefer your interface with the ability to store images of a given card (which I think makes the selection process easier if you have multiple cards stored) and minimising any data I share with Google is always a good thing!

Storing PDF's for vouchers or tickets would be a great enhancement

At present Google doesn't seem to have an option to store PDF's directly unless the ticket provider sends the confirmation email with the "Save to Wallet" option. We have a couple of upcoming theatre tickets and only have PDF's (with no "Save to Wallet" option) and although I can open the PDF, screenshot it and then import to Catima as a new image its much more of faff than importing a PDF directly.

Given that the thread above seems to suggest that you agree with the development request have you a timeline for possible implementation assuming you have gaps in your schedule?

Forgive my ignorance but I stumbled on this particular thread after trying one of the features on the current app and it not behaving as I expected. When adding a new entry under the "More Options" pop up there is the option to "Select a PDF File" but when I select a PDF from the phones files folder it returns an error message of "No Barcode Found" despite the PDF file in question being a barcode ticket. Am I completely misunderstanding what the "Select a PDF" option is intended to do or doing something wrong?

Thanks in advance

TheLastProject commented 4 months ago

Sorry but I don't give timelines. Catima is an unpaid hobby project, things will come when I feel like working on them. For stressing about deadlines I already have my dayjob ;) If other people submit merge requests that can sometimes speed things up if the code is easy enough to review that reviewing is faster than writing it myself :)

Your PDF file not working is most likely related to #1215 as the PDF import converts every page to an image and then uses the same code as the extracting-barcode-from-image code. It indeed should work as you're describing, but there are some edge cases where the image-to-barcode conversion fails (and I'm still not sure why).

docjyJ commented 4 months ago

MUCH prefer your interface with the ability to store images of a given card and minimising any data I share with Google is always a good thing!

I truly agree!

Thank you very much @ThelastProject (and all the contributors) for your magnificent work !!

Catima is for me the best alternative foss and maintained. :heart:

BrilliantTrees commented 4 months ago

Sorry but I don't give timelines. Catima is an unpaid hobby project, things will come when I feel like working on them. For stressing about deadlines I already have my dayjob ;) If other people submit merge requests that can sometimes speed things up if the code is easy enough to review that reviewing is faster than writing it myself :)

No problem on timeline I understand that real life commitments come first, it was just a cheeky enquiry as would have been great to set up our theatre tickets today. I'll just have to go old school and either keep confirmation email or keep the PDF tickets in my download folder on phone