-
-
Notifications
You must be signed in to change notification settings - Fork 280
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: 4947 - added "download language" to product table #4951
Conversation
Deleted file: * `dao_product_migration.dart` Impacted files: * `background_task_download_products.dart`: added language parameter * `dao_hive_product.dart`: removed dead code * `dao_product.dart`: added table column language `lc` * `local_database.dart`: upgraded the database version * `onboarding_data_product.dart`: added language parameter * `product_list_page.dart`: added language parameter * `product_refresher.dart`: added language parameter * `query_product_list_supplier.dart`: added language parameter
Codecov ReportAttention:
Additional details and impacted files@@ Coverage Diff @@
## develop #4951 +/- ##
==========================================
+ Coverage 9.65% 9.66% +0.01%
==========================================
Files 323 322 -1
Lines 16207 16175 -32
==========================================
Hits 1564 1564
+ Misses 14643 14611 -32 ☔ View full report in Codecov by Sentry. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks a lot @monsieurtanuki
|
||
LazyBox<Product> _getBox() => Hive.lazyBox<Product>(_hiveBoxName); | ||
|
||
Future<Product?> get(final String barcode) async => _getBox().get(barcode); | ||
|
||
@override | ||
Future<Map<String, Product>> getAll(final List<String> barcodes) async { | ||
final LazyBox<Product> box = _getBox(); | ||
final Map<String, Product> result = <String, Product>{}; | ||
for (final String barcode in barcodes) { | ||
final Product? product = await box.get(barcode); | ||
if (product != null) { | ||
result[barcode] = product; | ||
} | ||
} | ||
return result; | ||
} | ||
|
||
Future<void> put(final Product product) async => putAll(<Product>[product]); | ||
|
||
Future<void> putAll(final Iterable<Product> products) async { | ||
final Map<String, Product> upserts = <String, Product>{}; | ||
for (final Product product in products) { | ||
upserts[product.barcode!] = product; | ||
} | ||
await _getBox().putAll(upserts); | ||
} | ||
|
||
@override | ||
Future<List<String>> getAllKeys() async { | ||
final LazyBox<Product> box = _getBox(); | ||
final List<String> result = <String>[]; | ||
for (final dynamic key in box.keys) { | ||
result.add(key.toString()); | ||
} | ||
return result; | ||
} | ||
|
||
// Just for the migration | ||
@override | ||
Future<void> deleteAll(final List<String> barcodes) async { | ||
final LazyBox<Product> box = _getBox(); | ||
await box.deleteAll(barcodes); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Did you test if this part removal will work or also break the whole app, nontheless we should keep an eye out in the beta
Thank you @M123-dev for your review! |
What
Part of
Files
Deleted file:
dao_product_migration.dart
Impacted files:
background_task_download_products.dart
: added language parameterdao_hive_product.dart
: removed dead codedao_product.dart
: added table column languagelc
local_database.dart
: upgraded the database versiononboarding_data_product.dart
: added language parameterproduct_list_page.dart
: added language parameterproduct_refresher.dart
: added language parameterquery_product_list_supplier.dart
: added language parameter