Refactor to allow updating a loyalty card from a bundle (#2051)

This allows us to send any (partial) loyalty card into the edit
activity, granting us greater flexibility in what kind of scan result we
can parse
This commit is contained in:
Sylvia van Os
2024-09-22 10:20:58 +02:00
committed by GitHub
parent 94cee771bd
commit 727d9ce781
19 changed files with 665 additions and 344 deletions

View File

@@ -332,7 +332,7 @@ public class DBHelper extends SQLiteOpenHelper {
Set<String> files = new HashSet<>();
Cursor cardCursor = getLoyaltyCardCursor(database);
while (cardCursor.moveToNext()) {
LoyaltyCard card = LoyaltyCard.toLoyaltyCard(cardCursor);
LoyaltyCard card = LoyaltyCard.fromCursor(cardCursor);
for (ImageLocationType imageLocationType : ImageLocationType.values()) {
String name = Utils.getCardImageFileName(card.id, imageLocationType);
if (Utils.retrieveCardImageAsFile(context, name).exists()) {
@@ -542,7 +542,7 @@ public class DBHelper extends SQLiteOpenHelper {
if (data.getCount() == 1) {
data.moveToFirst();
card = LoyaltyCard.toLoyaltyCard(data);
card = LoyaltyCard.fromCursor(data);
}
data.close();