-
-
Notifications
You must be signed in to change notification settings - Fork 287
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Ensure that Smoothie can read and migrate the database of Open Food Facts v1 on Android #1234
Comments
@teolemon We need help from the Android team here, to provide us with each needed table creation script:
|
@VaiTon would like to have your input on that one. |
The class I'm not sure though how we'll be able to read from the native app DB since we're using another ID and android doesn't allows to read from a different app unless stated otherwise by the native app. |
But changing the app id shouldn't be a big problem right |
@VaiTon Among the hypotheses was the perilous option to let "smoothie" pretend being a next version of the current android app (same Anyway, the first question is: "is there a way to get the schema of the current android database, possibly with the meaning of each column?". Like, the generated
@M123-dev I don't share your optimism... |
The idea is to swap the app, so the Flutter app would become source wise org.openfoodfacts.scanner, and the Classic Android app would become the current org.openfoodfacts.app |
It does have to be done carefully |
Every table is made of rows represented by GreenDao You can find the Entities classes here (except the MapOfStringsToStringConverter.java) They are the only classes in java because GreenDAO does not support Kotlin so no way to convert them. |
@teolemon I like your understatement, so British :) Thank you @VaiTon for those details. And the main trouble with all that "swap" idea is that I cannot picture how to test the migration from one android version of the app to the flutter version of the same app. I definitely think we should rather implement some kind of data sync between android and the server, and between flutter and the server (and of course ios / server). That way we implement a meaningful, testable and reusable code. |
IMHO the only thing worth moving (if any) are user lists. Offline products are not made to stay indefinetly in local storage and allergens can be set at the app first start. |
history being a userlist. agreed @VaiTon |
If that's the case we can think of implementing a custom content provider into the native app and then query it from flutter (idk if that's possible) as stated in this post to get a csv/json/interoperable format that we can parse in flutter. |
Indeed it would make sense to be able to:
That mechanism
|
Would you guys want me to work on a module that imports a product lists json? [Edit]: little detail - for the moment we only have "history" and "scan history" lists in smoothie, no user-defined lists. |
That would be awesome. |
@teolemon Ok then. {
"list": ["12345", "23456", "34567"],
"data":{
"12345": {"qty":5}
}
} Probably for "history" we won't have a "data" section, unless you keep timestamps (we currently don't in smoothie). |
@monsieurtanuki what's the use of |
@VaiTon The use of data is optional. In previous smoothie versions there were data attached to products (for a shopping list a quantity, for a pantry a list of qty * "best before" dates, for history a "last seen" date). That said, regarding the migration from android
|
…ith 3 products. New file: * `product_list_import_export.dart`: Import / Export of product lists via json. Impacted file: * `user_preferences_dev_mode.dart`: added a button that clears history and put 3 products in there.
…s. (#1514) New file: * `product_list_import_export.dart`: Import / Export of product lists via json. Impacted file: * `user_preferences_dev_mode.dart`: added a button that clears history and put 3 products in there.
any update on this ? |
@teolemon I'm starting an export/import feature on Smoothie, that can be used "internally" from list to list, perhaps through the clipboard. |
…ist page New file: * `product_list_clipboard_helper.dart`: Helper class around [ProductList] and clipboard operations (copy/paste). Impacted files: * `dao_product_list.dart`: new method `setAll` in order to add/remove barcodes; removed a now useless product list export method * `product_list_page.dart`: added popup menu items "copy" and "paste"; refactored with `_SelectionMode` as we can now select items for copy too (not only compare); added icons to popup menu items * `pubspec.lock`: wtf * `pubspec.yaml`: added `clipboard` as dependency * `user_preferences_dev_mode.dart`: removed a now useless product list export feature
Here is the plan that we've discussed the other day during the community event:
|
I'd say a dedicated folder would be enough but feel free to create a new package, I mean we already have the folder structure for that |
@g123k Understood. |
Hi, A quick world after this morning's presentation, where the migration on Android is mostly OK.
Regarding the architecture, we have two packages:
On Smoothie, the import feature has been a little tweaked and used (thanks @monsieurtanuki) to now support history and credentials. The migration is started on the first launch. If for some reason, it failed, it will retry later (a maximum number of retries is implemented). We also consider the credentials import as non-blocking because the user may have changed his password. A few things are still in progress (e.g.: limiting the number of requests with a large history…), but for Android, we can assume that it's OK. Before releasing any PR, I prefer to finish implementing the iOS part, to be sure I don't have to change the API between Smoothie <-> package. If you have any questions, feel free to do so! |
What
@Entity
es.Related
Part of
The text was updated successfully, but these errors were encountered: