feat: 5099 - new dev mode item to refresh all the products from the server (#5100)

Impacted files:
* `dao_product.dart`: new method `clearAllLanguages`
* `pubspec.lock`: wtf
* `user_preferences_dev_mode.dart`: added a "Refresh all products from server (cf. Nutriscore v2)" item
This commit is contained in:
monsieurtanuki
2024-04-08 13:08:47 +02:00
committed by GitHub
parent cd563f5d12
commit c6077dce33
2 changed files with 24 additions and 0 deletions

View File

@ -302,4 +302,15 @@ class DaoProduct extends AbstractSqlDao implements BulkDeletable {
return result;
}
/// Sets the language of all products to null.
///
/// This is useful to refresh the whole database, as products without language
/// are easy to detect. And therefore we can say "refresh all the products
/// with a language null or different from the current app language", and use
/// the same mechanism as "switch language and refresh products accordingly".
Future<int> clearAllLanguages() async => localDatabase.database.update(
_TABLE_PRODUCT,
<String, Object?>{_TABLE_PRODUCT_COLUMN_LANGUAGE: null},
);
}