159 Commits

Author SHA1 Message Date
e3bc40fdf3 chore: Migration to Dart 3.8 (#6668)
* Migration to Dart 3.8

* New GA

* Fix dartdoc
2025-06-23 18:14:17 +02:00
46b8735e09 Cache front picture (#6217) 2025-01-19 12:13:20 +01:00
d7b876cd45 fix: 5933 - less greedy language refresh (#6038)
* fix: 5933 - less greedy language refresh

Impacted files:
* `background_task_language_refresh.dart`: now we restart only the dedicated product type queue instead of all
* `operation_type.dart`: new `getProductType` method; minor refactoring
* `offline_tasks_page.dart`: display the product type for tasks, when available

* Optimized database query

* Typo fix
2025-01-04 09:36:23 +01:00
43c6743b5c fix: 5970 - SQLITE error "typo" (#5971) 2024-11-30 13:03:41 +01:00
0430192bc3 fix: osm_key duplicate column name (#5960)
* Update dao_osm_location.dart

* Update packages/smooth_app/lib/database/dao_osm_location.dart

---------

Co-authored-by: monsieurtanuki <fabrice_fontaine@hotmail.com>
2024-11-29 12:05:00 +01:00
5a0ba55e96 feat: 5855 - no visible product type filter by default (#5878)
* feat: 5855 - no visible product type filter by default

Impacted files:
* `background_task_price.dart`: minor unrelated fix due to off-dart 3.17.0
* `dao_product.dart`: we overwrite the products product_type with the server product type only if null
* `product_query.dart`: now retrieving product_type field in products found on a server
* `product_refresher.dart`: unrelated minor refactoring
* `pubspec.lock`: wtf
* `pubspec.yaml`: upgraded off-dart to 3.17.0
* `search_product_helper.dart`: visible/invisible product type filter, by default invisible and working on food
* `user_preferences_dev_mode.dart`: on/off switch for visible product type filter, off by default

* Move the setting to "App settings"

---------

Co-authored-by: Edouard Marquez <moi@edouard-marquez.me>
Co-authored-by: Edouard Marquez <g123k@users.noreply.github.com>
2024-11-19 08:34:13 +01:00
4d48671e3c feat: 5741 - respecting the "search products" access limitations (#5810)
* feat: 5741 - respecting the "search products" access limitations

New file:
* `search_products_manager.dart`: Management of "search products" access limitations.

Impacted files:
* `background_task_download_products.dart`: refactored using `SearchProductsManager`
* `background_task_language_refresh.dart`: refactored using `SearchProductsManager`
* `background_task_top_barcodes.dart`: refactored using `SearchProductsManager`
* `lazy_counter.dart`: refactored using `SearchProductsManager`
* `paged_product_query.dart`: refactored using `SearchProductsManager`
* `product_list_page.dart`: refactored using `SearchProductsManager`
* `product_refresher.dart`: refactored using `SearchProductsManager`
* `pubspec.lock`: wtf

* fix: 5618 - category comparison for OxF

Impacted files:
* `background_task_language_refresh.dart`: explicitly setting the product_type
* `dao_product.dart`: made `productType` mandatory and not null for `put` and `putAll`
* `new_product_footer.dart`: fixed case with unexploitable `comparedToCategory` field
* `product_list_page.dart`: explicitly setting the product_type
* `product_refresher.dart`: explicitly setting the product_type
* `pubspec.lock`: wtf
* `query_product_list_supplier.dart`: explicitly setting the product_type

* fix: 5617 - share link to correct Oxf server

* fix: 5617 - share link to correct Oxf server

Impacted files:
* `app_en.arb`: added labels for sharing an Oxf product
* `new_product_footer.dart`: now displaying a correct label for product sharing - in addition to correct url
* `product_query.dart`: added labels for sharing an Oxf product
* `pubspec.lock`: wtf
* `pubspec.yaml`: downgraded sentry_flutter from problematic version

---------

Co-authored-by: Edouard Marquez <g123k@users.noreply.github.com>
2024-11-09 22:52:04 +01:00
0ec7decbc5 fix: 5789 - catching database exceptions not supposed to happen (#5799) 2024-11-06 18:51:58 +01:00
69bb171a20 feat: 5405 - 3 queues for background tasks (fast, slow, long haul) (#5743)
New file:
* `background_task_queue.dart`: Queues for Background Tasks.

Impacted files:
* `background_task.dart`: now we add tasks to a specific queue
* `background_task_add_other_price.dart`: assigned to `BackgroundTaskQueue.fast`
* `background_task_add_price.dart`: assigned to `BackgroundTaskQueue.slow`
* `background_task_badge.dart`: minor refactoring
* `background_task_crop.dart`: assigned to `BackgroundTaskQueue.fast`
* `background_task_details.dart`: assigned to `BackgroundTaskQueue.fast`
* `background_task_download_products.dart`: assigned to `BackgroundTaskQueue.longHaul`
* `background_task_full_refresh.dart`: assigned to `BackgroundTaskQueue.longHaul`
* `background_task_hunger_games.dart`: assigned to `BackgroundTaskQueue.fast`
* `background_task_image.dart`: assigned to `BackgroundTaskQueue.slow`
* `background_task_language_refresh.dart`: assigned to `BackgroundTaskQueue.longHaul`
* `background_task_manager.dart`: now using new class `BackgroundTaskQueue` in order to use multiple queues
* `background_task_offline.dart`: assigned to `BackgroundTaskQueue.longHaul`
* `background_task_refresh_later.dart`: assigned to `BackgroundTaskQueue.fast`
* `background_task_top_barcodes.dart`: assigned to `BackgroundTaskQueue.longHaul`
* `background_task_unselect.dart`: assigned to `BackgroundTaskQueue.fast`
* `dao_string_list.dart`: added 2 queues
* `local_database.dart`: now running all queues
* `local_database_mock.dart`: minor refactoring
* `offline_tasks_page.dart`: now taking queues into account
* `up_to_date_mixin.dart`: now running all queues
* `user_preferences_page.dart`: now running all queues
2024-10-27 13:06:29 +01:00
be05e6004e feat: 5586 - added explicit product type to all relevant background tasks (#5721)
New file:
* `work_type.dart`: Type of long download work for some background tasks.

Impacted files:
* `background_task.dart`: removed the default `uriProductHelper` getter
* `background_task_barcode.dart`: added a `uriProductHelper` getter that depends on the `productType`
* `background_task_download_products.dart`: refactored the access to product type
* `background_task_full_refresh.dart`: split by product type
* `background_task_language_refresh.dart`: split by product type
* `background_task_offline.dart`: refactored the access to product type
* `background_task_progressing.dart`: added the `productType` parameter; moved code to new `WorkType` class
* `background_task_top_barcodes.dart`: refactored the access to product type
* `dao_product.dart`: new methods `getProductTypes` and `splitAllProducts`; refactored with product type
* `lazy_counter.dart`: explicitly counting the "food" products
* `newsfeed_provider.dart`: explicitly getting the news from "food"
* `offline_data_page.dart`: now displaying "download top N products" buttons for each product type; stats for each product type
* `offline_tasks_page.dart`: enhanced "work text" algo, now depending on product type
* `operation_type.dart`: enhanced "key" algo, now depending on product type
* `ordered_nutrients_cache.dart`: explicitly using the "food" nutrients
* `product_list_page.dart`: now reloading products from their server
* `product_list_popup_items.dart`: now linking to the first server with products
* `product_query.dart`: made product type a mandatory parameter
* `product_refresher.dart`: added mandatory parameter product type
* `random_questions_query.dart`: explicitly ask for "food" robotoff products
* `temp_product_list_share_helper.dart`: added mandatory parameter product type
* `user_preferences_dev_debug_info.dart`: added explicit use of "food" data
2024-10-26 00:27:35 +02:00
a8cfcd02ce fix: 5693 - able to run tasks without minimum duration wait (#5694)
* fix: 5693 - able to run tasks without minimum duration wait

Impacted files:
* `background_task_manager.dart`: made it possible to force an immediate run if possible
* `offline_tasks_page.dart`: force an immediate run if possible when clicking on the refresh button

* Added a call to BackgroundTaskManager.run related to prices

* Minor fix

* Wtf tests

* Ugly fix for mocking hive
2024-10-20 14:17:21 +02:00
e9eba42552 fix: 5691 - fallback when "nulls last" not supported by db (#5695) 2024-10-13 19:32:37 +02:00
a6569866d4 feat: Upgrade the Flutter version to 3.24 (#5613)
* Let's migrate the app to Flutter 3.24

* `openfoodfacts_flutter_lints` from the `main` branch

* A fix for `/// For the world view`
2024-09-26 16:48:01 +02:00
8e5ea75f61 feat: 5568 - optimized search for price locations (#5587)
Impacted files:
* `app_en.arb`: added a label for "location broader search"
* `app_fr.arb`: added a label for "location broader search"
* `dao_osm_location.dart`: added columns osmKey and osmValue
* `local_database.dart`: upgraded the version in order to add columns to location table
* `location_list_supplier.dart`: added optional parameters for optimized search; added fields osmKey and osmValue
* `location_query_model.dart`: now we use 2 suppliers - optimized and broader
* `location_query_page.dart`: now display optimized results first, then broader results after a button click
* `osm_location.dart`: added fields osmKey and osmValue
2024-09-25 10:38:08 +02:00
93fc899301 fix: 5576 - first step towards multi product types (#5593)
Impacted files:
* `add_basic_details_page.dart`: replaced getter `ProductQuery.uriProductHelper` with method `ProductQuery.getUriProductHelper`
* `background_task.dart`: replaced getter `ProductQuery.uriProductHelper` with method `ProductQuery.getUriProductHelper`
* `background_task_download_products.dart`: saved new field `Product.productType`
* `dao_product.dart`: now we're storing the `Product.productType` field
* `edit_new_packagings.dart`: now using new field `Product.productType`
* `edit_new_packagings_component.dart`: now using new field `Product.productType`
* `edit_product_page.dart`: specific icon for "food" categories; no nutrition for "beauty" and "product"
* `forgot_password_page.dart`: replaced getter `ProductQuery.uriProductHelper` with method `ProductQuery.getUriProductHelper`
* `lazy_counter.dart`: replaced getter `ProductQuery.uriProductHelper` with method `ProductQuery.getUriProductHelper`
* `login_result.dart`: replaced getter `ProductQuery.uriProductHelper` with method `ProductQuery.getUriProductHelper`
* `newsfeed_provider.dart`: replaced getter `ProductQuery.uriProductHelper` with method `ProductQuery.getUriProductHelper`
* `ocr_ingredients_helper.dart`: replaced getter `ProductQuery.uriProductHelper` with method `ProductQuery.getUriProductHelper`
* `ocr_packaging_helper.dart`: replaced getter `ProductQuery.uriProductHelper` with method `ProductQuery.getUriProductHelper`
* `onboarding_data_product.dart`: replaced getter `ProductQuery.uriProductHelper` with method `ProductQuery.getUriProductHelper`
* `ordered_nutrients_cache.dart`: replaced getter `ProductQuery.uriProductHelper` with method `ProductQuery.getUriProductHelper`
* `paged_product_query.dart`: replaced getter `ProductQuery.uriProductHelper` with method `ProductQuery.getUriProductHelper`
* `product_cards_helper.dart`: replaced getter `ProductQuery.uriProductHelper` with method `ProductQuery.getUriProductHelper`
* `product_image_crop_button.dart`: replaced getter `ProductQuery.uriProductHelper` with method `ProductQuery.getUriProductHelper`
* `product_image_gallery_other_view.dart`: now using new field `Product.productType`
* `product_image_other_page.dart`: now using new field `Product.productType`
* `product_image_server_button.dart`: now using new field `Product.productType`
* `product_image_widget.dart`: now using new field `Product.productType`
* `product_list_page.dart`: replaced getter `ProductQuery.uriProductHelper` with method `ProductQuery.getUriProductHelper`
* `product_query.dart`: now when we look for a barcode (or refresh a product), we use all productTypes if needed
* `product_refresher.dart`: replaced getter `ProductQuery.uriProductHelper` with method `ProductQuery.getUriProductHelper`
* `pubspec.lock`: wtf
* `pubspec.yaml`: upgraded `openfoodfacts` to `3.15.0` for new `Product.productType` field
* `sign_up_page.dart`: replaced getter `ProductQuery.uriProductHelper` with method `ProductQuery.getUriProductHelper`
* `simple_input_page_helpers.dart`: new class dedicated to non-food categories
* `simple_input_text_field.dart`: replaced getter `ProductQuery.uriProductHelper` with method `ProductQuery.getUriProductHelper`
* `simple_input_widget.dart`: now using new field `Product.productType`
* `temp_product_list_share_helper.dart`: replaced getter `ProductQuery.uriProductHelper` with method `ProductQuery.getUriProductHelper`
* `uploaded_image_gallery.dart`: now using new field `Product.productType`
* `user_preferences_dev_debug_info.dart`: replaced getter `ProductQuery.uriProductHelper` with method `ProductQuery.getUriProductHelper`
2024-09-25 10:28:57 +02:00
e7154a66dc feat: 5400 - flagging stores as favorite (#5533)
New file:
* `favorite_location_helper.dart`: Helper used to set/unset/sort stores as user favorites.

Impacted files:
* `dao_string_list.dart`: added a key for favorite price stores
* `search_location_preloaded_item.dart`: added a "favorite" `IconButton` for price locations
2024-08-16 11:42:45 +02:00
a797ebde6d feat: Add the outdated indicator to the photo grid (#5491)
* Add the outdated indicator to the photo grid

* Add some comments
2024-07-22 12:13:01 +02:00
eb03ed1ecf Fix Linux / Windows error (#5431) 2024-06-22 08:48:23 +02:00
db223b5db5 feat: 5195 - new "add one product price" page with background task (#5292)
* feat: 5195 - new "add one product price" page with background task

New files:
* `background_task_add_price.dart`: Background task about adding a product price.
* `currency_selector_helper.dart`: Helper for currency selection.
* `price_amount_card.dart`: Card that displays the amounts (discounted or not) for price adding.
* `price_amount_field.dart`: Text field that displays a single amount for price adding.
* `price_currency_card.dart`: Card that displays the currency for price adding.
* `price_currency_selector.dart`: Button that displays the currency for price adding.
* `price_date_card.dart`: Card that displays the date for price adding.
* `price_location_card.dart`: Card that displays the location for price adding.
* `price_model.dart`: Price Model (checks and background task call) for price adding.
* `price_proof_card.dart`: Card that displays the proof for price adding.
* `product_price_add_page.dart`: Single page that displays all the elements of price adding.

Impacted files:
* `app_en.arb`: added labels related to price adding
* `app_fr.arb`: added labels related to price adding
* `background_task_crop.dart`: minor refactoring
* `background_task_image.dart`: minor refactoring
* `background_task_upload.dart`: minor refactoring
* `currency_selector.dart`: refactored with new class `CurrencySelectorHelper`
* `dao_osm_location.dart`: minor refactoring
* `image_crop_page.dart`: minor refactoring
* `location_list_supplier.dart`: minor refactoring
* `location_map_page.dart`: added action buttons for location description and location confirmation
* `operation_type.dart`: added data for new class `BackgroundTaskAddPrice`
* `prices_card.dart`: now opening new page `ProductPriceAddPage`
* `product_price_item.dart`: minor improvement
* `product_prices_page.dart`: minor improvement
* `pubspec.lock`: wtf
* `pubspec.yaml`: upgraded `openfoodfacts` to `3.10.0`
* `search_location_preloaded_item.dart`: now enabling the map page to confirm a location

* fine-tuning

Impacted files:
* `app_en.arb`: added labels related to prices
* `app_fr.arb`: added labels related to prices
* `edit_product_page.dart`: added a link to "Add product price" page
* `prices_card.dart`: refactoring
* `product_price_add_page.dart`: fixed the FAB label; refactored the access using a static method
* `product_price_item.dart`: now displaying the not discounted price; refactored
* `product_prices_list.dart`: localized
* `product_prices_page.dart`: added a FAB to "Add product price" page
2024-05-25 19:38:00 +02:00
5a95ca688a feat: 5195 - location search, as a preliminary step (#5274)
New files:
* `dao_osm_location.dart`: DAO about OSM locations.
* `loading_status.dart`: Common loading status.
* `location_list_supplier.dart`: Asynchronously loads locations.
* `location_map_page.dart`: Page that displays a map centered on a location.
* `location_query_model.dart`: Location query model.
* `location_query_page.dart`: Page that displays location results during and after download.
* `osm_location.dart`: Location as expected from OSM.
* `product_loading_status.dart`: Product loading status. Refactored from `product_list_item_simple.dart`
* `search_app_bar_title.dart`: Common search app bar title.
* `search_empty_screen.dart`: Common search empty screen.
* `search_helper.dart`: Common "text-field + history" search helper.
* `search_loading_screen.dart`: Common search loading screen.
* `search_location_helper.dart`: Search helper dedicated to location search.
* `search_location_model.dart`: Search location model.
* `search_location_preloaded_item.dart`: Location search preloaded list item, for locations historically selected.
* `search_preloaded_item.dart`: Common search preloaded item.
* `search_product_helper.dart`: Search helper dedicated to product search. Used to be in `search_page.dart`

Impacted files
* `app_en.arb`: added a "No location found" label
* `app_fr.arb`: added a "No location found" label
* `app_navigator.dart`: minor refactoring
* `dao_string_list.dart`: history key for new feature "previous location searches"
* `local_database.dart`: upgraded the version to take into account new class `DaoOsmLocation`
* `personalized_ranking_model.dart`: now using a common `LoadingStatus`
* `personalized_ranking_page.dart`: now using a common `LoadingStatus`
* `product_list_item_simple.dart`: now using a common `ProductLoadingStatus`
* `product_model.dart`: now using a common `ProductLoadingStatus`
* `product_price_item.dart`: added unrelated TODO comment
* `product_query_model.dart`: now using a common `LoadingStatus`
* `product_query_page.dart`: now using common `SearchLoadingScreen`, `SearchEmptyScreen` and `SearchAppBarTitle`
* `product_query_page_helper.dart`: removed useless `ProductQueryPageResult`; refactored `EditProductCallback` to `SearchQueryCallback` somewhere else
* `search_history_view.dart`: refactored with `SearchHelper` and preloaded items
* `search_page.dart`: refactored the actual search code to `SearchHelper`; added preloaded items; found a bug
* `smooth_product_carousel.dart`: minor refactoring
* `user_preferences_dev_mode.dart`: added a temporary access to location search; removed useless key
2024-05-21 18:45:38 +02:00
c6077dce33 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
2024-04-08 13:08:47 +02:00
f98bce1977 feat: 4941 - refresh products when switching app language (#5016)
New file:
* `background_task_language_refresh.dart`: Background task about downloading products to translate.

Impacted files:
* `background_task_manager.dart`: minor refactoring
* `dao_product.dart`: new method `getTopProductsToTranslate`
* `local_database.dart`: minor refactoring
* `offline_tasks_page.dart`: minor refactoring
* `operation_type.dart`: new operation type `languageRefresh`
* `product_refresher.dart`: minor refactoring
* `up_to_date_mixin.dart`: minor refactoring
* `up_to_date_product_provider.dart`: minor refactoring
* `user_preferences_language_selector.dart`: now calling new task `BackgroundTaskLanguageRefresh` when changing language
2024-02-24 11:08:58 +01:00
4d9c7fc48c feat: 4996 - reordering product languages (#5025)
New file:
* `language_priority.dart`: Helper around the language priority.

Impacted files:
* `add_basic_details_page.dart`: minor refactoring
* `dao_string_list.dart`: now storing the latest languages used locally in the app
* `edit_ocr_page.dart`: minor refactoring
* `language_selector.dart`: now showing app and product languages as first languages
* `multilingual_helper.dart`: minor refactoring
2024-02-04 14:44:24 +01:00
1807968706 feat: 4947 - added local "last access" timestamp for products (#4969)
New file:
* `dao_product_last_access.dart`: Table that stores the local last access timestamp for a product.

Impacted files:
* `local_database.dart`: new version of the database, because of the new "product last access" table
* `new_product_page.dart`: added a call to refresh the product "last access" timestamp
* `offline_data_page.dart`: added a call to delete the product "last access" timestamps
* `product_model.dart`: added a call to refresh the product "last access" timestamp
* `pubspec.lock`: wtf
2024-01-25 18:46:31 +01:00
e0b3111596 feat: 4947 - added "download language" to product table (#4951)
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
2024-01-07 18:33:32 +01:00
0a5b18ddcf fix: 4807 - putting back a useless hive table, just in case (#4821)
* fix: 4807 - putting back a useless hive table, just in case

* fix: 4807
2023-11-19 19:30:29 +01:00
4ab2150a60 chore: old TODOs (#4758)
Deleted files:
* `dao_hive_product.dart`: we don't store products in hive since 18 months ago
* `dao_unzipped_product.dart`: we don't store products as unzipped since 18 months ago

Impacted files:
* `background_task_hunger_games.dart`: impacted by off-dart new features
* `background_task_image.dart`: impacted by off-dart new features
* `crop_page.dart`: impacted by off-dart new features
* `local_database.dart`: removed hive and unzipped products
2023-11-04 13:56:58 +01:00
3f2b7a7a2a User lists: bring Share / View on web / Clear actions to the Modal sheet (#4400) 2023-07-30 09:48:12 +02:00
d9e49dfc14 fix: 4301 - new "up-to-date" provider for product list (#4321)
New files:
* `up_to_date_interest.dart`: Management of the interest for a key.
* `up_to_date_product_list_mixin.dart`: Provides the most up-to-date local product list data for a StatefulWidget.
* `up_to_date_product_list_provider.dart`: Provider that reflects the latest barcode lists on ProductLists.

Impacted files:
* `dao_product_list.dart`: made public method `getKey`; refreshes the provider
* `local_database.dart`: added a new `UpToDateProductListProvider`
* `product_list_page.dart`: now extends `UpToDateProductListMixin
* `up_to_date_product_provider.dart`: refactored using a `UpToDateInterest`
* `user_preferences_account.dart`: removed redundant access to product list page
2023-07-16 23:11:48 +02:00
aa734347de feat: 4041 - now displaying user lists in "List" nav tab (#4298) 2023-07-13 16:20:24 +02:00
25264c9f22 fix: 4222 - top barcode task refactoring (#4226)
Impacted files:
* `app_en.arb`: added a label for "server timeout"
* `background_task_top_barcodes.dart`: now explicitly using page number parameter, as server data is not 100% reliable
* `dao_work_barcode.dart`: minor refactoring
* `offline_tasks_page.dart`: detected a typical "server timeout" error message and replaced it with a more user-friendly message
2023-06-25 17:48:27 +02:00
95c3a675a9 fix: 4066 - top n product download split in smaller robust parts (#4166)
* fix: 4066 - top n product download split in smaller robust parts

New files:
* `background_offline_barcodes.dart`: Background subtask about pre-downloading top n barcodes.
* `background_offline_products.dart`: Background subtask about downloading products.
* `dao_work_barcode.dart`: Work table that contains barcodes.

Impacted files:
* `background_task_offline.dart`: now we clean the new `DaoWorkBarcode` and we just call the new `BackgroundtaskOfflineBarcodes`
* `local_database.dart`: upgraded to version 3, with the new `DaoWorkBarcode`.
* `operation_type.dart: added the new 2 background tasks.

TODO
* `backgrount_task_manager.dart`: make it possible to actually chain tasks with immediate execution

* Penultimate step before un-drafting

New files:
* `background_task_paged.dart`: Abstract background task with paged actions.
* `background_task_progressing.dart`: Abstract background task with work in progress actions.

Impacted files:
* `background_task_crop.dart`: minor refactoring
* `background_task_details.dart`: minor refactoring
* `background_task_hunger_games.dart`: minor refactoring
* `background_task_image.dart`: minor refactoring
* `background_task_refresh_later.dart`: minor refactoring
* `background_task_unselect.dart`: minor refactoring
* `background_task_upload.dart`: minor refactoring
* `dao_work_barcode.dart`: minor refactoring
* `edit_product_page.dart`: minor refactoring
* `local_database.dart`: minor refactoring
* `new_product_page.dart`: minor refactoring
* `offline_tasks_page.dart`: minor refactoring; displays progress percentage
* `operation_type.dart`: moved file; minor refactoring for progress percentage
* `product_image_gallery_view.dart`: minor refactoring
* `up_to_date_changes.dart`: minor refactoring

Later:
* `background_task.dart`
* `background_task_download_products.dart`
* `background_task_full_refresh.dart`
* `background_task_manager.dart`
* `background_task_offline.dart`
* `background_task_top_barcodes.dart`
* `offline_data_page.dart`

* Final commit for main features.

Impacted files:
* `app_en.arb`: added a label for topN download with parameter
* `background_task.dart`: added a bool getter for immediate exec of the next task; minor refactoring
* `background_task_download_products.dart`: now as a _progressing_ background task, reused for top N, with KP and without KP
* `background_task_full_refresh.dart`: now as a _paged_ background task, that opens two progressing download tasks (one with KP, one without KP)
* `background_task_manager.dart`: now working as singleton; added a special case for immediate exec of the next task
* `background_task_offline.dart`: now as a _progressing_ background task
* `background_task_top_barcodes.dart`: now as a _progressing_ background task
* `dao_work_barcodes.dart`: fixed the bulk insert and delete for more than 1K products (actually, 1K SQL parameters)
* `offline_data_page.dart`: now using topN and pageSize parameters
* `offline_tasks_page.dart`: added a "work" label for the tasks
* `operation_type.dart`: now embeds the "work" in the task id

* Update packages/smooth_app/lib/background/background_task_download_products.dart

Co-authored-by: Pierre Slamich <pierre.slamich@gmail.com>

* Update packages/smooth_app/lib/background/background_task_download_products.dart

Co-authored-by: Pierre Slamich <pierre.slamich@gmail.com>

* Update packages/smooth_app/lib/background/background_task_progressing.dart

Co-authored-by: Pierre Slamich <pierre.slamich@gmail.com>

* Update packages/smooth_app/lib/background/background_task_progressing.dart

Co-authored-by: Pierre Slamich <pierre.slamich@gmail.com>

* fix: 4066 - localization

---------

Co-authored-by: Pierre Slamich <pierre.slamich@gmail.com>
2023-06-21 14:11:57 +02:00
6e72ff0991 fix: 3595 - transient file refactoring and fixes (#3939)
New file:
* `background_task_upload.dart`: Background task about generic file upload.

Impacted files:
* `abstract_background_task.dart`: added a `recover` abstract method
* `background_task_crop.dart`: now extends new class `BackgroundTaskUpload`
* `background_task_image.dart`: now extends new class `BackgroundTaskUpload`
* `background_task_manager.dart`: now calls `recover`for each task at run time; minor fix about "internet error"
* `background_task_unselect.dart`: minor refactoring; minor fix removing the transient file
* `crop_page.dart`: minor refactoring
* `edit_ingredients_page.dart`: minor refactoring
* `image_upload_card.dart`: minor refactoring
* `product_cards_helper.dart`: minor refactoring
* `product_image_viewer.dart`: minor refactoring
* `smooth_product_image.dart`: minor refactoring
* `transient_file.dart`: refactored as a "real" class, not a static one
2023-05-13 10:12:52 +02:00
a8366fd49f feat: 3897 - no language selector for gallery, only for swipeable page (#3924)
* feat: 3897 - no language selector for gallery, only for swipeable page

Main changes:
* `app_en.arb`: added 2 translations ("no image" / "no image for that language")
* `app_fr.arb`: added 2 translations ("no image" / "no image for that language")
* `nutrition_page_loaded.dart`: removed an implicit `language` parameter
* `product_cards_helper.dart`: refactoring
* `product_image_gallery_view.dart`: removed the language selector
* `product_image_swipeable_view.dart`: removed the language parameter; now we always start with the app language
* `product_image_viewer.dart`: now always displays the (non) image for the specified language, with additional labels; added explicit `language` parameters
* `transient_file.dart`: new method `getImageLanguages`

Added explicit `language` parameters for:
* `add_new_product_page.dart`: added an explicit `language` parameter
* `background_task_crop.dart`: added an explicit `language` parameter
* `background_task_image.dart`: added an explicit `language` parameter
* `background_task_unselect.dart`: added an explicit `language` parameter
* `edit_ingredients_page.dart`: added an explicit `language` parameter
* `edit_new_packagings.dart`: added an explicit `language` parameter
* `image_crop_page.dart`: added an explicit `language` parameter
* `image_upload_card.dart`: added an explicit `language` parameter
* `new_crop_page.dart`: added an explicit `language` parameter
* `product_image_local_button.dart`: added an explicit `language` parameter
* `product_image_server_button.dart`: added an explicit `language` parameter
* `uploaded_image_gallery.dart`: added an explicit `language` parameter

* feat: 3897 - slightly related refactoring around ImageFieldSmoothieExtension

* feat: 3897 - minor fix for TEST env
2023-04-30 18:34:35 +02:00
9679de7fda feat: 3897 - now we display localized images (#3900)
Impacted files:
* `background_task_crop.dart`: added language to transient file key
* `background_task_image.dart`: added language to transient file key
* `background_task_unselect.dart`: unrelated removal of not used fields
* `edit_ingredients_page.dart`: now we display localized images
* `image_upload_card.dart`: added language to transient file key
* `ocr_widget.dart`: added language to transient file key
* `product_cards_helper.dart`: now returns a localized image; refactored; new method `getLocalizedProductImageUrl`
* `product_image_carousel.dart`: now we display localized images
* `product_image_gallery_view.dart`: now we display localized images
* `product_image_swipeable_view.dart`: now we display localized images
* `product_image_viewer.dart`: now we display localized images
* `product_query.dart`: unrelated removal of not used field
* `product_refresher.dart`: unrelated minor refactoring
* `smooth_product_image.dart`: now we display localized images
* `transient_file.dart`: added language to transient file key
* `up_to_date_changes.dart`: unrelated removal of not used fields
2023-04-24 18:58:32 +02:00
e5e6eab087 feat: 3565 - badge on bottom bar about background tasks and access to list (#3567)
* feat: 3565 - badge on bottom bar about background tasks and access to list

Impacted files:
* `app_en.arb`: added 9 labels related to background tasks
* `background_task_manager.dart`: added an error/status for each task; removed the concept of "blocked" task manager
* `offline_tasks_page.dart`: localized and added error labels
* `page_manager.dart`: added a badge on bottom bar about pending background tasks
* `pubspec.lock`: wtf
* `pubspec.yaml`: added a dependency to `badges`
* `user_preferences_dev_mode.dart`: removed the access to the pending background task page
* `user_preferences_page.dart`: added a direct access to the pending background task page

* feat: 3565 - badge on bottom bar about background tasks and access to list

New file:
* `background_task_badge.dart`: Badge about pending background tasks.

Impacted files:
* `app_en.arb`: added 1 label about subtitle, edited the label about title
* `page_manager.dart`: now using new class `BackgroundTaskBadge`
* `user_preferences_page.dart`: added a subtitle and a badge for background tasks

* feat: 3565 - refreshed goldens test

* feat: 3565 - golden tests

Impacted files:
* `background_task_badge.dart`: refactored
* `background_task_manager.dart`: refactored
* `dao_string_list.dart`: added comments
* `local_database.dart`: added a method to be mocked
* `local_database_mock.dart`: overrode a method
* `offline_tasks_page.dart`: refactored
* `user_preferences_page-dark.png`: goldens
* `user_preferences_page-light.png`: goldens
* `user_preferences_page_test.dart`: added a reference to `LocalDatabase`

* feat: 3565 - golden tests

Impacted files:
* `background_task_badge.dart`: refactored
* `background_task_manager.dart`: refactored
* `dao_string_list.dart`: added comments
* `local_database.dart`: added a method to be mocked
* `local_database_mock.dart`: overrode a method
* `offline_tasks_page.dart`: refactored
* `user_preferences_page-dark.png`: goldens
* `user_preferences_page-light.png`: goldens
* `user_preferences_page_test.dart`: added a reference to `LocalDatabase`
2023-01-11 17:18:57 +01:00
8835f864ec fix: 3533 - added a "stamp" to background tasks, to identify similar tasks (#3548)
* fix: 3533 - added a "stamp" to background tasks, to identify similar tasks

Impacted files:
* `abstract_background_task.dart`: added a stamp; minor refactoring
* `add_basic_details_page.dart`: implemented the background stamp
* `add_other_details_page.dart`: implemented the background stamp
* `background_task_details.dart`: new `enum BackgroundTaskDetailsStamp`; added the background stamp
* `background_task_image.dart`: added the background stamp
* `background_task_manager.dart`: refactored the run queue; stops when there's not internet connection
* `background_task_refresh_later.dart`: added the background stamp
* `edit_ingredients_page.dart`: added the background stamp
* `edit_new_packagings.dart`: implemented the background stamp
* `local_database.dart`: unrelated removal of deprecated comment
* `main.dart`: slightly related fix of #3522, because we used to run background tasks before the language was set
* `nutrition_page_loaded.dart`: implemented the background stamp
* `ocr_helper.dart`: added a background stamp
* `ocr_ingredients_helper.dart`: implemented the background stamp
* `ocr_packaging_helper.dart`: implemented the background stamp
* `simple_input_page.dart`: added the background stamp; now we split the updates in as many minimum parts as possible
* `simple_input_page_helpers.dart`: added and implemented background stamps; unrelated fix (when the widget is not displayed, the data should be considered as "not changed")

* fix: 3533 - added a 5 second delay between runs

Impacted files:
* `background_task_details.dart`: more verbose tags for stamps
* `background_task_image.dart`: added language to stamp
* `background_task_manager.dart`: added a 5 second minimum delay between runs; added temporary debug prints
* `edit_product_page.dart`: added a task refresh
* `product_image_gallery_view.dart`: added a task refresh
2023-01-09 16:24:04 +01:00
1190474c9b fix: 3533 - using a not temporary directory for images to be uploaded (#3539)
Impacted files:
* `background_task_image.dart`: explicitly deleting the file at the end of the task.
* `new_crop_page.dart`: changed the directory to a "not temporary" one
* `transient_file.dart`: finally only dealing with removing transient files, not the actual OS file
2023-01-06 14:44:11 +01:00
7e861f569e refactor: upgrade to off-dart 2.0.0 (#3495)
Impacted files:
* `paged_to_be_completed_product_query.dart`: renamed `State` as `ProductState`
* `paged_user_product_query.dart`: created local `UserSearchType` instead of deprecated off-dart `UserProductSearchType`; used `ProductSearchQueryConfiguration` instead of deprecated `UserProductSearchQueryConfiguration`
* `product_query.dart`: now that we use fully v3, we don't need the temporary field list for user-related queries with v2
* `pubspec.lock`: wtf
* `pubspec.yaml`: upgrade to off-dart 2.0.0
* `user_preferences_account.dart`: now using new local class `UserSearchType`
* and reduced all off-dart imports to a single `import 'package:openfoodfacts/openfoodfacts.dart';`
2023-01-02 16:10:52 +01:00
1cce8cce07 feat: Add all scanned products to list (#3401)
* feat: Add all scanned products to list

* Code review

* refactoring from product_list_user_dialog_helper

* Update all_user_product_list_page.dart

* Correct use of pop'ed bools

* Now showing if all products are included

* Await + rename

* Remove loading dialog

* Update product_list_user_dialog_helper.dart

* Update dao_product_list.dart
2022-12-22 12:46:20 +01:00
5304614c99 feat: 3263 - new BackgroundTaskManager that always works (#3339)
Deleted file:
* `background_task_helper.dart`

New files:
* `background_task_manager.dart`: Management of background tasks: single thread, block, restart, display.
* `dao_instant_string.dart`: Where we store strings that need INSTANT access (= not lazy, no await).

Impacted fles:
* `abstract_background_task.dart`: refactored
* `background_task_details.dart`: refactored around the changes in `AbstractBackgroundTask`
* `background_task_image.dart`: refactored around the changes in `AbstractBackgroundTask`
* `dao_string_list.dart`: refactoring around now managing several lists; removed unnecessary `await` for a non-lazy dao
* `local_database.dart`: added the new class `DaoInstantString`; relaunch the background task manager at every refresh
* `main.dart`: minor refactoring
* `new_crop_page.dart`: unrelated bug fix
* `offline_tasks_page.dart`: refactored around the new `BackgroundTaskManager`
* `operation_type.dart`: added helper methods
* `product_image_gallery_view.dart`: minor refactoring
* `product_image_viewer.dart`: unrelated bug fix - the product was not refreshed, and so wasn't the image even after a successful download
* `pubspec.lock`: wtf
* `pubspec.yaml`: removed `flutter_task_manager`
* `search_history_view.dart`: minor refactoring now that we have several lists in `DaoStringList`
* `search_page.dart`: minor refactoring now that we have several lists in `DaoStringList`
* `up_to_date_changes.dart`: minor refactoring
* `up_to_date_product_provider.dart`: minor refactoring
2022-11-25 17:31:25 +01:00
fba2851809 fix: 3018 - instant upload of images (#3329)
New files:
* `ocr_widget.dart`: Widget dedicated to OCR, with 3 actions: upload image, extract data, save. Used to be in `edit_ingredients_page.dart`
* `transient_file.dart`: Helper class about transient files (= not fully uploaded yet).

Impacted files:
* `add_basic_details_page.dart`: minor refactoring
* `add_new_product_page.dart`: refactored around the class image repository
* `app_en.arb`: added 1 label when OCR fails
* `app_fr.arb`: added 1 label when OCR fails
* `background_task_details.dart`: minor refactoring
* `background_task_image.dart`: immediate execution with just one try
* `confirm_and_upload_picture.dart`: minor refactoring with new private class `_OutlinedButton`
* `edit_ingredients_page.dart`: moved `OcrWidget` code to dedicated new dart file; fixed the extract button - that cannot be reached if the image is not uploaded yet
* `image_crop_page.dart`: refactored with more explicit method names
* `image_upload_card.dart`: refactored with `TransientFile`
* `new_product_page.dart`: minor refactoring
* `product_cards_helper.dart`: minor refactoring
* `product_image_carousel.dart`: minor refactoring
* `product_image_gallery_view.dart`: refactored with new method `confirmAndUploadNewPicture` and new class `TransientFile`
* `product_image_viewer.dart`: refactored with new class `TransientFile`
* `question_card.dart`: minor refactoring
* `smooth_product_image.dart`: refactored with new class `TransientFile`
2022-11-19 14:45:50 +01:00
316272e2f7 fix: #3018 - minor step for background tasks (#3302)
New file:
* `dao_transient_operation.dart`: Transient operation: a minimalist product with a key.

Impacted files:
* `barcode_product_query.dart`: minor refactoring
* `local_database.dart`: added reference to new class `DaoTransientOperation`
* `Podfile.lock`: wtf
* `product_refresher.dart`: minor refactoring
* `pubspec.lock`: wtf
2022-11-10 22:55:15 +01:00
222eb6e69e fix: #3018 - UpToDateProductProvider now field of LocalDatabase (#3220)
Impacted files:
* `add_basic_details_page.dart`: got rid of `UpToDateProductProvider`
* `add_new_product_page.dart`: got rid of `UpToDateProductProvider`
* `edit_ingredients_page.dart`: got rid of `UpToDateProductProvider`
* `edit_product_page.dart`: got rid of `UpToDateProductProvider`
* `knowledge_panel_page.dart`: got rid of `UpToDateProductProvider`
* `local_database.dart`: added an `UpToDateProductProvider` field
* `main.dart`: got rid of `UpToDateProductProvider`
* `new_product_page.dart`: got rid of `UpToDateProductProvider`
* `nutrition_page_loaded.dart`: got rid of `UpToDateProductProvider`
* `personalized_ranking_model.dart`: got rid of `UpToDateProductProvider`
* `personalized_ranking_page.dart`: got rid of `UpToDateProductProvider`
* `Podfile.lock`: wtf
* `product_image_gallery_view.dart`: got rid of `UpToDateProductProvider`
* `product_list_item_simple.dart`: got rid of `UpToDateProductProvider`
* `product_list_page.dart`: got rid of `UpToDateProductProvider`
* `product_refresher.dart`: got rid of `UpToDateProductProvider`
* `simple_input_page.dart`: got rid of `UpToDateProductProvider`
* `summary_card.dart`: got rid of `UpToDateProductProvider`
* `up_to_date_product_provider.dart`: not a provider anymore; using `LocalDatabase` instead
2022-10-27 09:32:59 +02:00
d2f8077812 feat: menu to manage offline data (#2971)
* initial page build

* functions to calculate size and total number of products
and also deleting products from db

* helper functions added

* removed unnessary comment

* variable rename and comment add

* code refactor

* better comments

* translations added

* function rename

* minor fixes

* better comments style
2022-09-10 15:27:21 +02:00
d922511a32 feat: #2785 - async access to dao product list (#2788)
Impacted files:
* `all_user_product_list_page.dart`: split in a not-loaded / loaded version; computes each user list length with a `FutureBuilder
* `continuous_scan_model.dart`: minor refactoring
* `dao_product_list.dart`: switch from "box" to "lazyBox" in order to cleanly make all methods `async`
* `new_product_page.dart`: now loading lists with `FutureBuilder`
* `paged_product_query.dart`: replaced deprecated methods
* `paged_to_be_completed_product_query.dart`: replaced deprecated methods
* `product_list_import_export.dart`: replaced deprecated methods
* `product_list_page.dart`: minor refactoring; replaced deprecated methods
* `product_list_supplier.dart`: minor refactoring
* `product_list_user_dialog_helper.dart`: now explicitly calling `notifyListeners` as `setState` won't be enough because of pre-loaded data
* `pubspec.lock`: generated
* `pubspec.yaml`: upgrade to `openfoodfacts: ^1.24.0`
* `query_product_list_supplier.dart`: minor refactoring
2022-08-16 18:48:36 +02:00
115722b613 feat: #2396 - better memory management - load products only when needed (#2609)
Deleted files:
* `scan_page_helper.dart`: refactored as there was only a single small method there, with a lousy "ignore" management.
* `smooth_main_button.dart`: old redundant button that did not fit the latest UI

New files:
* `personalized_ranking_model.dart`: Model that computes the scores and sorts the barcodes accordingly.
* `product_model.dart`: Model for product database get and refresh.
* `scan_product_card_loader.dart`: Display of product for the scan page, after async load from local database.
* `tmp_matched_product_v2.dart`: to be merged into off-dart

Impacted files:
* `app_en.arb`: added a label for "refresh_with_new_preferences"
* `app_fr.arb`: added a label for "refresh_with_new_preferences"
* `continuous_scan_model.dart`: now we don't store Product and we let the product cards get the product from the local db if and only if needed
* `dao_product.dart`: minor refactoring
* `dao_product_list.dart`: now we don't deal with products anymore, just barcodes.
* `group_query_filter_view.dart`: removed deprecated `SmoothMainButton`
* `partial_product_list.dart`: now we don't deal with products anymore, just barcodes.
* `personalized_ranking_page.dart`: now uses new class `PersonalizedRankingModel` for better refresh and async product load; now using appropriate button with localized label; fixed dismiss action
* `product_list.dart`: now we don't deal with products anymore, just barcodes.
* `product_list_import_export.dart`: refactored
* `product_list_item_simple.dart`: now we `async`ly load the product from the local database, and keep it refreshed for every change; now based on new class `ProductModel`; added sentry error calls; typo fix
* `product_list_page.dart`: now we don't store Product and we let the product cards get the product from the local db if and only if needed
* `product_preferences.dart`: new method `getCompactView` used to know if something changed.
* `product_query_model.dart`: now we include the "category" process in the model, and we don't store products.
* `product_query_page.dart`: removed useless and inactive sliver effect and `Hero`; refactored
* `product_query_page_helper.dart`: removed bug generating `Hero`
* `scan_header.dart`: refactored from `scan_page_helper.dart` being removed and slightly modified
* `search_page.dart`: removed bug generating `Hero`
* `smooth_product_carousel.dart`: now we async'ly load product from local database, and don't store them in memory.
* `summary_card.dart`: removed bug generating `Hero`
* `up_to_date_product_provider.dart`: added timestamps for new method `needsRefresh`
* `user_preferences_account.dart`: removed bug generating `Hero`
2022-07-25 08:12:04 +02:00
7ab7c1584a feat: #2447 - gzipped product column - 6 times smaller database! (#2527)
New files:
* `dao_product_migration.dart`: Helpers around product data migration.
* `dao_unzipped_product.dart`: used to be `DaoProduct` - the old not zipped version; fixed `getAll` for big lists

Impacted files:
* `dao_hive_product.dart`: minor refactoring as `DaoProductMigrationSource`
* `dao_product.dart`: new table with zipped BLOB column as product and last update timestamp
* `local_database.dart`: now it's version 2 of sql database (new zipped product table); migration from old unzipped to new zipped product table; refactored around `DaoProductMigration`
2022-07-07 16:54:15 +02:00
9e253a774f feat: #2339 - added language and country to query product list keys (#2465)
What:
* added language and country to query product list keys
* that means that if I run a query for "pizza", not only the results will be different depending on the language and country (that was already the case), but the results will be cached accordingly - if I change language or country, I will see the cached results for those new language/country, not the results of the same query but with different language/country
* we needed that improvement in order to display correctly the "world" results; that was the first step
* also moved all the "query" classes to a specific folder
* fun fact: there are more "pizza"s in France than in Italy

Impacted files:
* `abstract_onboarding_data.dart`: minor refactoring
* `barcode_product_query.dart`: moved; minor refactoring
* `category_product_query.dart`: moved; added language and country to product list key
* `continuous_scan_model.dart`: minor refactoring
* `country_selector.dart`: minor refactoring
* `database_product_list_supplier.dart`: minor refactoring
* `keywords_product_query.dart`: moved; added language and country to product list key
* `main.dart`: minor refactoring
* `new_product_page.dart`: minor refactoring
* `nutrition_page_loaded.dart`: minor refactoring
* `ocr_helper.dart`: minor refactoring
* `onboarding_data_product.dart`: minor refactoring
* `ordered_nutrients_cache.dart`: minor refactoring
* `paged_product_query.dart`: moved; added language and country to product list key; refactored around `getProducts`
* `paged_search_product_query.dart`: moved; refactored
* `paged_to_be_completed_product_query.dart`: moved; added language and country to product list key; refactored
* `paged_user_product_query.dart`: moved; added language to product list key; refactored
* `picture_capture_helper.dart`: minor refactoring
* `product_dialog_helper.dart`: minor refactoring
* `product_list.dart`: added optional language and country to constructor parameters
* `product_list_import_export.dart`: minor refactoring
* `product_list_page.dart`: minor refactoring
* `product_list_supplier.dart`: minor refactoring
* `product_query.dart`: moved; not an interface anymore
* `product_query_model.dart`: minor refactoring
* `product_query_page_helper.dart`: minor refactoring
* `product_refresher.dart`: minor refactoring
* `query_product_list_supplier.dart`: minor refactoring
* `robotoff_insight_helper.dart`: minor refactoring
* `robotoff_questions_query.dart`: moved; minor refactoring
* `search_page.dart`: minor refactoring
* `simple_input_page_helpers.dart`: minor refactoring
* `summary_card.dart`: minor refactoring
* `user_preferences_account.dart`: minor refactoring
* `user_preferences_dev_mode.dart`: minor refactoring
2022-07-02 15:44:56 +02:00
061fa6ede4 fix: #2362 history not refreshing (#2393)
* fix: #2362 history not refreshing

* fix:#2362 refactoring codereview

Co-authored-by: monsieurtanuki <fabrice_fontaine@hotmail.com>
2022-06-30 21:15:48 +02:00