39 Commits

Author SHA1 Message Date
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
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
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
eb03ed1ecf Fix Linux / Windows error (#5431) 2024-06-22 08:48:23 +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
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
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
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
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
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
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
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
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
1662685825 feat: #2280 - DaoProduct's just migrated to sqflite (#2289)
New files:
* `abstract_sql_dao.dart`: DAO abstraction for SQL.
* `bulk_deletable.dart`: Interface for bulk database deletes.
* `bulk_insertable.dart`: Interface for bulk database inserts.
* `bulk_manager.dart`: Manager for bulk database inserts and deletes.
* `dao_hive_product.dart`: moved code from the previous `hive` version of `DaoProduct`, renamed here `DaoHiveProduct`

Impacted files:
* `dao_product.dart`: `sqflite` version of `DaoProduct`, that is from now on the only one to be used
* `local_database.dart`: added `sqflite` and its one table so far, also named `DaoProduct` in order to minimize the changes everywhere else (the old `DaoProduct` being renamed `DaoHiveProduct`); migrated the product data from `hive` to `sqflite`
* `Podfile.lock`: wtf
* `pubspec.lock`: wtf
* `data_importer/pubspec.yaml`: updated the `sqflite` dependency to the same as in `smooth_app`
* `smooth_app/pubspec.yaml`: added a dependency to `sqflite`
2022-06-16 07:09:09 +02:00
f67180785d fix: #1352 - robotoff insight card shows permanently (#1574)
* fix: #1395 - show newly added product in carousel

* fix: #1395 - refactoring unused import

* fix: #1395 - refactoring make variable private

* fix: #1352 - robotoff card shows permanently

* fix: #1352 - codereview refactoring

* fix: #1352 - check fix

* fix: #1352 - pretest check fix

* fix: #1352 - codereview fix

Co-authored-by: Pierre Slamich <pierre@openfoodfacts.org>
2022-04-21 10:58:52 +02:00
7783e412e2 feat: Added core usage logging (#1147)
* feat: Initial tracking structure

* Added testing page

* Created track constructor

* Deleted unneccassary _trackConstructor params

* Finished start track

* Fix id + country

* Finished: trackScannedProduct

* Finished: trackProductPageOpen

* Finished: trackKnowledgePanelOpen

* Finished: trackOpenLink

* Finished: trackPersonalizedRanking

* Finished: trackSearch

* Added documentation + fixed imports

* Code review

* trackKnowledgePanelOpen

* Code review

* Update main.dart
2022-02-18 17:01:14 +01:00
954449e437 feat: #935 - now we display localized (downloaded) data during onboarding (#986)
Deleted files:
* `sample_eco_knowledge_panels.json`: replaced by new file `sample_knowledge_panels.json`
* `sample_health_knowledge_panels.json`: replaced by new file `sample_knowledge_panels.json`

New files:
* `abstract_onboarding_data.dart`: Abstraction of data we download, store and reuse at onboarding.
* `dao_string.dart`: Where we store strings.
* `loading_dialog.dart`: Dialog with a stop button, while a future is running.
* `onboarding_data_knowledge_panels.dart`: Helper around knowledge panels we download, store and reuse at onboarding.
* `onboarding_data_product.dart`: Helper around a product we download, store and reuse at onboarding.
* `onboarding_loader.dart`: Helper around data we download, store and reuse at onboarding.
* `sample_knowledge_panels.json`: json data downloaded today for en_US, cf. onboarding_data_knowledge_panels.dart
* `tmp.dart`: Fixes to off-dart.

Impacted files:
* `knowledge_panel_page_template.dart`: added parameters to 1. use the database (and downloaded data) and 2. limit the display to a given panel
* `knowlegde_panel_builder.dart`: added a method to display only one panel
* `local_database.dart`: added new dao `DaoString`
* `new_product_page.dart`: refactored
* `next_button.dart`: added an optional call to async methods at "next" time - e.g. data download
* `nutrition_page_loaded.dart`: now uses the new `LoadingDialog`
* `onboarding_flow_navigator.dart`: now using the database to get more relevant (previoulsy downloaded) data
* `preferences_page.dart`: now using previously downloaded data instead of assets
* `product_dialog_helper.dart`: now uses the new `LoadingDialog`
* `question_card.dart`: unrelated minor refactoring
* `sample_eco_card_page.dart`: now using previously downloaded data instead of assets, and displaying only the environment card
* `sample_health_card_page.dart`: now using previously downloaded data instead of assets, and displaying only the health card
* `sample_product_json.dart`: json data downloaded today for en_US, cf. onboarding_data_product.dart
* `sign_up_page.dart`: now uses the new `LoadingDialog`
2022-01-20 20:28:07 +01:00
5c7d1485de feat: #470 - hive instead of sqflite, and no more pantries and colors (#717)
Deleted files:
* `bulk_deletable.dart`
* `bulk_insertable.dart`
* `bulk_manager.dart`
* `dao_product_extra.dart`
* `label_sneek_peak_view.dart`
* `list_page.dart`
* `multi_product_select_page.dart`
* `product_copy_helper.dart`
* `product_copy_view.dart`
* `product_extra.dart`
* `product_list_add_button.dart`
* `product_list_button.dart`
* `product_list_item.dart`
* `product_list_item_pantry.dart`
* `product_list_item_shopping.dart`
* `product_list_preview.dart`
* `product_list_preview_helper.dart`

Impacted files:
* `abstract_dao.dart`: added hive related init methods
* `barcode_product_query.dart`: minor refactoring
* `category_product_query.dart`: minor refactoring
* `continuous_scan_model.dart`: minor refactoring
* `dao_product.dart`: rewritten from scratch with hive instead of sqflite - much easier to understand!
* `dao_product_list.dart`: rewritten from scratch with hive instead of sqflite - much easier to understand!
* `dao_string_list.dart` (renamed from `search_history.dart`): rewritten from scratch with hive instead of sqflite
* `database_product_list_supplier.dart`: minor refactoring
* `group_product_query.dart`: minor refactoring
* `history_page.dart`: minor refactoring
* `keywords_product_query.dart`: minor refactoring
* `local_database.dart`: rewritten from scratch with hive instead of sqflite; simplified
* `main.dart`: minor refactoring
* `new_product_page.dart`: minor refactoring
* `personalized_ranking_page.dart`: removed old feature
* `product_list.dart`: preferred `enum` to `String` for types; removed tons of old features
* `product_list_dialog_helper.dart`: removed old feature
* `product_list_item_simple.dart`: removed old features
* `product_list_page.dart`: removed old features
* `product_page.dart`: removed old feature
* `product_query_page_helper.dart`: cleaner code with `enum`s
* `pubspec.yaml`: added hive, removed sqflite
* `query_product_list_supplier.dart`: minor refactoring
* `search_history_view.dart`: minor refactoring
* `search_page.dart`: minor refactoring
2021-12-10 15:58:25 +01:00
8cf3879b35 Add search history (#560)
* Add search history

* Refactor SmoothApp and add SearchHistory provider

* Address review comments
2021-09-06 13:13:28 +01:00
c119b70854 Update lint rules 2021-07-22 13:12:26 -07:00
e19d3d638e Fixes #431 by changing the order of the database upgrade 2021-07-20 17:04:52 +02:00
0768228f3c Merge branch 'develop' into null-safety 2021-06-28 13:02:25 +02:00
194da755ef Null safety on data_models and database folders
As a side effect I've also removed 4 stale files that were kept "just in case".
2021-06-28 12:49:21 +02:00
f799430731 feature/#166_3 - user product lists are now reorderable
Database table `product_extra` replaces now dropped `product_list_item`.

New files:
* `bulk_deletable.dart`: Interface for bulk database deletes
* `bulk_insertable.dart`: Interface for bulk database inserts
* `bulk_manager.dart`: Manager for bulk database inserts and deletes

Impacted files:
* `abstract_dao.dart`: moved specific code to new classes `Bulk...`
* `dao_product.dart`: refactored
* `dao_product_extra.dart`: now manages the product list as "product extra"; now implements new interface `BulkDeletable`
* `dao_product_list.dart`: moved the data from table `product_list_item` to table `product_extra`; dropped table `product_list_item`; refactored
* `home_page.dart`: refresh after product list preview
* `list_page.dart`: refresh after product list preview
* `local_database.dart`: new database version
* `multi_select_product_page.dart`: refactored
* `product_copy_helper.dart`: refactored
* `product_list.dart`: added the list reordering feature; refactored
* `product_list_dialog_helper.dart`: refactored
* `product_list_page.dart`: some product lists are now reorderable and with dismissible items
* `product_list_preview.dart`: added the `andThen` parameter for a refresh afterwards
* `product_page.dart`: minor fix
* `query_product_list_supplier.dart`: refactored
* `smooth_it_model.dart`: refactored
2021-06-27 21:16:43 +02:00
30b549ebdc feature/#349 - refactoring the db + storing the product refresh timestamps
New files:
* `abstract_dao.dart`: DAO abstraction
* `dao_product_extra.dart`: DAO for Product Extra data

Impacted files:
* `barcode_product_query.dart`: automatically storing the product in the database
* `continuous_scan_model.dart`: refactored
* `dao_product.dart`: now extends new class `AbstractDao`; moved code to new class `DaoProductExtra`; refactored; optimized bulk actions
* `dao_product_list.dart`: now extends new class `AbstractDao`; now using new class `DaoProductExtra`; removed a SQLite foreign key for performance reasons; not storing products anymore (it's done somewhere else)
* `database_product_list_supplier.dart`: refactored because of `ProductListSupplier`
* `local_database.dart`: new database version; added `DaoProductExtra`
* `main.dart`: more verbose database crash message
* `product_dialog_helper.dart`: minor refactoring
* `product_list_supplier.dart`: refactored
* `product_page.dart`: now we display the access, the scan and the refresh timestamps in the lousy temporary button
* `product_query_model.dart`: removed the code regarding storing products in the database as it's now done in the `QueryProductListSupplier`
* `product_query_page.dart`: minor refactoring
* `product_query_page_helper.dart`: refactored because of `ProductListSupplier`
* `query_product_list_supplier.dart`: automatically storing the products in the database; refactored because of `ProductListSupplier`
2021-06-17 15:23:16 +02:00
bcd1511ea3 feature/#349 - now we store and display the whole history and scan timestamps
In table `product_extra` we added an `int` column:
* the primary keys are barcode and "extra key" (e.g. an id for each different list)
* there is an `int` value and a `String` value
* the `int` value is used for ordering data (timestamps or 1,2,3,...)
* the `String` value is used for storing more complex data as json (e.g. the list of timestamps for history)

The contents of table `product_extra` can be stored in flutter code with the new class `ProductExtra` (basically, `int` and `String`)

For the moment the history and scan timestamps of each product are available via a lousy button at the end of the page.

New file:
* `product_extra.dart`: Extra data attached to a Product when it belongs to a ProductList

Impacted files:
* `dao_product.dart`: added an `int` column to the product extra table; now we use new class `ProductExtra`; refactored
* `dao_product_list.dart`: now we use new class `ProductExtra`; refactored
* `local_database.dart`: upgraded the db version because of a new column; added helper method `timestampToDateTime`
* `product_list.dart`: now we use new class `ProductExtra`; refactored
* `product_list_page.dart`: now we use new class `ProductExtra`
* `product_page.dart`: added a sample button at the end of the page in order to display all history and scans related to the product
2021-06-09 15:50:51 +02:00
fef752865c bug/#297_2 - case and accent independent local database suggestion lookup
Now works only on the product name(s), too.

Impacted classes:
* `dao_product.dart`: added table `product_extra` for accented character management
* `local_database.dart`: incremented the database version from 3 to 4
* `pubspec.yaml`: added library `diacritic` for accented characters management
2021-04-09 16:35:03 +02:00
4e991bfe26 Version 2.0.0 fixes (#224) 2021-03-04 15:38:17 +01:00
50f12caae5 feature/#148 - added editable icon and color to product lists
Impacted files:
* `dao_product_list.dart`: created the new `product_list_extra` table and accessed it
* `home_page.dart`: not 100% unrelated - now using new method `SmoothTheme.getForegroundColor`
* `list_page.dart`: added the background color to the product list card
* `local_database.dart`: upgraded to version 3, in order to create the new `product_list_extra` table
* `product_list.dart`: added extraTags field (for the moment, icon and color)
* `product_list_dialog_helper.dart`: added method `openChange`; minor refactoring
* `product_list_page.dart`: added the background color and the icon to the app bar, added the change icon menu item
* `smooth_theme.dart`: not 100% related - added methods `getForegroundColor` and `getBackgroundColor` in order to get unified shades
2021-02-07 13:39:39 +01:00
e58bcb3d1a feature/#21_3 - display the list of product lists, added product history
New files:
* `list_page.dart`: display the list of product lists
* `product_list_page.dart`: displays a product list

Impacted files:
* `dao_product_list.dart`: added methods `delete` and `getAll`; refactored
* `local_database.dart`: implemented the `notifyListeners` method
* `main.dart`: replaced the "track" option with "lists" on the bottom menu
* `personalized_ranking_page.dart`: simplified the "sliver" effects with standard flutter behavior
* `product_list.dart`: added the "history" list and the database read-only fields
* `product_page.dart`: added the product to "history" every time the page is displayed; added a standard back button
* `product_query_page.dart`: refactored
* `product_query_page_helper.dart`: added methods to the helper class
2021-01-25 15:58:25 +01:00
69c3dbf960 feature/#21 - scan now uses local database, for product look up and for its history
New file:
* `scan_page.dart`: helper class to be used on top of `AlternativeContinuousScanPage` and `ContinuousScanPage`

Impacted files:
* `alternative_continuous_scan_page.dart`: `ContinuousScanModel` is now initialized upstream by `ScanPage`
* `continuous_scan_model.dart`: now a `ChangeNotifier`, uses a `ProductList` and database cache
* `continuous_scan_page.dart`: `ContinuousScanModel` is now initialized upstream by `ScanPage`
* `contribution_page.dart`: uses the new `ScanPage` widget instead of the 2 scan pages
* `local_database.dart`: removed the dummy notify listener method
* `main.dart`: uses the new `ScanPage` widget instead of the 2 scan pages
* `personalized_ranking_page.dart`: now we use a `ProductList` as input
* `product_list.dart`: added a `getProduct` method and a "scan list" identifier
* `product_page.dart`: unrelated UI fixes
* `product_query_page.dart`: slight refactoring
* `smooth_it_model.dart`: now we use `ProductList`
* `smooth_product_carousel.dart`: added the new "CACHED" product possibility; fixed an init bug
2021-01-16 12:31:04 +01:00
43fda6eed7 feature/#21 - automatically storing keywords and group results into the database
... and automagically asking the end-user if they want to see the cache

New files:
* `dao_product.dart`
* `dao_product_list.dart`
* `database_product_list_supplier.dart`
* `product_list.dart`
* `product_list_supplier.dart`
* `product_query_page_helper.dart`
* `query_product_list_supplier.dart`

Impacted files:
* `choose_page.dart`: now uses `ProductQueryPageHelper` in order to get database or http results; refactored
* `continuous_scan_model.dart`: minor refactoring due to DAO
* `group_product_query.dart`: now implements new method `getProductList`
* `keywords_product_query.dart`: now implements new method `getProductList`
* `local_database.dart`: now it's version 2; refactored using the new DAO classes
* `product_query.dart`: new method `getProductList`
* `product_query_model.dart`: now we use a `ProductListSupplier` instead of a `ProductQuery`
* `product_query_page.dart`: now we use a `ProductListSupplier` instead of a `ProductQuery`
2021-01-10 16:43:50 +01:00
c5f5b93b6f feature/#55 - experimenting the NotifyListeners method in a clean model without Widgets
Impacted files:
* `alternative_continuous_scan_page.dart`: refactoring mainly due to changes in `ContinuousScanModel`
* `continuous_scan_model.dart`: now we don't deal with `Widget`s, only metadata, and we use a NotifyListeners method
* `continuous_scan_page.dart`: refactoring mainly due to changes in `ContinuousScanModel`
* `contribution_page.dart`: unrelated refactoring about the use of `UserPreferences`
* `local_database.dart`: added a temporary "dummy"`NotifyListeners` method, for the sake of demonstration - to be removed
* `smooth_product_carousel.dart`: now we build the `Widget`s from metadata, and we control here the carousel
2021-01-02 14:25:16 +01:00
2dbb6b62ac feature/#55 - SQLite local database, and refactoring with StatefulWidget's
New files:
* `barcode_product_query.dart`: API query / product by barcode (used to be in `full_products_database.dart`)
* `local_database.dart`: local SQLite database with one table (`product`)

Deleted files:
* `choose_page_model.dart`: moved the code to `StatefulWidget` `ChoosePage`
* `full_product_database.dart`: database code was deprecated; API fields is now in `ProductQuery`

Impacted files:
* `alternative_continuous_scan_page.dart`: now a `StatefulWidget`; refactored with `ContinuousScanPage`
* `build.gradle`: unrelated - lowered the Android `minSdkVersion` from `24` to `19`, in order to run the app on my old smartphone ;)
* `choose_page.dart`: refactoring as changed to `StatefulWidget`
* `continuous_scan_model.dart`: not a `ChangeNotifier` anymore - should be improved when we use product list
* `continuous_scan_page.dart`: now a `StatefulWidget`
* `group_product_query.dart`: minor refactoring due to the changes in `product_query.dart`
* `keywords_product_query.dart`: minor refactoring due to the changes in `product_query.dart`
* `main.dart`: added `LocalDatabase` to the providers; simplified the code; removed mentions to `SharedPreferences`
* `product_query.dart`: refactored a bit; moved here some fields from `full_product_database.dart`
* `product_query_model.dart`: now using `LocalDatabase`
* `product_query_page.dart`: now using `LocalDatabase`; refactoring
* `pubspec.yaml`: replaced `sembast with `sqflite`
2021-01-01 21:11:15 +01:00