mirror of
https://github.com/CatimaLoyalty/Android.git
synced 2026-01-07 14:38:04 -05:00
Compare commits
20 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
417006cfa3 | ||
|
|
907a8578ca | ||
|
|
7e63babd47 | ||
|
|
c289bb0af3 | ||
|
|
80767e7cd6 | ||
|
|
90e6dd8738 | ||
|
|
d3de9c65e6 | ||
|
|
48993f0486 | ||
|
|
918c6fb41b | ||
|
|
d121841fdf | ||
|
|
95ace2aa39 | ||
|
|
b8cd52563d | ||
|
|
70754af167 | ||
|
|
80bad7ad56 | ||
|
|
e214d6d69e | ||
|
|
0e7509d966 | ||
|
|
58a5b16484 | ||
|
|
a8df588b33 | ||
|
|
ef948f16f1 | ||
|
|
11f942771f |
@@ -1,5 +1,10 @@
|
||||
# Changelog
|
||||
|
||||
## v2.41.3 - 160 (2026-01-04)
|
||||
|
||||
- Follow-up for fix in 2.41.2 for cards explicitly set to ISO-8859-1
|
||||
- Migrate old cards to ISO-8859-1 to fix sudden behaviour differences for existing cards
|
||||
|
||||
## v2.41.2 - 159 (2026-01-03)
|
||||
|
||||
- Fix change introduced in 2.41.0 that broke support for some scanners for non-UTF-8 barcodes
|
||||
|
||||
@@ -19,8 +19,8 @@ android {
|
||||
applicationId = "me.hackerchick.catima"
|
||||
minSdk = 21
|
||||
targetSdk = 36
|
||||
versionCode = 159
|
||||
versionName = "2.41.2"
|
||||
versionCode = 160
|
||||
versionName = "2.41.3"
|
||||
|
||||
vectorDrawables.useSupportLibrary = true
|
||||
multiDexEnabled = true
|
||||
|
||||
@@ -21,6 +21,7 @@ import com.google.zxing.common.StringUtils;
|
||||
|
||||
import java.lang.ref.WeakReference;
|
||||
import java.nio.charset.Charset;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
|
||||
@@ -184,23 +185,33 @@ public class BarcodeImageWriterTask implements CompatCallable<Bitmap> {
|
||||
MultiFormatWriter writer = new MultiFormatWriter();
|
||||
|
||||
Map<EncodeHintType, Object> encodeHints = new ArrayMap<>();
|
||||
Charset chosenEncoding = encoding;
|
||||
// Use charset if defined or guess otherwise
|
||||
if (encoding != null) {
|
||||
Log.d(TAG, "Encoding explicitly set, " + encoding.name());
|
||||
encodeHints.put(EncodeHintType.CHARACTER_SET, encoding);
|
||||
if (chosenEncoding != null) {
|
||||
Log.d(TAG, "Encoding explicitly set, " + chosenEncoding.name());
|
||||
} else {
|
||||
String guessedEncoding = StringUtils.guessEncoding(cardId.getBytes(), new ArrayMap<>());
|
||||
Log.d(TAG, "Guessed encoding: " + guessedEncoding);
|
||||
chosenEncoding = Charset.forName(StringUtils.guessEncoding(cardId.getBytes(), new ArrayMap<>()));
|
||||
Log.d(TAG, "Guessed encoding: " + chosenEncoding.name());
|
||||
}
|
||||
|
||||
// We don't want to pass the guessed encoding as an encoding hint unless it is UTF-8 as
|
||||
// zxing is likely to add the mentioned encoding hint as ECI inside the barcode.
|
||||
//
|
||||
// Due to many barcode scanners in the wild being badly coded they may trip over ECI
|
||||
// info existing and fail to scan, such as in https://github.com/CatimaLoyalty/Android/issues/2921
|
||||
if (Objects.equals(guessedEncoding, "UTF8")) {
|
||||
Log.d(TAG, "Guessed encoding is UTF8, so passing as encoding hint");
|
||||
encodeHints.put(EncodeHintType.CHARACTER_SET, Charset.forName(guessedEncoding));
|
||||
}
|
||||
// We don't want to pass the ISO-8859-1 as an encoding hint as zxing may add this as ECI
|
||||
// inside the barcode.
|
||||
//
|
||||
// Due to many barcode scanners in the wild being badly coded they may trip over ECI
|
||||
// info existing and fail to scan.
|
||||
// See:
|
||||
// - https://github.com/CatimaLoyalty/Android/issues/2921
|
||||
// - https://github.com/CatimaLoyalty/Android/issues/2932
|
||||
//
|
||||
// Just not always passing the encoding hint is slightly hacky, but in 5+ years of Catima
|
||||
// cards without encode hints have never caused any issues (unless they were UTF-8), yet
|
||||
// just days after passing ISO-8859-1 as CHARACTER_SET in the encode hints already 2
|
||||
// scan failures were reported (one for QR, one for Aztec).
|
||||
if (!Objects.equals(chosenEncoding.name(), StandardCharsets.ISO_8859_1.name())) {
|
||||
Log.d(TAG, "Chosen encoding is not ISO_8859_1, so passing as encoding hint");
|
||||
encodeHints.put(EncodeHintType.CHARACTER_SET, chosenEncoding);
|
||||
} else {
|
||||
Log.d(TAG, "Not passing encoding as encoding hint");
|
||||
}
|
||||
|
||||
BitMatrix bitMatrix;
|
||||
|
||||
@@ -26,7 +26,7 @@ import java.util.Set;
|
||||
public class DBHelper extends SQLiteOpenHelper {
|
||||
public static final String DATABASE_NAME = "Catima.db";
|
||||
public static final int ORIGINAL_DATABASE_VERSION = 1;
|
||||
public static final int DATABASE_VERSION = 18;
|
||||
public static final int DATABASE_VERSION = 19;
|
||||
|
||||
// NB: changing these values requires a migration
|
||||
public static final int DEFAULT_ZOOM_LEVEL = 100;
|
||||
@@ -345,6 +345,17 @@ public class DBHelper extends SQLiteOpenHelper {
|
||||
db.execSQL("ALTER TABLE " + LoyaltyCardDbIds.TABLE
|
||||
+ " ADD COLUMN " + LoyaltyCardDbIds.BARCODE_ENCODING + " TEXT");
|
||||
}
|
||||
|
||||
// On upgrade to 2.41.3, force all existing "Automatic" cards to ISO-8859-1.
|
||||
// UTF-8 support was only added in 2.42.0, before that, all barcodes were saved without
|
||||
// any encoding info. As many scanners deal badly with ECI info, automatically guessing
|
||||
// UTF-8 for old barcodes may break them.
|
||||
//
|
||||
// New cards will be saved using either "Automatic" encoding to guess or, for pkpass files,
|
||||
// whatever encoding is specified.
|
||||
if (oldVersion < 19 && newVersion >= 19) {
|
||||
db.execSQL("UPDATE " + LoyaltyCardDbIds.TABLE + " SET " + LoyaltyCardDbIds.BARCODE_ENCODING + " = 'ISO-8859-1' WHERE " + LoyaltyCardDbIds.BARCODE_ENCODING + " IS NULL");
|
||||
}
|
||||
}
|
||||
|
||||
public static Set<String> imageFiles(Context context, final SQLiteDatabase database) {
|
||||
|
||||
@@ -459,8 +459,11 @@ public class CatimaImporter implements Importer {
|
||||
barcodeType = CatimaBarcode.fromName(unparsedBarcodeType);
|
||||
}
|
||||
|
||||
// Barcode encoding information is only supported since Catima 2.41.0, so old exports will lack this field
|
||||
// Database migration 19 forcing ISO-8859-1 on all cards, so we should treat imports from old Catima versions the same and force ISO-8859-1 there too
|
||||
// This limits the risk of breaking cards when importing an old database backup
|
||||
Charset barcodeEncoding = null;
|
||||
String unparsedBarcodeEncoding = CSVHelpers.extractString(DBHelper.LoyaltyCardDbIds.BARCODE_ENCODING, record, "");
|
||||
String unparsedBarcodeEncoding = CSVHelpers.extractString(DBHelper.LoyaltyCardDbIds.BARCODE_ENCODING, record, "ISO-8859-1");
|
||||
if (!unparsedBarcodeEncoding.isEmpty()) {
|
||||
barcodeEncoding = Charset.forName(unparsedBarcodeEncoding);
|
||||
}
|
||||
|
||||
@@ -7,8 +7,8 @@ Heimen Stoffels
|
||||
Oğuz Ersen
|
||||
FC (Fay) Stegerman
|
||||
StoyanDimitrov
|
||||
大王叫我来巡山
|
||||
B o d o
|
||||
大王叫我来巡山
|
||||
SlavekB
|
||||
Katharine Chui
|
||||
mondstern
|
||||
@@ -18,12 +18,12 @@ Altonss
|
||||
Edgars Andersons
|
||||
Joel A
|
||||
Michael Moroni
|
||||
Liner Seven
|
||||
Priit Jõerüüt
|
||||
Liner Seven
|
||||
Eric
|
||||
Fjuro
|
||||
Максим Горпиніч
|
||||
GitSpoon
|
||||
Fjuro
|
||||
GM
|
||||
Petr Novák
|
||||
laralem
|
||||
@@ -33,14 +33,14 @@ pfaffenrodt
|
||||
Aayush Gupta
|
||||
Scrambled777
|
||||
josé m
|
||||
Nyatsuki
|
||||
ikanakova
|
||||
Vasilis
|
||||
ikanakova
|
||||
Nyatsuki
|
||||
Kachelkaiser
|
||||
Giovanni Donisi
|
||||
Milo Ivir
|
||||
Горпиніч Максим Олександрович
|
||||
HudobniVolk
|
||||
Горпиніч Максим Олександрович
|
||||
Jiri Grönroos
|
||||
Warder
|
||||
Samantaz Fox
|
||||
@@ -48,18 +48,19 @@ Balázs Meskó
|
||||
109247019824
|
||||
Feike Donia
|
||||
Arno-github
|
||||
Ankit Tiwari
|
||||
Cliff Heraldo
|
||||
Sergio Paredes
|
||||
Ankit Tiwari
|
||||
Jose Delvani
|
||||
Robin
|
||||
Milan Šalka
|
||||
mdvhimself
|
||||
Milan Šalka
|
||||
AMIR-G98
|
||||
Robin
|
||||
தமிழ்நேரம்
|
||||
huuhaa
|
||||
Skrripy
|
||||
Govindgopalyadav
|
||||
damjang
|
||||
Skrripy
|
||||
huuhaa
|
||||
waffshappen
|
||||
Marnick L'Eau
|
||||
ngocanhtve
|
||||
@@ -67,19 +68,18 @@ aradxxx
|
||||
StellarSand
|
||||
Quentin PAGÈS
|
||||
Projjal Moitra
|
||||
Aliaksandr Trush
|
||||
e-michalak
|
||||
JungHee Lee
|
||||
AMIR-G98
|
||||
hajertabbane
|
||||
inavleb
|
||||
Ziad OUALHADJ
|
||||
Aliaksandr Trush
|
||||
Denis Shilin
|
||||
Traductor
|
||||
Gideon
|
||||
Renko
|
||||
Ricky Tigg
|
||||
Robin Liu
|
||||
Ricky Tigg
|
||||
Renko
|
||||
Gideon
|
||||
Traductor
|
||||
Denis Shilin
|
||||
しいたけ
|
||||
Alexander Ivanov
|
||||
Miha Frangež
|
||||
@@ -88,13 +88,14 @@ mrestivill
|
||||
ehrt74
|
||||
Virginie
|
||||
Tim Trek
|
||||
Peter Dave Hello
|
||||
Alì Mortacci
|
||||
MisterCosta96
|
||||
arshbeerSingh
|
||||
Augustin LAVILLE
|
||||
Freddo espresso
|
||||
vasudev-cell
|
||||
Vasudev R.
|
||||
Kim Seohyun
|
||||
rudy3
|
||||
Michael Gangolf
|
||||
PRATHAMESH BHAGAT
|
||||
Peter Dave Hello
|
||||
|
||||
@@ -299,4 +299,7 @@
|
||||
<string name="copy_value">Копиране на стойността</string>
|
||||
<string name="copied_to_clipboard">Копирано</string>
|
||||
<string name="nothing_to_copy">Няма стойност</string>
|
||||
<string name="back">Назад</string>
|
||||
<string name="automatic">Автоматично</string>
|
||||
<string name="barcodeEncoding">Кодиране на щрихкода</string>
|
||||
</resources>
|
||||
|
||||
@@ -305,4 +305,7 @@
|
||||
<string name="copy_value">Kopírovat hodnotu</string>
|
||||
<string name="copied_to_clipboard">Zkopírováno do schránky</string>
|
||||
<string name="nothing_to_copy">Nenalezena žádná hodnota</string>
|
||||
<string name="barcodeEncoding">Kódování čárového kódu</string>
|
||||
<string name="automatic">Automatické</string>
|
||||
<string name="back">Zpět</string>
|
||||
</resources>
|
||||
|
||||
@@ -100,7 +100,7 @@
|
||||
<string name="importLoyaltyCardKeychain">Aus Loyalty Card Keychain importieren</string>
|
||||
<string name="importFidmeMessage">Wähle deinen „FidMe-Export“ zum Importieren und anschließend manuell die Barcodetypen aus.\nErstelle ihn aus deinem FidMe-Profil, indem du Datenschutz wählst und dann auf Meine Daten extrahieren drückst.</string>
|
||||
<string name="importFidme">Aus FidMe importieren</string>
|
||||
<string name="importCatimaMessage">Wähle deinen „Catima-Export“ zum Importieren aus.\nErstelle diesen durch das Drücken auf Export im Import/Export-Menü in einer anderen Catima-Anwendung.</string>
|
||||
<string name="importCatimaMessage">Wähle deinen „Catima-Export“ zum Importieren aus.\nExportiere diesen zuvor im Import/Export-Menü einer anderen Catima-Anwendung.</string>
|
||||
<string name="importCatima">Aus Catima importieren</string>
|
||||
<string name="setBarcodeId">Barcodewert festlegen</string>
|
||||
<string name="sameAsCardId">Entspricht Kartennummer</string>
|
||||
|
||||
@@ -145,7 +145,7 @@
|
||||
<string name="privacy_policy">Privātuma politika</string>
|
||||
<string name="accept">Pieņemt</string>
|
||||
<string name="editGroup">Kopas labošana: <xliff:g>%s</xliff:g></string>
|
||||
<string name="app_copyright_fmt" tools:ignore="PluralsCandidate">Autortiesības © 2019–<xliff:g>%d</xliff:g> Sylvia van Os</string>
|
||||
<string name="app_copyright_fmt" tools:ignore="PluralsCandidate">Autortiesības © 2019–<xliff:g>%d</xliff:g> Sylvia van Os un līdzdalībnieki</string>
|
||||
<string name="app_copyright_old">Balstīta uz Loyalty Card Keychain
|
||||
\nautortiesības © 2016–2020 Branden Archer</string>
|
||||
<string name="debug_version_fmt">Versija: <xliff:g id="version">%s</xliff:g></string>
|
||||
|
||||
@@ -497,7 +497,7 @@ public class DatabaseTest {
|
||||
assertEquals("cardId", card.cardId);
|
||||
assertEquals(null, card.barcodeId);
|
||||
assertEquals(BarcodeFormat.UPC_A, card.barcodeType.format());
|
||||
assertEquals(null, card.barcodeEncoding);
|
||||
assertEquals(StandardCharsets.ISO_8859_1, card.barcodeEncoding); // Old cards are assumed to be ISO-8859-1
|
||||
assertEquals(null, card.headerColor);
|
||||
assertEquals(0, card.starStatus);
|
||||
assertEquals(0, card.lastUsed);
|
||||
@@ -515,7 +515,7 @@ public class DatabaseTest {
|
||||
assertEquals("cardId", card2.cardId);
|
||||
assertEquals(null, card2.barcodeId);
|
||||
assertEquals(null, card2.barcodeType); // Empty string should've become null
|
||||
assertEquals(null, card.barcodeEncoding);
|
||||
assertEquals(StandardCharsets.ISO_8859_1, card.barcodeEncoding); // Old cards are assumed to be ISO-8859-1
|
||||
assertEquals(null, card2.headerColor);
|
||||
assertEquals(0, card2.starStatus);
|
||||
assertEquals(0, card2.lastUsed);
|
||||
|
||||
@@ -669,7 +669,7 @@ public class ImportExportTest {
|
||||
assertEquals("12345", card.cardId);
|
||||
assertEquals(null, card.barcodeId);
|
||||
assertEquals(BarcodeFormat.AZTEC, card.barcodeType.format());
|
||||
assertEquals(null, card.barcodeEncoding);
|
||||
assertEquals(StandardCharsets.ISO_8859_1, card.barcodeEncoding); // Old cards are assumed to be ISO-8859-1
|
||||
assertNull(card.headerColor);
|
||||
assertEquals(0, card.starStatus);
|
||||
|
||||
@@ -696,7 +696,7 @@ public class ImportExportTest {
|
||||
assertEquals("12345", card.cardId);
|
||||
assertEquals(null, card.barcodeId);
|
||||
assertEquals(BarcodeFormat.AZTEC, card.barcodeType.format());
|
||||
assertEquals(null, card.barcodeEncoding);
|
||||
assertEquals(StandardCharsets.ISO_8859_1, card.barcodeEncoding); // Old cards are assumed to be ISO-8859-1
|
||||
assertNull(card.headerColor);
|
||||
assertEquals(0, card.starStatus);
|
||||
|
||||
@@ -735,7 +735,7 @@ public class ImportExportTest {
|
||||
assertEquals("12345", card.cardId);
|
||||
assertEquals(null, card.barcodeId);
|
||||
assertEquals(null, card.barcodeType);
|
||||
assertEquals(null, card.barcodeEncoding);
|
||||
assertEquals(StandardCharsets.ISO_8859_1, card.barcodeEncoding); // Old cards are assumed to be ISO-8859-1
|
||||
assertEquals(1, (long) card.headerColor);
|
||||
assertEquals(0, card.starStatus);
|
||||
|
||||
@@ -762,7 +762,7 @@ public class ImportExportTest {
|
||||
assertEquals("12345", card.cardId);
|
||||
assertEquals(null, card.barcodeId);
|
||||
assertEquals(BarcodeFormat.AZTEC, card.barcodeType.format());
|
||||
assertEquals(null, card.barcodeEncoding);
|
||||
assertEquals(StandardCharsets.ISO_8859_1, card.barcodeEncoding); // Old cards are assumed to be ISO-8859-1
|
||||
assertEquals(1, (long) card.headerColor);
|
||||
assertEquals(1, card.starStatus);
|
||||
|
||||
@@ -789,7 +789,7 @@ public class ImportExportTest {
|
||||
assertEquals("12345", card.cardId);
|
||||
assertEquals(null, card.barcodeId);
|
||||
assertEquals(BarcodeFormat.AZTEC, card.barcodeType.format());
|
||||
assertEquals(null, card.barcodeEncoding);
|
||||
assertEquals(StandardCharsets.ISO_8859_1, card.barcodeEncoding); // Old cards are assumed to be ISO-8859-1
|
||||
assertEquals(1, (long) card.headerColor);
|
||||
assertEquals(0, card.starStatus);
|
||||
|
||||
@@ -823,7 +823,7 @@ public class ImportExportTest {
|
||||
assertEquals("12345", card.cardId);
|
||||
assertEquals(null, card.barcodeId);
|
||||
assertEquals(BarcodeFormat.AZTEC, card.barcodeType.format());
|
||||
assertEquals(null, card.barcodeEncoding);
|
||||
assertEquals(StandardCharsets.ISO_8859_1, card.barcodeEncoding); // Old cards are assumed to be ISO-8859-1
|
||||
assertEquals(1, (long) card.headerColor);
|
||||
assertEquals(0, card.starStatus);
|
||||
|
||||
|
||||
2
fastlane/metadata/android/en-US/changelogs/160.txt
Normal file
2
fastlane/metadata/android/en-US/changelogs/160.txt
Normal file
@@ -0,0 +1,2 @@
|
||||
- Follow-up for fix in 2.41.2 for cards explicitly set to ISO-8859-1
|
||||
- Migrate old cards to ISO-8859-1 to fix sudden behaviour differences for existing cards
|
||||
Reference in New Issue
Block a user