Open TheLastProject opened 4 years ago
Comment by brarcher Thursday Sep 12, 2019 at 06:18 GMT
This app uses the ZXing library for barcode support. Looking at the list of formats supported by that library:
https://github.com/zxing/zxing/#supported-formats
it does not appear that it is supported. If that project supported the format, there may be a case for adding support for it here also. That project is in maintenance mode, though, so I'm not sure how likely it is.
Comment by jeroen7s Saturday Sep 14, 2019 at 15:42 GMT
Pkpass is not directly a barcode format, but a file format containing info card-ids/private keys instead of a numeric barcode, which would make it outside of the scope of the zxing project
Comment by brarcher Monday Sep 16, 2019 at 04:17 GMT
Ah. If that is the case, what specifically is the ask? Is it to display the barcode data differently if it is pkpass?
Comment by TheLastProject Sunday Dec 08, 2019 at 23:22 GMT
I've done a bit of research on this. Pkpass is commonly used for tickets (think plane tickets or CCC). They're actually zip files containing a pass.json file together with some other to us unimportant stuff.
Taking as example https://github.com/keefmoon/Passbook-Example-Code/blob/master/Pass-Example-Generic/Pass-Example-Generic.pkpass
The pass.json file looks as follows:
{
"passTypeIdentifier" : "pass.keefmoon.example-generic",
"formatVersion" : 1,
"teamIdentifier" : "YAXJZJ267E",
"organizationName" : "Passbook Example Company",
"serialNumber" : "0000001",
"description" : "Staff Pass for Employee Number 001",
"associatedStoreIdentifiers" : [
284971959
],
"locations" : [
{"latitude" : 51.50506, "longitude" : -0.01960, "relevantText" : "Company Offices" }
],
"foregroundColor" : "rgb(255, 255, 255)",
"backgroundColor" : "rgb(90, 90, 90)",
"labelColor" : "rgb(255, 255, 255)",
"logoText" : "Company Staff ID",
"barcode" : {
"format" : "PKBarcodeFormatQR",
"message" : "0000001",
"messageEncoding" : "iso-8859-1",
"altText" : "Staff ID 0000001"
},
"generic" : {
"headerFields" : [
{
"key" : "staffNumber",
"label" : "Staff Number",
"value" : "001"
}
],
"primaryFields" : [
{
"key" : "staffName",
"label" : "Name",
"value" : "Peter Brooke"
}
],
"secondaryFields" : [
{
"key" : "telephoneExt",
"label" : "Extension",
"value" : "9779"
},
{
"key" : "jobTitle",
"label" : "Job Title",
"value" : "Chief Pass Creator"
}
],
"auxiliaryFields" : [
{
"key" : "expiryDate",
"dateStyle" : "PKDateStyleShort",
"label" : "Expiry Date",
"value" : "2013-12-31T00:00-23:59"
}
],
"backFields" : [
{
"key" : "managersName",
"label" : "Manager's Name",
"value" : "Paul Bailey"
},
{
"key" : "managersExt",
"label" : "Manager's Extension",
"value" : "9673"
}
]
}
}
While containing a lot more info than a loyalty card, we could most likely just use the description as name and the info in the barcode JSON field to generate the barcode. And maybe somehow put some of the other info in notes after supporting multiline notes first.
So, supporting this would be:
Actually not super hard. I think it makes sense to support, although probably only in a basic form. There are other apps like PassAndroid which support this format fully and are better suited for the more complex cases.
Comment by TheLastProject Monday Dec 09, 2019 at 16:18 GMT
I started with this in #327.
@jeroen7s As you requested this feature, is there any way you could possibly supply me with some pkpass files and screenshots of how they look like in other apps, if you have any you are willing to share? That will help me ensure the best possible result as I know better what to work towards.
Comment by jeroen7s Monday Dec 09, 2019 at 22:16 GMT
Thanks for working on this, much appreciated. Found an old plane ticket in my Signal conversations you can use. Here's the File: https://intuxikated.stackstorage.com/s/LbC7LhgNnvF6CPzz And a screenshot of how it looks in the "StoCard" app on the play store:
P.s. I wasn't aware there was already an open source app for this, couldn't find "PassBook" at the time, though having it inside the same app as my loyalty cards would be really nice :)
Comment by TheLastProject Wednesday Dec 11, 2019 at 13:35 GMT
Would it be acceptable if I add your flight ticket as a test case? I assume you're not worried about privacy risks because you already posted it on a public bugtracker, but I'd like to make sure just in case.
Comment by TheLastProject Wednesday Dec 11, 2019 at 13:45 GMT
On an unrelated note, I absolutely love how the first in-the-wild card I get sent to test with violates the spec every so slightly (incorrect colour code format). Good job, Eurowings!
Comment by jeroen7s Wednesday Dec 11, 2019 at 13:55 GMT
You can use it for a test-case, however i'd prefer it if you blank out my name tho :D, aside from that you can use it.
Comment by TheLastProject Saturday Dec 14, 2019 at 19:59 GMT
Just sharing some progress. Still quite a lot of work left, especially because of the whole i18n system.
Comment by jeroen7s Monday Dec 16, 2019 at 11:28 GMT
Looks like a great start. Do you really need the i18n tho? I think you could add it without translations as a first step and then add translations later?
Comment by TheLastProject Monday Dec 16, 2019 at 11:29 GMT
Basic i18n is already working, see pull request :)
Comment by devurandom Sunday Feb 02, 2020 at 08:36 GMT
Have a look at https://github.com/ligi/PassAndroid, maybe you can borrow / share some code.
Okay so... looking back at my code now... wow it was not maintainable. I am very glad @brarcher never merged it back in the days.
Basically, this needs a complete rewrite. From scratch.
While https://github.com/TheLastProject/Catima/pull/69 can be used as reference, https://github.com/ligi/PassAndroid should be taken as reference much more.
So, it anyone wants to rewrite this (because I still think it is welcome in Catima):
LoyaltyCardDbIds
table like I did. The format is just way too different. At most, create an entry in LoyaltyCardDbIds
for the basics (so it can be nicely integrated in the rest of the app) with the LoyaltyCardDbIds.ID
field being refered to in your PkPass
table.I'm sorry for dropping this after all this time, but PassAndroid is a very good app and my previous implementation was just not maintainable. I am willing to help anyone who wants to take this up though!
I'm sorry for dropping this after all this time, but PassAndroid is a very good app and my previous implementation was just not maintainable. I am willing to help anyone who wants to take this up though!
I recently discovered https://apps.kde.org/fr/itinerary/ which seems to work very fine also for tickets (train/plane...) :)
I'm sorry for dropping this after all this time, but PassAndroid is a very good app and my previous implementation was just not maintainable. I am willing to help anyone who wants to take this up though!
I recently discovered https://apps.kde.org/fr/itinerary/ which seems to work very fine also for tickets (train/plane...) :)
Does KDE Itinerary also do Catima stuff like loyalty cards, gift cards, etc? It would be nice to have one app that handles EVERYTHING involving a bar/QR code...
I stumbled here looking for pkpass support. I've been using PassAndroid with a similar feature set. There you can also import pkpass files. How about looking for hints in the code there? https://github.com/ligi/PassAndroid
I love Catima when I first tested it but then I realized it cannot import pkpass. Since 3 years it's not possible when I read the issues. What's so complicated? Everything is described in the first comments.
Unzip .pkpass file
Parse relevant info from pass.json
Maybe put some stuff in notes
Discard the rest(?)
This could be done in a few hours. I program in C# so I'm not much help with Java. How can we get this integrated fast? I'm willing so support this with money.
Since 3 years it's not possible when I read the issues. What's so complicated?
The worst complexity is the internationalisation part I suppose. But primarily, the issue is that Catima is a side project and I have a fulltime job and I want to also have time left to spend on other things in my life :)
A lot has changed in Catima since I last put time into this feature though, so it may be easier or harder now, no clue.
This could be done in a few hours.
Given I tried this before (as mentioned in https://github.com/CatimaLoyalty/Android/issues/48#issuecomment-770450592) I very much doubt it's that simple. Adding a feature in a maintainable way and ensuring stability in a wide range of conditions tends to take a fair share of time too.
(Also, assuming every open issue is "just a few hours" that's still over 100 hours of work. Everyone always considers their own feature most important, so someone is going to be upset no matter what I prioritized and I learned to just prioritize for my own needs)
How can we get this integrated fast?
There is probably no way to get this integrated fast because I still have a huge to-do list (see all the open Pull Requests, it'd be rude to ignore those who already submitted code) and I kinda burned myself out over Hacktoberfest (I was spending pretty much all my spare time every single day on Catima during it).
The fastest way is probably for someone else to work on this, but I have seen that recently a lot of people are interested in this feature again (I haven't heard any request for this feature in years, it is mostly the last few weeks after Catima got mentioned in C't so it mostly seems to be a popular feature in Germany) so I may pick it up after I've finally gotten to dealing with the currently open pull requests but that'll take a while still.
It would be great to have this.. Pkpass is pretty much an industry standard now, and because Android doesn't have a competing standard, I see companies gravitating more towards it. Airline tickets, event tickets etc. I'm in Spain by the way, not Germany but it's used a lot here too.
Right now I use StoCard but it's a horrible datamining app, I didn't know about PassAndroid, I will try it instead. But if Catima could do it that would be so great :) Not trying to push because I understand that your hands are full :) But I just wanted to explain the desire for this feature.
PS: Thanks for all your work on Catima, it's a really nice app.
I'm hoping to look into supporting this sometime soon.
For the sake of completeness, it is worth mentioning that this standard was developed with the support of Apple Inc., and the main documentation is located at https://developer.apple.com/documentation/passkit_apple_pay_and_wallet/pkpass
I'm trying to take another stab at this in my spare time. I'm having some trouble hunting down good test cases though. So if you have any .pkpass files, especially ones with localization, that you're okay with sharing that would be great. It would be even greater if I'd be allowed to include your .pkpass files in the Catima git repository as unit tests. Feel free to censor some parts (but please do tell me what you censored so I know the manifest correctly won't match and what to look at if things behave weird).
If you have some passes you're willing to share with me but not post publicly, feel free to email the email on my GitHub profile :) Thanks!
Edit: Thank you GitHub and Fediverse users! I think I have enough passes with a wide enough variety to be able to implement this well :)
Issue by jeroen7s Saturday Sep 07, 2019 at 14:40 GMT Originally opened as https://github.com/brarcher/loyalty-card-locker/issues/309
.pkpass is a file format specifically for "tickets, passes, coupons or member cards, and also student IDs, loyalty cards"
https://www.file-extension.info/format/pkpass
It's supported by some other popular apps like StoCard, and used by airlines