|
21 | 21 | import java.util.concurrent.CopyOnWriteArrayList; |
22 | 22 |
|
23 | 23 | import io.snabble.sdk.encodedcodes.EncodedCodesOptions; |
| 24 | +import io.snabble.sdk.utils.IntRange; |
24 | 25 | import io.snabble.sdk.utils.JsonUtils; |
25 | 26 | import io.snabble.sdk.utils.SimpleActivityLifecycleCallbacks; |
26 | 27 | import okhttp3.OkHttpClient; |
@@ -55,6 +56,7 @@ public class Project { |
55 | 56 | private boolean verifyInternalEanChecksum; |
56 | 57 | private BarcodeFormat[] supportedBarcodeFormats; |
57 | 58 | private Shop checkedInShop; |
| 59 | + private Map<BarcodeFormat, IntRange> barcodeFormatRanges; |
58 | 60 |
|
59 | 61 | private Map<String, String> urls; |
60 | 62 |
|
@@ -160,6 +162,12 @@ void parse(JsonObject jsonObject) { |
160 | 162 | formats.add(BarcodeFormat.CODE_128); |
161 | 163 | } |
162 | 164 |
|
| 165 | + barcodeFormatRanges = new HashMap<>(); |
| 166 | + // TODO parse from metadata |
| 167 | + if (id.contains("ikea")) { |
| 168 | + barcodeFormatRanges.put(BarcodeFormat.ITF_14, new IntRange(0, 8)); |
| 169 | + } |
| 170 | + |
163 | 171 | supportedBarcodeFormats = formats.toArray(new BarcodeFormat[formats.size()]); |
164 | 172 |
|
165 | 173 | if (jsonObject.has("shops")) { |
@@ -334,6 +342,14 @@ public Checkout getCheckout() { |
334 | 342 | return checkout; |
335 | 343 | } |
336 | 344 |
|
| 345 | + public IntRange getRangeForBarcodeFormat(BarcodeFormat barcodeFormat) { |
| 346 | + if (barcodeFormatRanges != null) { |
| 347 | + return barcodeFormatRanges.get(barcodeFormat); |
| 348 | + } |
| 349 | + |
| 350 | + return null; |
| 351 | + } |
| 352 | + |
337 | 353 | Events getEvents() { |
338 | 354 | return events; |
339 | 355 | } |
|
0 commit comments