12 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
dda75e283e feat: Flutter 3.32 (#6665)
* Migration to Flutter 3.32

* Temporary ignore dart formatter issues
2025-06-23 09:56:00 +02: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
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
28262ca1ce fix: 4663 - use the latest password for background tasks + refactoring (#4869)
* fix: 4663 - use the latest password for background tasks + refactoring

Impacted files:
* `background_task.dart`: use the latest password; now we compute user and country from that class, and language most of the time too
* `background_task_barcode.dart`: removed user and country parameters; replaced language
* `background_task_crop.dart`: removed user and country parameters; replaced language
* `background_task_details.dart`: removed user, language and country parameters
* `background_task_download_products.dart`: removed user, language and country parameters
* `background_task_full_refresh.dart`: removed user, language and country parameters
* `background_task_hunger_games.dart`: removed user, language and country parameters
* `background_task_image.dart`: removed user and country parameters; replaced language
* `background_task_offline.dart`: removed user, language and country parameters
* `background_task_paged.dart`: removed user, language and country parameters
* `background_task_progressing.dart`: removed user, language and country parameters
* `background_task_refresh_later.dart`: removed user, language and country parameters
* `background_task_top_barcodes.dart`: removed user, language and country parameters
* `background_task_unselect.dart`: removed user, language and country parameters
* `background_task_upload.dart`: removed user and country parameters; replaced language
* `paged_to_be_completed_product_query.dart`: minor refactoring
* `paged_user_product_query.dart`: minor refactoring

* fix: 4663 - lint fix

---------

Co-authored-by: Pierre Slamich <pierre@openfoodfacts.org>
2023-12-21 15:42:50 +01:00
346c6e30c4 fix: 1815 - around context.mounted (#4768)
* fix: 1815 - around context.mounted

The PR is about two related topics:
* Removing all the `ignore: use_build_context_synchronously`
* Replacing all the `State<StatefulWidget> widget` by `BuildContext context`, now that it's possible in flutter

* Update packages/smooth_app/lib/pages/onboarding/permissions_page.dart

* format fix
2023-11-15 11:50:00 +01:00
d8042224f3 fix: 4575 - country is now always populated (#4591)
* fix: 4575 - country is now always populated

* Update packages/smooth_app/lib/query/product_query.dart

* fix: 4575 - reformatted
2023-08-26 17:11:53 +02:00
e3b4768d75 feat: Tweak the location of the floating messages (ex-Snackbar) (#4401)
* The location of the message is tweaked (sometimes at the top / sometimes at the bottom)

* Better way to catch record/pattern here
2023-07-31 17:13:09 +02:00
b03cf26833 feat: Allow to show a floating message (replacement for SnackBar) (#4382)
* Allow to show a floating message (replacement for `SnackBar`)

* Use `SmoothAnimationsDuration` instead of a hardcoded value
2023-07-29 19:20:10 +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
55b4894edb fix: 4066 - predownload and top 1K download as background tasks (#4131)
Deleted file:
* `products_preload_helper.dart`

New files:
* `background_task.dart`: Abstract background task.
* `background_task_full_refresh.dart`: Background task about refreshing all the already downloaded products.
* `background_task_offline.dart`: Background task about pre-downloading top n products for offline usage.

Impacted files:
* `background_task_barcode.dart`
* `background_task_crop.dart`: refactored
* `background_task_details.dart`: refactored
* `background_task_hunger_games.dart`: refactored
* `background_task_image.dart`: refactored
* `background_task_manager.dart`
* `background_task_refresh_later.dart`: refactored
* `background_task_unselect.dart`: refactored
* `background_task_upload.dart`: refactored
* `offline_data_page.dart`: now using background task for offline and full refresh tasks
* `offline_tasks_page.dart`: dealing with the "no barcode" case
* `operation_type.dart`: added values `offline` and `fullRefresh`; added `processName` field; added a `BackgroundTask` constructor
* `product_refresher.dart`: bug fix
2023-06-13 23:45:37 +02:00