Import from url
These modification add the possibility to share to Catima a text containing an url pointing to a pdf file.
When I buy a gift card, I received a SMS containing the url of a PDF file containing the barcode of the gift card. Actually, I download the file, open it, make a screenshot and share the image file to Catima.
These modification permit me to share directly the SMS, Catima will find an url, download the file, and search the barcode in the file.
Thanks for contributing! I looked at this merge request and I think this is not a feature I want to merge as it contains multiple changes that I do not think most Catima users want. It also contains many unrelated formatting changes, further complicating review.
Most importantly I am worried about the fact that this change makes Catima download files from the Internet unprompted without any user confirmation if text just happens to contain some "magic string". Many Catima users consider Catima being fully offline one of the major selling points and while there are valid use cases to access the internet for I think adding any internet-enabled functionality to Catima should only be done if there is no viable other option and I'm not sure we've exhausted those.
Let's look at your specific use case:
When I buy a gift card, I received a SMS containing the url of a PDF file containing the barcode of the gift card.
Okay, so far this makes sense. You want to import the barcode in that PDF into Catima.
Actually, I download the file, open it, make a screenshot and share the image file to Catima.
This part strongly confuses me. Why make a screenshot and then share the image file when Catima already supports having PDF files share to it?
These modification permit me to share directly the SMS, Catima will find an url, download the file, and search the barcode in the file.
I also don't quite understand how this is faster? You're adding support for the workflow of Long-press SMS -> Share -> Choose Catima, but the existing Click PDF link in SMS file -> Click Share in your PDF reader -> Choose Catima workflow is the same amount of taps, is it not?
Thanks for reviewing my code.
I understand your opinion of adding code which download files from the Internet. It require attention to avoid download unwanted files. But people are supposed to know what url they are sharing to Catima, I hope, and the file, if is a pdf file, is only used to find barcode in, then deleted. Maybee the code can be modified to be active only if internet access right is granted by user.
When I click on link I received by SMS, the file is open in my web browser, because the link do not end with ".pdf", and the url do not return correct content-type. In my browser, I can download the file. And then open it in PDF viewer. But when I want to share from the PDF reader, I can't choose Catima. The quick workaround is to make a screenshot in order to have an image of the barcode, and then share it to Catima. I also have some trouble with some PDF files for which the barcode is not found, making a screenshot make it work.
With the solution of downloading the PDF file, open it in PDF reader and share it to Catima (when it will working on my device, I think I have to install another pdf reader), the file is downloaded on my device and is not removed at the end. My code remove the file. You have also some more click : click the link -> click on the notification of file downloaded -> choose app to use -> click share ...
So, your application is great and very usefull for me. I will understand you are not agree to had this feature in.
When I click on link I received by SMS, the file is open in my web browser, because the link do not end with ".pdf", and the url do not return correct content-type.
Catima not opening a PDF file directly is expected, as there is only an intent filter for android.intent.action.SEND (which is the share action), see https://github.com/CatimaLoyalty/Android/blob/42638e3df63006a4375b0d34b349dd752bf82bc0/app/src/main/AndroidManifest.xml#L42-L49.
In my browser, I can download the file. And then open it in PDF viewer. But when I want to share from the PDF reader, I can't choose Catima.
That seems like it might be an issue with the PDF reader in question? I currently use Sav PDF Viewer and when I click Share it shows Catima. Please consider reporting the issue with your PDF reader :)
The quick workaround is to make a screenshot in order to have an image of the barcode, and then share it to Catima.
That makes sense. But maybe we can also just save you a tap by adding the PDF filter to an android.intent.action.VIEW intent, like is used for importing ZIP files on the ImportExportActivity? https://github.com/CatimaLoyalty/Android/blob/42638e3df63006a4375b0d34b349dd752bf82bc0/app/src/main/AndroidManifest.xml#L124-L132
I also have some trouble with some PDF files for which the barcode is not found, making a screenshot make it work.
Hmm, that sounds worrying. If you have an affected PDF that you're willing to share (perhaps after redacting it) a new issue for that would be great.
With the solution of downloading the PDF file, open it in PDF reader and share it to Catima (when it will working on my device, I think I have to install another pdf reader), the file is downloaded on my device and is not removed at the end. My code remove the file.
I understand that feels cleaner. It's kinda personal preference :)
You have also some more click : click the link -> click on the notification of file downloaded -> choose app to use -> click share ...
Hmm, yeah, fair. I think added the "VIEW" intents could also help to reduce this in a way that's much less code (so less complexity for me to maintain) and more "logical" and easier to find for end-users? :)
Hi,
I understand you do not want to include code which retrieve data from Internet. So, to not make you waste time with my code, I propose you to close my request.
Cordially.
Le mer. 9 oct. 2024 à 18:37, Sylvia van Os @.***> a écrit :
When I click on link I received by SMS, the file is open in my web browser, because the link do not end with ".pdf", and the url do not return correct content-type.
Catima not opening a PDF file directly is expected, as there is only an intent filter for android.intent.action.SEND (which is the share action), see https://github.com/CatimaLoyalty/Android/blob/42638e3df63006a4375b0d34b349dd752bf82bc0/app/src/main/AndroidManifest.xml#L42-L49 .
In my browser, I can download the file. And then open it in PDF viewer. But when I want to share from the PDF reader, I can't choose Catima.
That seems like it might be an issue with the PDF reader in question? I currently use Sav PDF Viewer https://apt.izzysoft.de/fdroid/index/apk/com.saverio.pdfviewer and when I click Share it shows Catima. Please consider reporting the issue with your PDF reader :)
The quick workaround is to make a screenshot in order to have an image of the barcode, and then share it to Catima.
That makes sense. But maybe we can also just save you a tap by adding the PDF filter to an android.intent.action.VIEW intent, like is used for importing ZIP files on the ImportExportActivity? https://github.com/CatimaLoyalty/Android/blob/42638e3df63006a4375b0d34b349dd752bf82bc0/app/src/main/AndroidManifest.xml#L124-L132
I also have some trouble with some PDF files for which the barcode is not found, making a screenshot make it work.
Hmm, that sounds worrying. If you have an affected PDF that you're willing to share (perhaps after redacting it) a new issue for that would be great.
With the solution of downloading the PDF file, open it in PDF reader and share it to Catima (when it will working on my device, I think I have to install another pdf reader), the file is downloaded on my device and is not removed at the end. My code remove the file.
I understand that feels cleaner. It's kinda personal preference :)
You have also some more click : click the link -> click on the notification of file downloaded -> choose app to use -> click share ...
Hmm, yeah, fair. I think added the "VIEW" intents could also help to reduce this in a way that's much less code (so less complexity for me to maintain) and more "logical" and easier to find for end-users? :)
— Reply to this email directly, view it on GitHub https://github.com/CatimaLoyalty/Android/pull/2099#issuecomment-2402804477, or unsubscribe https://github.com/notifications/unsubscribe-auth/AANU2U2KXSEZKZRS7X4J773Z2VLVHAVCNFSM6AAAAABPOIC3DSVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDIMBSHAYDINBXG4 . You are receiving this because you authored the thread.Message ID: @.***>
I was thinking it would still be useful to further talk about your use case to figure out if we can solve your issue with less "dangerous" permissions in Catima, but I understand if you're not interested in seeing if we can support your use case "well enough" some other way. Closed :)