CatimaLoyalty / Android

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

Barcode of Austria's largest loyalty program (JÖ Bonus Club) not supported? #181

Open ILoveFOSS opened 3 years ago

ILoveFOSS commented 3 years ago

Hi!

(First I really want to thank all contributors for this project! It's a great tool and allows getting rid of all the privacy invading apps on my phone and the cards out of my wallet. I have been using stocard until recently but am very happy finding a FOSS alternative!)

I started moving my cards from Stocard to Catima and discovered that the Barcode of JÖ Bonus Club is successfully and correctly scanned but can't be displayed. Catima only shows me the numbers in plain text but no scanable version. To be fair the used barcode is quite unique, and I have never seen a similar one. Also, REWE is trying hard to hide the used barcode. On all their websites they only show the front of their card but never it's back. However, I was able to find a publicly available example (this is not my personal card): Picture Here is the link to the website if required: https://colnect.com/en/functional_cards/functional_card/52512-%C3%96sterreichs_BonusClub-J%C3%96-Shops-_Supermarkets-Austria

Additional info: The JÖ Club is like a meta-loyalty program of all stores belonging to REWE Group and some other companies in Austria. You could also describe it as a copycat of the Payback loyalty program.

I would be very grateful if this barcode could be supported in an upcoming version! Thank you!

TheLastProject commented 3 years ago

Oh geez, that is... definitely quite unique yes.

The very interesting part is that if I scan it in Stocard, then take a screenshot and import that screenshot in Catima it shows Barcode type as RSS_EXPANDED but doesn't show an actual barcode.

Further research shows that I can enforce this to be detected, but then the following happens:

E/Catima: Failed to generate barcode of type RSS_EXPANDED: (01)09010374000019(21)02097564604859211217(10)01231287693
    com.google.zxing.WriterException: java.lang.IllegalArgumentException: No encoder available for format RSS_EXPANDED

So, the library used (zxing), can detect, but doesn't support generating RSS_EXPANDED barcodes.

Looking at https://github.com/zxing/zxing/blob/master/core/src/main/java/com/google/zxing/MultiFormatWriter.java, no new writing support has been added in 6 years, and zxing itself is in maintenance mode. The best fix would probably to switch to another more maintained library, preferably a more maintained fork of zxing.

So, while I do want to support this, the amount of work is sadly likely substantial so this won't happen soon.

TheLastProject commented 3 years ago

Hmm, it looks like zxing does support PRs with new features: https://github.com/zxing/zxing/pulls?q=is%3Apr+is%3Aclosed

So this may be possible to add to zxing, would be the least painful method probably.

ILoveFOSS commented 3 years ago

I couldn't let go of this and tried to generate a JÖ Bonus Club barcode with an existing software as I can't code at all but wanted to support the development somehow. It took some research but I was successful eventually.

It was possible to generate it with the portableapps.com version of the Zint project: https://github.com/woo-j/zint, so the OkapiBarcode library might be able to do it too as it seems to be from the same person.

XZing calls the barcode RSS Expanded, that name is outdated however. Its name since 2007 is GS1 DataBar and the version used by JÖ Club is GS1 DataBar Expanded Stacked with 8 segments: grafik grafik

I hope this reduces the research time required for the person who can actually code this.

TheLastProject commented 3 years ago

Thanks for the research, I'm sure it will help someone :)

So there are pretty much the following options:

  1. Add it to zxing (preferred if possible because the lowest amount of code changes necessary) or a fork of it (if a fork, preferably one that supports Java 7 still because of https://github.com/zxing/zxing/issues/1170, but I'm willing to keep my own fork with a patch restoring pre-Android 7 support if really necessary)
  2. Help OkapiBarcode support Android: https://github.com/woo-j/OkapiBarcode/issues/82
ILoveFOSS commented 3 years ago

As 1. would clearly be a lot more efficient (it only requires an extension of existing functionality and not broad code changes in two independent projects), I was digging a little deeper. As OkapiBarcode is written in Java such as Zxing, my naive perspective makes me believes that porting the capability is comparably straightforward?

This should be the file responsible for encoding GS1 DataBar Expanded in OkapiBarcode

TheLastProject commented 3 years ago

Yeah, basically that should be it as I understand it too.

https://github.com/zxing/zxing/tree/master/core/src/main/java/com/google/zxing/oned/rss contains several readers, but not a writer. Looking at another writer in https://github.com/zxing/zxing/tree/master/core/src/main/java/com/google/zxing/oned, refactoring the OkapiBarcode code to fit within the functions zxing defines should be the easiest way to support this.

TheLastProject commented 2 years ago

Got an email about this so a summary here: Someone needs to add this to zxing first.