22 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
54b9f4010e Use a SmoothFloatingSnackbar on all screens (#6169) 2025-01-10 09:58:27 +01:00
f81af45047 feat: Change UI of new product type cards (#5857) 2024-11-23 09:26:54 +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
1728eff579 Replace all MediaQuery.of(context).size with MediaQuery.sizeOf(context) (#5328) 2024-06-03 17:09:37 +02:00
6a2722f414 chore: Migration to Flutter 3.19 (#5154)
* Migration to Flutter 3.19.x

* Fix warnings about `(context).mounted`
2024-04-15 18:06:14 +02: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
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
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
29bdad3f5b fix: Ensure we always use the SmoothAppBar and not the regular AppBar (#4184) 2023-06-18 17:22:22 +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
cb815b0cac feat: 4020 - instant answers for hunger games (#4099)
* feat: 4020 - instant answers for hunger games

New files:
* `background_task_hunger_games.dart`: Background task about answering a hunger games question.
* `random_questions_query.dart`: Robotoff questions helper, for random product questions.

Deleted file:
* `product_question_page.dart`

Impacted files:
* `abstract_background_task.dart`: added "hunger games"
* `background_task_crop.dart`: minor refactoring
* `background_task_details.dart`: minor refactoring
* `background_task_image.dart`: minor refactoring
* `background_task_manager.dart`: simplified the code, as we now always work on tasks with different stamps
* `background_task_refresh.dart`: minor refactoring
* `background_task_unselect.dart`: minor refactoring
* `new_product_page.dart`: minor refactoring
* `offline_data_page.dart`: minor refactoring
* `operation_type.dart`: added a type for "hunger games" background task
* `product_list_import_export.dart`: minor refactoring
* `product_list_page.dart`: minor refactoring
* `product_questions_query.dart`: pre-loads the product if relevant
* `product_questions_widget.dart`: minor refactoring
* `product_refresher.dart`: new standard configuration for product lists; new silent download of product lists; minor refactoring
* `question_card.dart`: now downloading the product only if not in the local database
* `question_page.dart`: now saving the answer with background tasks; refactored
* `questions_query.dart`: refactored as abstract, with code moved to new file `random_questions_query.dart`
* `robotoff_insight_helper.dart`: minor refactoring

* feat: 4020 - unrelated package upgrade

* fix: 4098 - new enum value from iOS 12
2023-06-08 18:13:48 +02:00
e1a2afe1ed fix: 4056 - fixed List syntax for offline data (#4059)
* fix: 4056 - fixed List syntax for offline data

* Additional fix
2023-06-02 13:26:18 +02:00
efb8c0ca2b fix: #4025 translate the offline data page (#4055)
* translate the offline data page

* Apply suggestions from code review

---------

Co-authored-by: Pierre Slamich <pierre.slamich@gmail.com>
2023-06-01 10:23:33 +02:00
ad7ac7732a refactor: Flutter v3.7.0 (#3642) 2023-01-31 22:39:07 +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
390f859782 refactor: integrating off-dart 1.30.1 (#3471)
* refactor: integrating off-dart 1.30.1

Impacted files:
* `background_task_details.dart`: minor refactoring
* `background_task_image.dart`: minor refactoring
* `background_task_refresh_later.dart`: minor refactoring
* `country_selector.dart`: minor refactoring
* `new_product_page.dart`: minor refactoring
* `ocr_packaging_helper.dart`: minor refactoring
* `offline_data_page.dart`: now using an explicit api version
* `ordered_nutrients_cache.dart`: minor refactoring
* `paged_search_product_query.dart`: now using an explicit api version
* `paged_to_be_completed_product_query.dart`: now using an explicit api version
* `Podfile.lock`: wtf
* `product_image_data.dart`: minor refactoring
* `product_list.dart`: minor refactoring
* `product_list_import_export.dart`: now using an explicit api version
* `product_list_page.dart`: now using an explicit api version
* `product_query.dart`: explicit api version
* `product_query_page.dart`: minor refactoring
* `product_refresher.dart`: now using an explicit api version
* `products_preload_helper.dart`: now using an explicit api version
* `app/pubspec.lock`: wtf
* `smooth_app/pubspec.lock`: wtf
* `pubspec.yaml`: upgraded off-dart version to 1.30.1
* `up_to_date_changes.dart`: minor refactoring

* refactor: fix 3470

Impacted file:
* `user_preferences_account.dart`: now logging error and displaying nothing if cannot count, and optimized the code
2022-12-27 08:15:53 +01:00
48745c8afd chore: Dev mode cleanup (#3452)
* chore: Dev mode cleanup

* Update user_preferences_dev_debug_info.dart

* Update plural_translation_test.dart

* Update product_query.dart

* Update user_preferences_dev_debug_info.dart

* Copy to clipboard

* Update user_preferences_dev_debug_info.dart
2022-12-23 11:10:50 +01:00
e3564e53a4 refactor: Make smooth_app a module (also called step 1) (#3101)
* Make smooth_app a module (also called step 1)

Android impl is OK.
Still have to check for iOS and tests

* Fix scan sound not working

* Fix ci/pub_upgrade.sh issues

* Fix tests

* Some doc

* Fix build actions

* Fix iOS build

* Fix warnings

* Fix Flutter analyze

* Fix typo

* The CI needs at least one test

Co-authored-by: Marvin Möltgen <39344769+M123-dev@users.noreply.github.com>
2022-10-13 18:33:14 +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