20 Commits

Author SHA1 Message Date
e74f94abc3 fix: Visual glitches (#6724)
* SmoothScaffold everywhere

* DateFormat from MaterialLocalizations

* Packagings: fix InkWell
2025-07-08 17:27:21 +02:00
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
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
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
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
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
29bdad3f5b fix: Ensure we always use the SmoothAppBar and not the regular AppBar (#4184) 2023-06-18 17:22:22 +02:00
7002a123a4 feat: Migration to Flutter 3.10 (#4142)
* Migration to Flutter 3.10

* Bump Flutter version on actions

* GitHub Actions: use channel instead of a fixed version of Flutter

* Add a missing argument due to the upgrade to Flutter 3.10

* Regenerate goldens

---------

Co-authored-by: monsieurtanuki <fabrice_fontaine@hotmail.com>
2023-06-14 18:33: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
2db67702ca fix: 4074 - added explicit isolate/ui settings (#4080)
* fix: 4074 - added explicit isolate/ui settings

Impacted files:
* `image_compute_container.dart`: added explicit isolate/ui settings
* `offline_tasks_page.dart`: added a "refresh" button on the app bar

* fix: 4074 - typo
2023-06-05 22:50:35 +02:00
153c53a4a5 feat: 2427 - added "unselect image" button (#3618)
New files:
* `background_task_unselect.dart`: Background task about unselecting a product image.
* `edit_image_button.dart`: Standard text button for the "edit image" pages. Used to be in `NewCropPage` as `_OutlinedButton`.

Impacted files:
* `abstract_background_task.dart`: added new "unselect" task
* `app_en.arb`: added a label for the "unselect image" button
* `background_task_manager.dart`: unrelated minor fix
* `new_crop_page.dart`: moved `_OutlinedButton` code to new file `edit_image_button.dart`
* `offline_tasks_page.dart`: moved code to `OperationType`
* `operation_type.dart`: new `enum` for "unselect"; new method `getLabel`
* `product_image_viewer.dart`: changed the layout in order to add the "unselect image" button
* `up_to_date_changes.dart`: included the new "unselect" type to product changes
2023-01-23 13:17:27 +01:00
4ff4953e0c fix: 3602 - pending background task back to dev mode; better wording (#3603)
Impacted files:
* `background_task_badge.dart`: slightly modified the position as we're not using it in the same conditions
* `offline_tasks_page.dart`: better wording for "refresh later"
* `page_manager.dart`: remove the badge on "profile" icon about background tasks
* `Podfile.lock`: wtf
* `user_preferences_dev_mode.dart`: put back the access to the pending background task page
* `user_preferences_page.dart`: removed the access to the pending background task page
2023-01-20 13:44:22 +01:00
5b326cc34c fix: 3570 - background task order is now respected (#3591)
* fix: 3570 - background task order is now respected

Impacted files:
* `app_en.arb`: added a label for the "stop this task ASAP?" question and the corresponding task label
* `background_task_manager.dart`: fixed a bug where the task list was refreshed inappropriately; now it's possible to cancel a task; refactored
* `offline_tasks_page.dart`: now when you click on a task, you can stop it ASAP (for the record that does not mean immediately)

* fix: 3570 - better task cleaning when successful or dismissed

Impacted files:
* `abstract_background_task.dart`: added a "success?" parameter to `postExecute`
* `background_task_details.dart`: minor refactoring
* `background_task_image.dart`: made the distinction between a simple garbage collecting and a successful task run
* `background_task_manager.dart`: now we clean deeper when we remove a task
* `background_task_refresh_later.dart`: minor refactoring
2023-01-18 15:58:55 +01: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
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
cf4fa6aebe fix: Background image upload (#2433)
* work manager used for bg schedule

* removed swith case

* remove unwanted contrains and randomize the taskid
as image.others might fail

* added translations

* new product image upload working

* removed debug for work manager

* delete photo when uploaded

* use await keywords while initializing

* refactor the code

* fix show image after queed

* serialize and deserialze input data seperately

* add an instant product in the loacl db to
let the user not confuse

* added smooth random class

* use smooth random to generate 8 digits

* remove unneccesary await

* update the local db with a product if not yet
uploaded

* update local databse after sucessful
update into server

* don't refresh automatically after upload queed

* supply language code to work manager

* import app localizations

* small refactoring

* refactor the code for work manager

* iOS Config for WorkManager

* formatting

* suggestion by tolemon

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

* suggestion by tolemon

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

* suggestion by tolemon

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

* small fix

* add swith case to the workmanager

* efficient switch case

* Update packages/smooth_app/lib/l10n/app_en.arb

Suggested by tolemon

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

* minor fix

* Basic Input details add are now run in background

* basic details are now updated immediatly
even without internet

* nutrient edit task are now background
and also conflict when recheduling task is managed

* menu screen for background tasks and
nutrition edits are now backgrounded

* button for retry now works in the bg tasks screen

* formatting

* genaralised function for non image tasks

* should retry set default to false

* better mechanism for retries and refactor

* refactor and consts duration of 3s for snackbars

* now language country and user are properly dropped

* Update packages/smooth_app/ios/Runner/Info.plist

* Update packages/smooth_app/ios/Runner/AppDelegate.swift

* Error messages fixed

* custom workmanager dependencies added

* migrated basic detail task from work manager to
taskmanager

* chanages to do the product edit changes in bg

* dart format

* cleaned the function calls when doing bg task

* dao_task edited

* unnecessary methods removed

* use int as id instead of string

* added comments and made fields final

* used const variable instead of hardcoded ones

* get pending tasks from taskManager class

* refactor

* handled exceptions

* string instead of int

* remove unused plugin

* removed unnessary files

* update to localdatabase working without islotes

* suggestions left as comments on PR

* deleted unncessary Random class

* doc added

* Remove WorkManager iOS code

* reset publock

* reset publock

* remove harcoded color

* used duration constant class instead of harcoded

* make methods to generate taskId

* dart frmt

* changes as per the code review

* string buffer , var documentation and rename

* error fix

* refactor and spelling corrections

* /// instead of //

* dart ff formater

* more refactorings

* Update background_task_helper.dart

* dart ff fix

Co-authored-by: monsieurtanuki <fabrice_fontaine@hotmail.com>
Co-authored-by: Edouard Marquez <g123k@users.noreply.github.com>
Co-authored-by: Pierre Slamich <pierre.slamich@gmail.com>
Co-authored-by: Pierre Slamich <pierre@openfoodfacts.org>
2022-09-01 12:15:09 +02:00